From b7fc4d414fa58a3571afdbeab02e38880697c918 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 25 Mar 2015 14:31:14 +0900 Subject: [PATCH] Make changes work with buffers --- README.md | 6 +++--- autoload/argwrap.vim | 8 ++++++-- doc/argwrap.txt | 8 ++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 029b32c..b1ff543 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ information. `nnoremap a :ArgWrap` 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 languages such as Google's [Go](https://golang.org/project/), which enforce coding style during compliation. @@ -54,7 +54,7 @@ information. 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: diff --git a/autoload/argwrap.vim b/autoload/argwrap.vim index 904a671..6041e0c 100644 --- a/autoload/argwrap.vim +++ b/autoload/argwrap.vim @@ -177,13 +177,17 @@ function! argwrap#unwrapContainer(range, container, arguments, padded) endfunction 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 else let l:wrapBrace = 1 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 else let l:padded = '' diff --git a/doc/argwrap.txt b/doc/argwrap.txt index 6f3d14f..134da4c 100644 --- a/doc/argwrap.txt +++ b/doc/argwrap.txt @@ -36,10 +36,10 @@ INSTALLATION *argwrap-installation* nnoremap a :ArgWrap 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: + setting values for any of the following 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 languages such as Google's Go, @@ -64,7 +64,7 @@ INSTALLATION *argwrap-installation* 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: