Reader small image

You're reading from  Mastering Vim

Product typeBook
Published inNov 2018
PublisherPackt
ISBN-139781789341096
Edition1st Edition
Tools
Right arrow
Author (1)
Ruslan Osipov
Ruslan Osipov
author image
Ruslan Osipov

Ruslan Osipov is a software engineer at Google, an avid traveler, and a part-time blogger. He is a self-taught engineer. He started publishing personal Vim notes in 2012, and became increasingly interested in the intricacies of the editor and its applications in optimizing development workflows.
Read more about Ruslan Osipov

Right arrow

Making Vim Your Own

This chapter will cover Vim customization, and how to make Vim work for you. Everyone's needs are different, and this chapter tries to help you develop your own style.

This chapter will cover the following topics:

  • Color schemes and making your Vim look pretty
  • Enhancing the status line with additional information
  • GUI configuration specific to gVim
  • Healthy habits when customizing your workflow
  • Methodologies for organizing your .vimrc

Technical requirements

In this chapter, we will be covering ways to keep your .vimrc file organized. There's no supporting code – you're welcome to bring along your .vimrc file and try out the techniques suggested in this chapter.

In addition, we'll be installing some packages with pip, so you may want to make sure you have pip installed. You can install pip by running:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py.

Playing with the Vim UI

Vim has extensible UI, and it doesn't always have to look like it's stuck in the 90s. You can change its themes, tweak the way certain UI elements are displayed, and enhance the information displayed in a status line. If you're a gVim user, there are even more customization options available to you!

Color schemes

Vim has a plethora of beautiful color schemes available, both packaged with Vim and made by community members.

You can change the color scheme by changing the colorscheme setting in your .vimrc, as follows:

:colorscheme elflord

To get a list of currently installed color schemes, execute :colorscheme Ctrl + d. This will list every installed color scheme:

In the preceding example...

Keeping track of configuration files

Chances are, you won't spend the next ten years using the same computer. It's also possible you have multiple machines you work acrossso you should probably find a way to synchronize your configuration files across multiple environments.

As usual, there's no single right way to do this, but a common practice is to store files in a Git repository (often called dotfiles, since configuration files in Linux tend to start with a dot), and pointing symlinks from the files in the home directory to the files in the dotfiles directory. All you'll have to do is commit, push, and pull the configuration with Git on each machine to stay up to date.

The easiest way would probably be to create a repository using a service such as GitHub, and utilize it to synchronize your configuration. Just don't store any sensitive information...

Healthy Vim customization habits

As you continue to work with Vim, you will find yourself making a lot of configuration changes. It's important to take time to go back, reflect, and make sure your .vimrc doesn't become a pile of unneeded aliases, functions, and plugins.

Once in a while, take the time to go back into your .vimrc and clean up unnecessary functions and plugins, or remove key bindings you don't use any more. If you don't know what something does, you're probably better off deleting it, since you won't get much use out of configurations you don't understand.

It's also helpful to take some time to read about the options you have set and plugins you have installed with the built-in :help command—you'll never know what useful feature you'll discover!

...

Summary

In this chapter, we've covered ways to enhance Vim's user interface and personalize Vim.

We've looked at color schemes, ways to configure them, finding them, and browsing them. We've also looked at ways to enhance Vim's status line with a heavyweight Powerline or a lightweight Airline plugin.

We've looked at GUI configuration specific to gVim, and how to customize the way gVim looks.

Finally, as you use Vim more, you'll develop your own style and personal workflow. This workflow is best enhanced by bindings and shortcuts. As your .vimrc grows, there are a number of ways to get it organized, well documented, and easy to navigate.

In the next chapter we'll learn Vimscript, an extensive scripting language which comes packaged with Vim.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Vim
Published in: Nov 2018Publisher: PacktISBN-13: 9781789341096
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Ruslan Osipov

Ruslan Osipov is a software engineer at Google, an avid traveler, and a part-time blogger. He is a self-taught engineer. He started publishing personal Vim notes in 2012, and became increasingly interested in the intricacies of the editor and its applications in optimizing development workflows.
Read more about Ruslan Osipov