Make changes work with buffers

This commit is contained in:
Alex Yatskov 2015-03-25 14:31:14 +09:00
parent ebe4380188
commit b7fc4d414f
3 changed files with 13 additions and 9 deletions

View File

@ -25,9 +25,9 @@ information.
`nnoremap <silent> <leader>a :ArgWrap<CR>` `nnoremap <silent> <leader>a :ArgWrap<CR>`
3. You can customize the wrapping/unwrapping behavior of this extension by setting values for any of the following 3. You can customize the wrapping/unwrapping behavior of this extension by setting values for any of the following
optional global variables in your `.vimrc` file: optional buffer and global variables in your `.vimrc` file:
* `g:argwrap_wrap_closing_brace` * `g:argwrap_wrap_closing_brace` or `b:argwrap_wrap_closing_brace`
Specifies if the closing brace should be wrapped to a new line. This setting is helpful when working with Specifies if the closing brace should be wrapped to a new line. This setting is helpful when working with
languages such as Google's [Go](https://golang.org/project/), which enforce coding style during compliation. languages such as Google's [Go](https://golang.org/project/), which enforce coding style during compliation.
@ -54,7 +54,7 @@ information.
wubble) wubble)
``` ```
* `g:argwrap_padded_braces` * `g:argwrap_padded_braces` or `b:argwrap_wrap_closing_brace`
Specifies which brace types should be padded on the inside with spaces: Specifies which brace types should be padded on the inside with spaces:

View File

@ -177,13 +177,17 @@ function! argwrap#unwrapContainer(range, container, arguments, padded)
endfunction endfunction
function! argwrap#toggle() function! argwrap#toggle()
if exists('g:argwrap_wrap_closing_brace') if exists('b:argwrap_wrap_closing_brace')
let l:wrapBrace = b:argwrap_wrap_closing_brace
elseif exists('g:argwrap_wrap_closing_brace')
let l:wrapBrace = g:argwrap_wrap_closing_brace let l:wrapBrace = g:argwrap_wrap_closing_brace
else else
let l:wrapBrace = 1 let l:wrapBrace = 1
endif endif
if exists('g:argwrap_padded_braces') if exists('b:argwrap_padded_braces')
let l:padded = b:argwrap_padded_braces
elseif exists('g:argwrap_padded_braces')
let l:padded = g:argwrap_padded_braces let l:padded = g:argwrap_padded_braces
else else
let l:padded = '' let l:padded = ''

View File

@ -36,10 +36,10 @@ INSTALLATION *argwrap-installation*
nnoremap <silent> <leader>a :ArgWrap<CR> nnoremap <silent> <leader>a :ArgWrap<CR>
3. You can customize the wrapping/unwrapping behavior of this extension by 3. You can customize the wrapping/unwrapping behavior of this extension by
setting values for any of the following optional global variables in your setting values for any of the following optional buffer and global
.vimrc file: variables in your .vimrc file:
* g:argwrap_wrap_closing_brace * g:argwrap_wrap_closing_brace or b:argwrap_wrap_closing_brace
Specifies if the closing brace should be wrapped to a new line. This Specifies if the closing brace should be wrapped to a new line. This
setting is helpful when working with languages such as Google's Go, setting is helpful when working with languages such as Google's Go,
@ -64,7 +64,7 @@ INSTALLATION *argwrap-installation*
wubble) wubble)
``` ```
* g:argwrap_padded_braces * g:argwrap_padded_braces or b:argwrap_padded_braces
Specifies which brace types should be padded on the inside with spaces: Specifies which brace types should be padded on the inside with spaces: