What does HackerNews think of vim-surround?
surround.vim: Delete/change/add parentheses/quotes/XML-tags/much more with ease
I exclusively use the visual mode commands though, because I find the normal-mode commands confusing.
cs"': change surrounding quotes, e.g. "foo" -> 'foo'
cs([: change surrounding brackets, e.g. (foo) -> [ foo ]
( cs]) would omit the spaces)
ci": change in quotes, e.g. "foo" -> "" (in insert mode between the quotes)
ca": change around quotes, e.g. x"foo"y -> xy (in insert mode between x and y
viWS: add tag around current word using visual mode, e.g. foo -> foo
dst: delete surrounding tag, e.g. foo -> foo
It's really good. I'm not familiar with argument.
ys2w) will put brackets around the next 2 words. That is a beautiful thing.
Plugins:
https://github.com/tmhedberg/matchit
https://github.com/tpope/vim-sleuth
https://github.com/tpope/vim-repeat
https://github.com/tpope/vim-surround
https://github.com/junegunn/fzf.vim
(also see https://jesseleite.com/posts/2/its-dangerous-to-vim-alone-ta... )
Some snippets:
https://github.com/mhinz/vim-galore#change-cursor-style-depe...
https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-...
and a similar snippet:
" consistent direction regardless of initial charsearch direction for ; and ,
nnoremap ; ',;'[getcharsearch().forward]
nnoremap , ';,'[getcharsearch().forward]
I use my arrow keys for buffer navigation in normal mode: nnoremap :Buffers
nnoremap :b#
nnoremap :bp
nnoremap :bn
...and disable them in insert mode: inoremap
inoremap
inoremap
inoremap
As for other plug-ins, there are a few I would recommend (can you tell I'm a Tim Pope fan?):
- vim-commentary: Gives bindings for commenting out code quickly: https://github.com/tpope/vim-commentary
- vim-surround: Easily surround selected text with symbols: https://github.com/tpope/vim-surround - vim-unimpared: Adds bindings for some misc. commands, like enabling relative line numbers and spellcheck: https://github.com/tpope/vim-unimpaired
- vim-repeat: Allows many more commands to be repeated with . : https://github.com/tpope/vim-repeat
- VimCompletesMe: A much more bare-bones auto-completion tool than YouCompleteMe, hitting tab gives you matches from your previously typed text. It's also all in vimscript so it's much easier to install and manage: https://github.com/ajh17/VimCompletesMe
- Pathogen: A plug-in manager, if you can call it that. It simply re-adjusts the file paths so you can centralize your plugin directory. Some plug-in managers will auto-update, but I never liked that, just run git pull if you wish to update a plugin: https://github.com/tpope/vim-pathogen
There are some other cosmetic ones I like as well, like airline, and vim-highlightyank, but that's a personal preference.