How-To: Vim Functionality with Sublime Looks

Alek Shnayder
May 1, 2017 · 4 min read
Image for post
Image for post
Vim after customizations running in iTerm2 (top), Sublime Text 3 (bottom)

Just because you’re using a command line editor does not mean you should have to do a time warp back to the days of green screen CRTs. This guide will walk through the process of setting up Vim to achieve a more Sublime-like experience. The target audience for this is a non-Vim user that finds him or herself having to hop into a CLI editor from time to time, and is looking for something a bit more familiar aesthetically.

“Will this make me even faster at Vim?” you may ask. Well, most likely not.

However, by giving yourself a consistent experience, going between editors will be less disorienting, allowing you to find your place within the same file quickly. Thus, going from your local GUI editor and then jumping into Vim for some quick server-side edits over SSH should be more seamless. As for the whole H,J,K,L home row navigation thing, you’re still on your own on that one.

Let’s see what we’ll be working with.

This is my rc file. There are many like it, but this one is mine. Without me, my rc file is useless. Without my rc file, I am useless.

The default syntax theme used by Sublime is Monokai. This theme is not included with Vim. Luckily, we can get pretty close using vim-monokai.

  1. Grab the vim-monokai theme from GitHub, available here.
  2. Inside the repo’s /colors folder you should see monokai.vim
  3. copy monokai.vim to ~/.vim/colors/

We will add monokai to our vim configuration in the Putting it All Together with .vimrc section.

pip is a command line package manager used for installing Python packages. This is similar to npm in the Node world, or gem in Ruby.

We are going to use pip to install the Powerline status bar. This will display what mode we are in (normal, insert, visual, etc.), the Git branch we are working off of, encoding, language, and other useful things.

To install it, open your terminal of choice, and enter the below command.

pip install --user powerline-status

A dotfile ending in rc designates a configuration file. Other examples of rc files would be .bashrc for Bash, .zshrc for Zsh, .psqlrc for Postgre and so on.

Your .vimrc should be located in your home directory.

As dotfiles are hidden, you will not be able to browse to it using Finder. Instead, you will need to open the file through a terminal by typing either vim ~/.vimrc or nano ~/.vimrc. To open it with Sublime Text you can use subl ~/.vimrc if you have the subl alias set up for it.

Update your .vimrc so it looks like the one below, lines 5 and 6 are optional.

An overview on what we’re doing here:

  • syntax on -Enable syntax highlighting based on the file format
  • colorscheme monokai -Use the Monokai theme we copied over earlier
  • set number -Show line number gutter on the left
  • set incsearch -[optional] Show matches while searching
  • set hlsearch -[optional] Search highlighting
  • lines 8 through 10 get us up and running with Powerline in Vim
  • set laststatus=2 -Keep our status bar visible and properly positioned

If you are finding that the Powerline status bar isn’t lining up properly, you may need to install one of the Powerline-specific patched fonts, available here. I’m fond of Meslo LG M Regular for Powerline.ttf myself.

Image for post
Image for post
Change Font found under Profiles -> [ default profile] ->Text for iTerm2

Once the font is installed, you will need to update your terminal’s default font under the preference menu.

Questions/Comments/Other? Drop me a line via LinkedIn or GitHub

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

Hacker Noon is how hackers start their afternoons. We’re a part of the @AMI family. We are now accepting submissions and happy to discuss advertising & sponsorship opportunities.

If you enjoyed this story, we recommend reading our latest tech stories and trending tech stories. Until next time, don’t take the realities of the world for granted!

Image for post
Image for post

HackerNoon.com

#BlackLivesMatter

By HackerNoon.com

how hackers start their afternoons. the real shit is on hackernoon.com. Take a look

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Alek Shnayder

Written by

https://alekshnayder.com

HackerNoon.com

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

Alek Shnayder

Written by

https://alekshnayder.com

HackerNoon.com

Elijah McClain, George Floyd, Eric Garner, Breonna Taylor, Ahmaud Arbery, Michael Brown, Oscar Grant, Atatiana Jefferson, Tamir Rice, Bettie Jones, Botham Jean

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