Setting up Vim

A short, but sweet .vimrc file

Ines Panker
Dec 24, 2019 · 3 min read
Image for post
Image for post

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.

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:

Image for post
Image for post

To enable them in an open vim editor, type [ESC] and then :set number and [ENTER]. This will make the line numbers immediately appear.

Image for post
Image for post

To disable it again, type [ESC] + :set number! + [ENTER].

Image for post
Image for post

Sometimes you might want to know the value of a setting, for this the command is :echo &<setting_name>, i.e. :echo &number.

Image for post
Image for post

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 .vimrc file:

Have fun testing out vim.

The Startup

Medium's largest active publication, followed by +716K people. Follow to join our community.

Ines Panker

Written by

Software Developer by profession, Explorer by mind. The more I know, the more I understand. http://www.ines-panker.com/

The Startup

Medium's largest active publication, followed by +716K people. Follow to join our community.

Ines Panker

Written by

Software Developer by profession, Explorer by mind. The more I know, the more I understand. http://www.ines-panker.com/

The Startup

Medium's largest active publication, followed by +716K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store