For the last 2 years, I’ve been in a loving relationship with Vim’s modal editing, but my actual setup has changed a lot with time (not even always using Vim itself), as, let’s face it, out-of-the-box Vim is pretty lacking for anything else than a quick edit of a couple of files.
Nowadays, I managed to create a comfy config that can even rival with VSCode (my other great love). These are the plugins I’m using atm, but I keep a more up to date version here.
🏖 Quality of life plugins
First, the things that make my day to day easier, and take Vim from an old clunky command line notepad, into a modern and powerful tool.
- Vim-Plug: A really simple and easy to use plugin manager.
- Airline: A lightweight status line.
- SuperTab: Use Tab for navigate autocomplete suggestions.
- FzF: Fuzzy finding of files by name, with a really useful preview.
- The Silver Searcher: Not really a plugin, but a great companion for FzF. Gives you a better way to search for text inside the files. (Bonus: Skim: Rust version of FzF 🦀! Way faster, but I find the Silver Searcher integration unreliable. For now I have both installed, Skim for searching files and FzF + Silver Searcher for searching -into files.)
- CoC-Pairs: Not a Vim plugin, but a CoC one. Auto pairs like in VSCode.
- Signify: Until very recently, I used GitGutter, but in my current role we use SVN, so I switched to Signify. It is essentially the same, but not limited to Git. Basically, it shows markers of line beside the line number, allows to jump between them, preview, undo, etc.
- Fugitive: Git tools. I don’t really use it that much lately, but it deserves a mention.
- Surround: A classic. Quickly add/replace surrounding text.
- Visual Multi: Sublime Text style multiple cursors.
- EasyMotion: One of those plugins that become indispensables. Lets you jump easily to any point of the code.
💬 Language plugins
The real core of coding tools: Language-specific tools. Code navigation, autocomplete, etc.
- Conquer of Completion (CoC): Intellisense on Vim! 💖 This on itself is just a blank slate. You have to install its own plugins for each language.
- Polyglot: Better syntax highlighting for a lot of languages.
Like many of us, I live a double dev life: at work and at home.
My personal projects are usually small and written on C++, Rust and lately Swift, while my job requires a huge C++ code base.
For my small C++ projects, I find that the Clangd LSP works great.
- CoC’s SourceKit: The Apple’s LSP for Swift
- CoC’s Rust Analyzer: Rust Analyzer is a great Rust LSP. More complete and powerful than the default.
- CoC’s Clangd: One of the best C++ LSP IMHO (if you use Clang)
- GLSL: Syntax highlight for GLSL
However, I’ve failed miserably trying to make it work in my office (It’s a huge codebase that takes ~15–20' to compile after all). For that reason, I stepped back into…
- Gutentags: Automates the generation of the tags, for a more IDE-like feel.
- Universal Ctags: Not a plugin, but the best choice for generating tags.
I must say that Ctags is amazingly reliable for code navigation (which most of what I really need to be productive), but it lacks decent autocompletion.
Adding the following to the Vim config gives some useful extra info:
let g:gutentags_ctags_extra_args = ['--fields=+ainKz']
And this will prompt you with a list of possible results when jumping to a tag that overlaps with others:
nmap <C-]> g<C-]>
Make it shiny!
Finally, stuff that makes it prettier, but that doesn’t add much functionality.
Originally published at https://dev.to on November 3, 2020.