Over the last couple of years I’ve been increasingly interested and dedicated to two of my favorite hobbies: writing and programming. And while I make a living out of programming, writing has always been my secondary occupation.
While it’s quite easy to find a good tool for writing code and a good tool for writing prose and technical writing, it is quite hard to find a tool that does it for both. Left alone being fast, lightweight and cross-platform.
And then I found VIM!
Vim is a modal text editor that’s ageless, cross-platform, super fast and highly customizable. Vim also has the benefit of benefiting those who spend their time learning and mastering it. Simple things like being able to pin-point customize it and not needing to use to use the mouse at all can boost your productivity by a million. In other words, Vim can truly be your own text editor.
There are thousands, if not millions of resources out there on using Vim to program. But what about writing? Today I present you some of the reasons I use it for writing, why you should consider it and also some tips on how to use it and improve it for writing.
First of all, why should you use Vim for writing? We can look at it a couple of different ways, but at the end of the day, here are my top reasons for why Vim is a great tool for writing:
While all these reasons are very valid and encouraging, that is one thing that scares everyone when talking about switching to Vim.
What about the learning curve?
I always say that Vim has a steep learning curve when it comes to master it. But the basics are pretty easy to grasp and you can start being productive with it in something from 2 days to a week.
Learning Vim
There are a lot of resources that can help you learn Vim. I always recommend the most basic and simple of all, but yet, one of the the best in my opinion. Just install Vim in whatever operative system you have and run “vimtutor” in the command line.
Vimtutor is an hands-on tutorial that will take you 45 minutes or an hour to complete. In my early days of learning Vim I used to do Vimtutor once or twice a week. And every time I did, it was amazing the amount of news things I learned. It is quite possible I would learn something new about Vim if I did it right now.
My challenge to you is to take the next hour and do the Vimtutor tutorial, then comeback to this article. I’m pretty sure you’ll enjoy it.
Now that you have some basic grasps on the inner workings of Vim let’s get to writing!
In my point of view, there are a couple of basic functionalities a text editor must have so it can be used to write:
Vim provides them all, and much more. But before we go into them, lets take a little time to do some very light configuration. This will set up us up with things like line numbering and search configurations. Open up you .vimrc file (you probably learned about it in vimtutor, .vimrc is the configuration file) and add the following:
set nocompatible “Use vim like it’s 2017
set number “Line numbering
set hlsearch “Highlight search results
set incsearch “Set incremental search
There are a lot more configuration options that can be added. If you have any doubts on what these lines do, just type “:h <command>” in normal mode. For example “:h incsearch”. This will bring up the help file. Help in Vim is really really good, so be sure to check it. Also check the following options: formatoptions, textwidth, wrapmargin, foldcolumn and columns as they might help you setting up your own workflow.
Search
When it comes to searching, it is explained in Vimtutor, but let’s quickly go through it right now. To search for a given word just go into normal mode and insert “/” followed by the word you wish to search for. For example “/medium” will search for all instances of “medium” in your text. You can then use “p” and “n” for the previous and next results. “:noh” will reset the search.
Spell Checking
Spell checking is also available on Vim and it is quite easy to use. Vim is set to en_us by default, so this is be the language it will check for if you don’t change it.You can use “:h spell” on normal mode to know more about spell checking. To start spell checking, just hop into normal mode and type “:set spell”. “:set nospell” will turn it off.
Thesaurus
Another very useful function available on Vim is thesaurus. Thesaurus provides a way to define a file of alternate words. Like a synonym file. To allow thesaurus on Vim we have to go through 3 easy steps:
Just create a thesaurus.txt file and write the following inside:
important, valuable, substantial, significant
This file is providing synonyms to the word “important”.
Open you .vimrc file and write the following:
set+=thesaurus.txt
Type the word “important” and then <ctrl-x><ctrl-t>.
Summing up
These are just some of the writing oriented functionality that’s available out of the box on Vim. There are also a lot of plugins and customizations that can be done. Vim is an entire world to explore and each day you’ll learn something new while using it.
It is a great tool to have, even if you’re not someone who likes to try new and powerful things.
Thanks to Vim I’m writing faster and focusing on what’s important: my writing!
If this sounds like it could help you, give it a try, and if you need any help drop me a line, I will be more than happy to help.