Setting up Vim
A short, but sweet .vimrc file
When did you first learn about Vim? Were you one of those unfortunate souls, who just wanted to run a git command, but ended up trapped in vim? Many of us have been there. Ending up in vim accidentally is like being accidentally teleported to an unknown planet. How are you supposed to google your way out if you do not know where you even are?
I’m still not sure, is vim something everybody knows and uses or maybe just “knows and not-uses” or is it actually really obscure. I only started using it, when I took a deep dive into git commands. Once you start using it, you suddenly realize that GUIs might be overrated. Many things are easier in a GUI, but many things are just as easy in the terminal.
How to first approach vim?
Just go through
vimtutor is a great vim instruction manual and exercise book. It is probably already installed on your computer, it comes together with the vim installation. To start it, just type
vimtutor in your terminal:
and you are transported into the vim editor with lessons and instructions and examples to practice commands on.
Once you go through the whole tutorial or at least the first few lessons, using vim becomes child’s play (including closing it). The next step is to modify vim to make it suit your needs. A vast number of settings and plugins is available for vim. But by default, most settings are turned off.
Pimp my vim
Curiously, lots of essential vim settings are disabled by default. A good example is showing line numbers:
To enable them in an open vim editor, type
[ESC] and then
:set number and
[ENTER]. This will make the line numbers immediately appear.
To disable it again, type
:set number! +
Sometimes you might want to know the value of a setting, for this the command is
:echo &<setting_name>, i.e.
To change the default behavior, create a
.vimrc file in your home directory:
vim ~/.vimrc and add any number of settings.
Here is a list of default vim settings I have in my
Have fun testing out vim.