This commit is contained in:
Michael Zeevi 2023-06-17 14:40:43 +03:00 committed by GitHub
commit dd7ba89d1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -77,6 +77,9 @@ support:
Only the opening brackets—`[`, `{`, and `(`—add a space. Use a closing
bracket, or the `b` (`(`) and `B` (`{`) aliases.
Alternatively, to _completely disable_ adding of spaces (even with opening
brackets) - then one may set `let g:surround_insert_space = 0`.
## Contributing
See the contribution guidelines for

View file

@ -7,6 +7,7 @@ if exists("g:loaded_surround") || &cp || v:version < 700
finish
endif
let g:loaded_surround = 1
let g:surround_insert_space = get(g:, 'surround_insert_space', 1)
" Input functions {{{1
@ -237,7 +238,7 @@ function! s:wrap(string,char,type,removed,special)
let before = '('.fnc.' '
let after = ')'
elseif idx >= 0
let spc = (idx % 3) == 1 ? " " : ""
let spc = (idx % 3) == 1 && g:surround_insert_space ? " " : ""
let idx = idx / 3 * 3
let before = strpart(pairs,idx+1,1) . spc
let after = spc . strpart(pairs,idx+2,1)