Tips on how to Make Vim Look Good: 5 Vim Customization Suggestions

Text editors, while maybe not the sexiest topic on the planet, really matter. One of the most powerful text editors and therefore one of the most popular is Vim (short for "Vi Improved").

While Vim has a steep learning curve and can intimidate new users, developers love it. That's because you can use Vim to make programming more productive. Plus, it's very easy to apply various Vim customizations that completely change the look and feel. This is done by editing the Vim configuration file, also known as "Point file".

The power of the dot file

The Dotfile is incredibly powerful and can control almost every part of the Vim experience. Editing yours is really easy. First, you need to check that you actually have one. You can do this by running:

Cat ~ / .vimrc

If there is nothing you just have to create it with the touch command:

Touch ~ / .vimrc

You are now ready to begin your Vim customization. To do this, you need to open it in your favorite text editor. This can be Vim or Nano or even Gedit. Only as long as it is a plain text editor.

The Vim points file has its own embedded programming language called Vimscript. It's what Vim uses to customize the look and feel of its editor. But no worry. It's very easy to understand. Here are some useful configurations you can add to your Dotfile.

1. Process collection automatically

Writing clean and reliable code is essential for open source developers. Indentation is critical to maintaining a large code base over time. It is best to avoid soft tabs entirely, as they are interpreted differently by different text editors.

Fortunately, with a few lines of Vimscript, you can convert any tab to a predefined number of spaces. Just add the following to your Vim points file.

set expandtab
set tabstop = 4
set soft tab stop = 4
set shiftwidth = 4

Python users should use four spaces as recommended by the PEP-8 standard. It is best to either read the appropriate style guide or use your best judgment for other languages.

You can also set it to auto-indent if you need to. Again, add the following lines of code to your points file. The second line of code ensures that no line can be longer than 80 characters.

set automatic feed set
set textwidth = 80

2. Turn Vim into a distraction-free word processor

While Vim is a brilliant text editor for developers, it's also great for those who want a simplified, customizable, yet distraction-free writing environment.

With just a few lines of code, you can customize vim to switch to a "word processing mode" when needed. This changes the text formatting and introduces things like spell checking.

First, create a function called WordProcessor modeand paste the following lines of code.

Wireless! WordProcessorMode ()
setlocal textwidth = 80
setlocal smartindent
setlocal spell Spelllang = en_us
setlocal noexpandtab

Then you need to define how to activate it. You can use the following line of code to create a command. In command mode when you call WP, the word processing mode is activated.

com! WP call WordProcessorMode ()

To test if it works, open a new text file in Vim and press the Escape Key. Then enter WP, and hit Enter. Enter more text, with some words intentionally misspelled. If Vim marks them as incorrect, then you know you configured them correctly.

3. Install the Vundle Package Manager

Vundle is a package manager for Vim that is not too dissimilar to the Ubuntu package manager. It allows you to extend the functionality of Vim by installing third party packages. Many of them are aimed at programmers; others are more general productivity tools.

Vundle is easy to install. First, you need to install the Git version control system. If you don't already have it, install it. Ubuntu or Debian users can use the following command:

sudo apt-get install git

Then clone the Vundle repository to your local computer. It's easier than it sounds. Just run the following command and remember that it is case sensitive.

git clone ~ / .vim / bundle / Vundle.vim

Related: How to Clone a Git Repository Using Git Bash

Then add the following lines to your Vim points file.

set incompatible
File type
set rtp + = ~ / .vim / bundle / Vundle.vim
call vundle # begin ()
Plugin & # 39; VundleVim / Vundle.vim & # 39;
Plugin & # 39; L9 & # 39;
call vundle # end ()
Indentation of the file type plugin

Between vundle # begin () and vundle # end () This is where you add the packages you want to install. The only one required is VundleVim / Vundle.vim, but we also chose to install it L9 to demonstrate how to install third-party packages.

Once you've added these lines to your Vim configuration file, there is something else you need to do. Exit your Vim points file and open a new text document. In command mode, enter:

: PluginInstall

If everything works as expected, it looks a bit like this.

4. Change the appearance of Vim

Many text editors (like iA Writer) allow you to switch between a darker night mode and a day mode. Vim is no exception.

To change the color scheme just add Color scheme to your point file, with the theme you want to use.

Color scheme dark blue

The dark blue design suggested by Wyatt Andersen on Twitter is a great design. Of course, there are a dozen others to choose from.

@matthewhughes 3 favorite lines:
Color scheme dark blue
au InsertLeave * color scheme dark blue
au InsertEnter * colorscheme molokai

– Wyatt Andersen (@ wandersen02) October 20, 2015

To see if it worked, open Vim again and visually confirm.

5. Slap on something SPF13

If you don't feel confident enough about changing the Vim point file, there is an easier way. SPF13 is a distribution from Vim that comes pre-built with the plug-ins and dotfile modifications you need as a productive developer.

Installation on Linux, FreeBSD, and OS X is remarkably easy. Just open up a terminal and do the following:

curl -L -o – | Sch

Once you're done, you'll have a turbo-charged Vim installation. If you are a Windows user, see the instructions on the SPF13 website.

However, using SPF13 does not prevent you from configuring Vim the way you want. Just edit the point file as needed. If you want to know how to make Vim look its best without configuring it yourself, this is for you.

Mistakes happen!

Note that if you make a mistake in your Vim points file, Vim will notify you with some helpful troubleshooting messages.

If you're struggling to understand them, you can turn to StackOverflow and the Vim subreddit for help.

Vim customization tips for beginners

One of the great things about Vim is that you can configure it to your heart's content. You can change how it looks and works by adding additional Vim customizations.

However, if all you are interested in is how to make Vim look good, don't despair. The customizations in this guide can completely change the way Vim feels on your computer.

As mentioned above, getting used to Vim is not easy. To speed up this learning process, it can be helpful to have a Vim cheat sheet handy.

Cheat Sheet: The Vim Linux Command Line Editor Cheat Sheet

Keep this Vim cheat sheet handy to learn or relearn useful Vim commands.

Continue reading

About the author

Matthew Hughes
(386 published articles)

Matthew Hughes is a software developer and writer based in Liverpool, England. Seldom found without a cup of strong black coffee in hand, he absolutely loves his MacBook Pro and camera.
You can read his blog at and follow him on Twitter at @matthewhughes.

By Matthew Hughes

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

One more step …!

Please confirm your email address in the email we just sent you.

Leave a Reply

Your email address will not be published. Required fields are marked *