mirror of
https://github.com/tpope/vim-surround.git
synced 2026-09-10 07:16:17 -04:00
Merge 6a0a715fed into 3d188ed211
This commit is contained in:
commit
e88977f8f6
|
|
@ -77,6 +77,12 @@ support:
|
|||
Only the opening brackets—`[`, `{`, and `(`—add a space. Use a closing
|
||||
bracket, or the `b` (`(`) and `B` (`{`) aliases.
|
||||
|
||||
Two new global variables have been added to toggle whether spaces are added
|
||||
to the opening and closing brackets, respectively
|
||||
|
||||
let g:surround_insert_space_left = 1 " left: opening brackets
|
||||
let g:surround_insert_space_right = 0 " right: closing brackets
|
||||
|
||||
## Contributing
|
||||
|
||||
See the contribution guidelines for
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ if exists("g:loaded_surround") || &cp || v:version < 700
|
|||
endif
|
||||
let g:loaded_surround = 1
|
||||
|
||||
let g:insert_space_left = get(g:, 'surround_insert_space_left', 1)
|
||||
let g:insert_space_right = get(g:, 'surround_insert_space_right', 0)
|
||||
|
||||
" Input functions {{{1
|
||||
|
||||
function! s:getchar()
|
||||
|
|
@ -237,7 +240,14 @@ function! s:wrap(string,char,type,removed,special)
|
|||
let before = '('.fnc.' '
|
||||
let after = ')'
|
||||
elseif idx >= 0
|
||||
let spc = (idx % 3) == 1 ? " " : ""
|
||||
let pos = idx % 3
|
||||
let spc = ""
|
||||
if g:insert_space_left && pos == 1 " left brackets
|
||||
let spc = " "
|
||||
endif
|
||||
if g:insert_space_right && pos == 2 " right brackets
|
||||
let spc = " "
|
||||
endif
|
||||
let idx = idx / 3 * 3
|
||||
let before = strpart(pairs,idx+1,1) . spc
|
||||
let after = spc . strpart(pairs,idx+2,1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue