5 Vim Plugins that Helped Me Switch From Sublime

A month ago, I wrote a post about how I finally learned Vim. I gave a couple of simple steps that were the central focus of how I was able to switch from Sublime Text to Vim.

While these steps were the primary reason I was able to learn Vim, Vim plugins were a close second. While I had wanted to switch to Vim for a long time, I knew there would be parts of Sublime that I would miss. Little did I know the extensive power of vim plugins.

With a bit of browsing, Google-ing, and reading other developers’ dotfiles, I found a couple of plugins that would replace (at least, temporarily) certain functionality that was available in Sublime but was missing from Vim’s core. These plugins helped me slowly make the transition over to using Vim exclusively.

Here are the 5 plugins that helped me the most.

#1 Vundle

Vundle List of Vim Plugins

My Current List of Plugins

Similar to Sublime’s Package Control, the Vundle plugin is just a plugin manager (a dream within a dream?) Like many package managers today, it is inspired by Ruby’s Bundler, which is part of the reason I gravitated to it, because I’m already familiar with the Bundler model. After installing it, adding a new plugin to Vim becomes as simple as adding one line to your .vimrc file and running “:PluginInstall”

There are many plugin managers for Vim out there as well. Check out Pathogen if you would like an alternative.

#2 ctrlp

One of my favorite parts of Sublime was the fuzzy file search capability that came out of the box. In Sublime, the command to open the search is “command+p” or “command+t”. I knew missing this finder would probably destroy me when switching to Vim. Luckily, there’s a Vim plugin which duplicates this functionality. The aptly named “ctrlp”.

Like all of Vim, the ctrlp plugin is highly customizable as well, which can allow you to change the plugin to your liking. For example, I changed the primary “ctrl+p” command to always flush the cache before opening the search so that it will index any new files that I’ve added. Also, you can configure it to ignore certain file types and directories (I’m looking at you ./tmp).

#3 NerdTree

nerdtree vim plugin

Ctrlp is great when you know the file(s) that you are looking for. But what if you don’t know the name of a file that you are looking for? In Sublime, you have the slide-out folder directory which will allow you to browse and navigate a project’s structure quickly.

NerdTree is a Vim plugin which will give you the same ability. Just a quick toggle (I’ve mapped it to Space + “ne”) and you can quickly open a “NerdTree” and navigate a project structure. Of course, you can do a lot more. This plugin is immensely useful when I can’t use ctrlp.

#4 tcomment_vim

I need to quickly iterate and try new ideas when I am developing. One of my tricks to do that is to comment out a line or block of code.

In Sublime, this is fairly straightforward. However, utilizing the excellent ‘tcomment’ plugin, commenting is even quicker. This plugin maps ‘gc’ to allow you to comment out large amounts of texts quickly. For example, if I want to comment out the next five lines of code, it’s simply ‘gc4j’. Like Sublime, it will also try to automatically recognize the language of the file and apply the proper commenting syntax.

#5 The Silver Searcher

There were many times during my Sublime days when I would need to lookup and piece of code in a project. In Sublime, I would open up the project-wide ‘find-all/search-and-replace’ menu and type in what I was looking for. Sublime was usually quick to respond with where it could be found in the project.

Unfortunately, Vim does not come with current directory/project-wide search functionality out of the box, but luckily, there’s a great alternative.

The silver searcher is a *nix command line utility for replacing the search abilities of an ack or grep. And it is ridiculously fast.

Ok, I know what you are thinking…wait this is a command utility, not a Vim plugin. Correct. But, luckily some vim faithfuls have created a couple of Vim plugins which will allow you to use the silver searcher from a command in Vim. So, you can search can search an entire project without leaving Vim.

I use ag.vim. The experience is not as smooth as the command line and sometimes I have to jump out of Vim to use the full power of the silver searcher, but nonetheless, it gives me at least a close replacement to Sublime’s find-all.

Honorable Mentions

I have a few more plugins that I utilize in Vim. Some I use more than others. However, none were quite as important to my transition to Vim as the ones above.

The one exception is vim-rails, which is a MUST have Vim plugin if you are a Rails developer. However, I decided not to list it, because the rest of the plugins are language-agnostic and all developers seeking to make the transition can use them.

Here’s a few others that I use:

Vim Plugins…Good or Bad?

I’ve heard the argument that some feel that Vim plugins are too much of a crutch or that customizing Vim beyond recognition hampers your ability to pair with other programmers. These are all valid points. But the goal I had set for myself was to just switch to using Vim full-time for my development, so I wasn’t concerned with pairing or that I was using plugins as a crutch. I knew I had to learn to crawl before I could run.

  • Fred

    Thanks for posting this. I’ll have to give Silver Searcher a try. I currently use Ack to do this.

    • @disqus_UUJ3jNSTyA:disqus No problem. If I have the choice, I’m reaching for silver searcher, mostly because I’m more familiar with it now than Ack (plus, the speed), but I’ll break out Ack every once in a while.

  • Arturo Volpe

    Check http://vim.wikia.com/wiki/Find_in_files_within_Vim, it is a buildin and works great.

    Also if you use Git, check `:Ggrep` from fugitive

  • Trevor

    The reason I stick with sublime instead of vim/emacs, is because I’m already using my mouse. If you’re programming something, you are most likely googling and going to different websites every 5 minutes. You’re probably clicking around as you test your application and as read though documentation. So unless you navigate everywhere on your machine with a keyboard, it just doesn’t make sense to throw away sublime for a terminal version of the exact same features that are ultimately going to keep you less productive for a longer period of time. Not to mention how much time you are going to spend tinkering and tweaking all of your config files. Consider just turning on vintage mode in Sublime, and it will behave just like vim for you with the added benefit of you still having a mouse when you need it. I think there’s a delusion where everyone thinks to become a better programmer you need to take a step backward and use the oldest text editors ever written. Yes, you can get fast an efficient with them, but the same can be said about Sublime. I don’t think there is any way you can get a mini-map with vim. Vim is limited to the text, but sublime is limited to the pixel. I have the line numbers, code collapse arrows, git status symbols, and markers on a thin column- which would just not be possible- or looks as good in vim. I’m not sure how color capable terminals are, but sublime will provide me a very thin underline of a color that any RGB value represents. I’m not anti-terminal in anyway, but when it comes to an editor, a terminal ONLY makes sense for ssh’d machines and quick edits.

    Also, great blog post. Thanks for taking the time to write it. 🙂

    • I agree that learning a terminal editor is not a prerequisite for good programming. I know many great developers who use non-terminal based editors, so I certainly wouldn’t push the idea of learning Vim for that purpose. I decided to learn it because I was using it with tmux and was interested in using it for remote pair programming. Sublime is a great editor and I wouldn’t encourage anyone to switch just because they feel it’s necessary to be a great developer.

    • Josh Bodah

      For Firefox users, I highly recommend trying VimFx. It adds vim-motion-like movements that work for navigating most websites. I find this much easier and quicker than switching to my mouse

      • Good tip! I forgot browser add-ons/extensions. I use Vimium for Chrome, although admittedly, not as often as I should.

    • Yourkbibby

      I agree with some points you make, however some limitations you mention had to do with your lack of knowledge on the software.

      Browsing:https://chrome.google.com/webstore/detail/vimium/dbepggeogbaibhgnhhndojpepiihcmeb?hl=en
      Git: https://github.com/airblade/vim-gitgutter
      Minimap: https://github.com/severin-lemaignan/vim-minimap
      Color Schemes: https://github.com/flazz/vim-colorschemes

      “Consider just turning on vintage mode in Sublime, and it will behave just like vim” – oh but how wrong this statement is. Do a search about it to find out more about how that is not true.

      Don’t be afraid on trying something new or doing some research before stating things that are not completely true. I do have a mouse but using Vimium on Chrome saves me time by pressing “f” then the shorcut for the item I want to click through. Also, if you have to be on googling different things every five minutes I think there is a bigger issue to investigate here. Granted there will be times when you have to google around but if every 5 minutes you are in google 8 hours a day there is something wrong with your approach on your programming technique.

      I am not telling you to leave Sublime behind, I am just encouraging you to try VIM and see that maybe it is not such archaic or makes you as unproductive as you think.

      Check this thread out, for those who think that VIM is too old to be usedon 2015: https://www.reddit.com/r/PHP/comments/2rl9cn/is_it_acceptable_to_still_use_vim_in_2015/

  • evanplaice

    Why not just use vintage mode in sublime?

  • I’m using those plugin. it’s already on my vimrc. nice article

  • still_dreaming_1

    I don’t understand why you want to customize Vim. I TOTALLY agree with the idea that you should never use plugins or customize Vim at all. You should also never buy a car because then it will become a crutch and you won’t want to walk anymore. Don’t ever order food or let anyone else cook for you because this is a crutch, and you won’t know how to make anything for yourself ever again.

    I ESPECIALLY agree with the idea that you should use a vanilla Vim to aid with pairing. You should also only buy (no wait, make) the largest clothes you can imagine because then no matter who needs to borrow them they will be capable of putting them on. Come to think of it, you should only use the most basic Notepad editor because then everyone will be able to pair with you just fine. You wouldn’t want your partner to have to go into insert mode before they can enter code and move around with arrow keys. If you had to use a different editor than Vim while pairing you might forget one of the mappings you recently added to your .vimrc and this might cost you that programming contest coming up. Man, they were going to put your username on the front page and everything! You wouldn’t want to have to create an alias to start Vim with a more neutral configuration. I mean, what if they remove that feature later on? Uh, uh, no crutches for me!

  • still_dreaming_1

    Tip: fzf is much faster than ctrlp and sorts the results much more intelligently.

    • dimko_desu

      Does fzf have windows support? No? Not interesting.

      • still_dreaming_1

        Just one more reason to stop using Windows 😉

  • Madhur Khandelwal

    Thanks for the article. It would be great to have an article listing all the awesome features of sublime and their corresponding implementation in vim using plugins 😉

  • Kuba ‘owca’ Siemiatkowski

    Any chances you can share your .vimrc ?

  • Donald Miles

    Excellent article. I will try some of these plugins and implement some of the tips and tricks i found on the Rosehosting blog about vim.

  • You should share your .vimrc and .vim folder 😀