If you’re a programmer who writes lots of code then it’s important to learn about your Editor.

Nowadays may be some of you are using editors like Sublime, Atom, Rubymine…etc but very few knows about the Vim.

Why vim?

Developers could be lazy and very clever at the same time. We’re able to customize our environment to make it work in a way we want it to work. We spend a lot of time in thinking about how to optimize these tasks because we don’t want to repeat ourselves over and over again. We try to make things with less efforts to get as much things as possible done. We want to be productive.

We can get this when we start to use vim. To get install vim on your Linux machine just type below command in your Terminal:

$ sudo apt-get update
$ sudo apt-get install vim

After that just type vim and here you go.

VIM has several extension managers, but the one we strongly recommend is Vundle. It makes installing and updating packages trivial.

Let’s get Vundle installed:

$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

This command downloads the Vundle plugin manager and chucks it in your VIM bundles directory. Now you can manage all your extensions from the. vimrc configuration file.

Now make. vimrc configuration file from below command to your home directory:

$ cd $HOME
$ vim. vimrc

Now set up Vundle in your. vimrc by adding the following to the top of the file:

That’s it. You’re now all set to use Vundle. Afterwards you can add the plugins you want to install, then fire up VIM and run:

:PluginInstall

Using Vim as a Complete Ruby on Rails IDE

I couldn’t possibly list all the VIM features, but let’s take a look at a quick list of some of the powerful out-of-the-box features perfect for Rails development.

Ditch the Mouse

Probably the MOST important feature of VIM is that it doesn’t require a mouse (except for the graphical variants of VIM). At first this may seem like a horrible idea, but after you invest the time – and it does take time – to learn the key combinations, you will speed up your overall workflow!

Now install plug-in for rails and for that Just add the following line inside thecall vundle#begin() and call vundle#end() block:

Plugin 'tpope/vim-rails'

After this type :PluginInstall in vim and restart vim. Rails.vim will be ready to use.

Here are some cool stuff that you can use for rapid development.

Split Layouts

Open a file with :sv <filename> and you split the layout vertically (e.g., the new file opens below the current file) or reverse the keys to :vs <filename> and you get a horizontal split (e.g., the new file opens to the right of your current file)

slipt layout

The same way you can split the view horizontally.

Git Integration

Want to perform basic git commands without leaving the comfort of VIM? Then vim-fugitive is the way to go:

Plugin 'tpope/vim-fugitive'

By installing this plug-in you can perform all your Git operations with it. See below(Just one example):

git integration

Ruby Refactoring

Refactoring tool for Ruby in vim! To get this plugin add below to .vimrc file:

Plugin 'ecomba/vim-ruby-refactoring'

Call :PluginInstall and restart Vim.

There are lots of other extensions like

  • Plugin ‘thoughtbot/vim-rspec’
  • Plugin ‘garbas/vim-snipmate’
  • Plugin ‘Xuyuanp/nerdtree-git-plugin’

Vim is highly customizable. You can customize vim as per your need.

That’s more or less it (for Ruby on Rails development, at least). There are a ton of other extensions that you can use, as well as alternatives to everything detailed in this post. What are some of your favorite extensions? How have you configured VIM to match your personality?

Learning Resources

  1. VIM Tutor comes with VIM, so once VIM is install just type vimtutor from the command line and the program will teach you how to use VIM by, well, using VIM.
  2. VIMcasts are advanced tutorial videos describing how to use many of VIM’s features.
  3. Official VIM docs
  4. Open Vim

Do you, or do you know anybody who may benefit from our software development prowess!

Click here for more details…


At BoTree Technologies, we build enterprise applications with our RoR team of 25+ engineers.

We also specialize in RPA, AI, Python, Django, JavaScript and ReactJS.

Consulting is free – let us help you grow!


References

Effective Rails Development with Vim
If you are new to Vim, be sure to read my introduction as it will help prepare you for this article. Here, I am… www.sitepoint.com