Vim is my full time text editor. But this post isn't going to be about how you should also use it as your full time text editor - I don't think that makes sense for most normal people.
If you are a developer, you are probably going to come into contact with Vim at some stage. Whether its to edit your commit messages if you use the Git CLI or you need to make some edits to a file while in an ssh session, Vim is probably what you will use.
This post is more like a list of resources that helped me get started with Vim, in the hope that it might help someone else begin there path to enlightenment in the future.
Learning the key binds
My favorite things about Vim are that its highly configurable and has shortcuts in abundance. Lots of its built in features and keyboard based navigation make simple file editing a breeze.
Here are some great resources for getting started with Vim without configuring it at all.
- http://vim-adventures.com/ is a browser based adventure game that's aim is to teach you many of Vim's core features.
- http://www.openvim.com/ is a browser console based tutorial.
- vimtutor - if you have Vim
installed, your probably have this command too. It starts up the Vim tutor
program, which is a text file of instructions and execises you can follow.
All that can seem a bit tedious at first - but that's because its something that we don't have to deal with due to modern text editors existing. The mouse can perform most of these functions for us in Sublime Text etc. But once you master Vim's key binds and shortcuts, I can guarantee you will be editing text much faster than before.
Vim can be molded to be nearly anything. The default configuration is just a start - you can add key maps, functions that execute when you are in different modes, and plugins that add heaps of functionality to the editor.
You can configure Vim via the ~/.vimrc file. Rather than go in depth about what you can put in there, I would suggest reading some examples.
- Amir Salihefendic's "Ultimate Vim Configuration"
- Tim Pope's "sensible.vim"
- Or you can check out my
As you can gather from those, there isn't really a limit to what you can do with Vim configuration. Most of the cool stuff you can add to Vim can be achieved with plugins.
If you are going to install plugins for Vim, you probably care about using it beyond more than simple file edits. So you are probably going to want a way to manage your plugins.
There are a lot of solutions for plugin management out there. Tim Pope's pathogen.vim is a very popular one, but that doesn't provide an easy way to actually document which plugins you are using. I personally use vim-plug which does offer a way to document which plugins you have installed, and gives you some nice configuration options for when plugins load, including what file types to load them for, so if you have a lot of plugins you won't have a long start up time when you launch the editor. Check out the vim-plug readme for more information.
But the above doesn't matter that much. Choose a plugin manager that you can get on with.
I have 62 Vim plugins installed at the time of writing. That is quite a few, and I am not going to bore you with all of them. But here are the ones I find most useful.
- vim-sensible. I don't actually use this myself, but it provides a lot of good defaults that I have ended up with anyway.
- vim-fugitive is the best Git wrapper for Vim. It offers handy shortcuts for doing almost all Git actions, and provides :Gbrowse for linking to the file you have open in Vim on GitHub.
- nerdtree is a file browser for Vim, similar to the tree view from Sublime Text/Atom, and makes it easy to create, move and delete files.
- fzf.vim provides fuzzy file/buffer
finding in Vim that is super fast. Requires you to have
fzf installed too.
Most of the rest of my plugins are installed through personal preference or because of my use of the language that the plugin caters for in some way. If you want to hunt for more plugins, checkout vimawesome.com.