I've been hooked on vim for the best part of 18 months now, and earlier this year I decided it was time to step away from my comfort of using the ultimate vim setup and make my own.
At the end of the day, most users won't touch half the features that come with a pre-configured setup that big, and it turned out I could strip what I actually used from it into my own vimrc fairly easy.
Whilst I have more than just the plugins below, these are the 5 I use the most frequently.
Vim doesn't come with everything out of the box, part of the reason we love it. As simple as it is, vim surround makes editing code a breeze. How many times have you been in some js and realised you needed string interpolation? Vim surround makes this easy, simply press
You can even change HTML tags with
Tpope is at it again - vim commentary is another simple plugin that just makes life easier.
Want to comment out the 5 lines below in the correct format for the file you're in? Easy -
The only one I've had some issues with is typescript & react, and for that i've just written the below in my vimrc
Spending more time on front-end code recently has made me appreciate emmet even more. It's just one of those plugins you have to have in a code editor.
Will simply resolve to
That's right, I've left the best for last. Jump around files like it's no ones business with some simple key mappings, and have code suggestions/autocomplete in almost any language.
There is even an LSP for TailwindCSS which I've been enjoying using recently, no more visiting the website every time you forget a classname!
One of the best things about vim is the movement - Not only does coc provide amazing autocomplete, but it just takes movement to the next level.
Add a few bindings to your vimrc and from JS imports, classes or methods in Ruby, whatever you want.
nmap <buffer> <leader>gd <Plug>(coc-definition) nmap <buffer> <leader>gr <Plug>(coc-references)
Go to the definition with your binding, and use vims built in jumping to get you right back where you were, no time wasted at all!
If you haven't used fzf yet, you're going to be blown away. I've been using FZFs file searching in a project that has been developed for over 10 years and FZF still proves its, as they put themselves, blazingly fast.
I add some simple keybinds for easy access
nnoremap <C-T> :Files<cr> nnoremap <Leader>b :Buffers<cr> nnoremap <Leader>s :BLines<cr>
FZF and RG makes search a project easier than it's ever been.
Sitting down and writing my own vimrc, taking my favourite parts from different repositories and customising them took time, but has proved to be priceless.
As with anyone who uses vim will tell you, there is always more to learn, and that's what I love about it.
If you want to check out my dotfiles, you can see them below.
Thanks for reading :)