Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion plugin/surround.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand Down