vim-surround
vim-surround copied to clipboard
Introduce configuration option to disable adding spaces
Although I'm familiar with the possibility of using closing brackets (as was added to the FAQ) to prevent adding spaces - I personally have no use cases that require such spaces, and reaching further (to the closing bracket) is less comfortable - thus I'd like the option to disable this feature entirely.
For this I have added a configuration option to disable/disclude such spaces like so:
let g:surround_insert_space = 0
(the default value will remain 1
, so as not to break existing/expected behavior)
It's safe to assume that for such a common issue (https://github.com/tpope/vim-surround/issues/366, https://github.com/tpope/vim-surround/issues/363, https://github.com/tpope/vim-surround/issues/314, https://github.com/tpope/vim-surround/issues/303, https://github.com/tpope/vim-surround/issues/240, https://github.com/tpope/vim-surround/issues/205, https://github.com/tpope/vim-surround/issues/108, https://github.com/tpope/vim-surround/issues/27 ...), at least some of these other users could benefit from such a feature.
P.S. This is my first contribution to any VimScript project, I am warmly open to any feedback. I reviewed the Pathogen contribution guide referenced in the project's readme.
Would you consider adding a toggle? i.e. add whitespace on closing bracket instead of opening? Thanks!
Would you consider adding a toggle? i.e. add whitespace on closing bracket instead of opening? Thanks!
I'm not sure exactly what you mean; the toggle I suggested is as a global setting
@maze88 my understanding is that your setting will enable disable whitespace being added with brackets. My suggestion (in addition to your flag) is that users can choose if whitespace is added in opening or closing brackets (toggle from opening bracket currently to closing bracket).
@maze88 my understanding is that your setting will enable disable whitespace being added with brackets. My suggestion (in addition to your flag) is that users can choose if whitespace is added in opening or closing brackets (toggle from opening bracket currently to closing bracket).
Ahh, now I understood... Interesting concept - but I wouldn't be able to implement it with my minimal VimScript knowledge.
Perhaps create a separate fork and PR, to offer it?
@rkochar I had the same need, so I added two new options by referring to these codes in this PR.
let g:surround_insert_space_left = 1 " left: opening brackets
let g:surround_insert_space_right = 0 " right: closing brackets
here #387