Using Sublime like Vim

As my friends know me, I like playing with new environments, new tools to make my work easier and faster. I learnt dvorak to type fast, changed to Macintosh to have less problem with my environment and tried many editors to make programming faster. Currently I use Textmate and Sublime Editor at home and Eclipse at the company, but I miss splited window and command run from Textmate and I don’t want to use 500mb memory in Eclipse just to edit some files in a project. I really like Sublime editor, however sometimes I need quicker shortcuts for commands, like remove more lines, searching for words under the cursor, so on…

This weekend I decided to learn Vim again, as I did so many times before. Vim is a really powerful editor for programmers and for whom doesn’t like to use mouse during writing code. My goal was to forget the mouse in programming and make my work faster, as fast as the thoughts pop up in my head.

I started vimtutor tool to lead me in learning and after a few lessons I could delete more lines with just a few pressed buttons, change letters easily, replace texts like in sed, create marks and jump there later. I started to feel the power of Vi. I turned off the arrow keys to use hjkl instead, since an advanced Vim user doesn’t use buttons on the right side of the enter key. I love playing with color schemas, so I spent more hours to tune my editor and tried my good friend’s, Athos’s vimrc file too. It seemed the Vi is not as hard as I knew before, and I thought using macVim will be perfect for me in the future.

I thought wrong. I opened one of my Rails project to play with it. After using Eclipse’s or Textmate’s quick opener (ctrl-shift-r or cmd-t), Vim got me back to ancient ages. I got nervous after a few file open methods, because I needed to write the whole path of the file. Good case, when I know the full path, but sometimes I don’t know the exact path and then my editor helps me to choose, Vim doesn’t. I was so sad, and felt Vim is not my tool. I have an editor with really good features, but very necessary tools are missing. I found NerdTree, but it isn’t so comfortable either, or PeepOpen that works only on OSX. I like using cmd-1 to jump the first tab, in MacVim I didn’t find solution for this (nor vim in terminal)

I was so sad. I went back to Sublime and started to repeat the Vim lesson’s steps. Remove lines, rewrite characters, delete words. I needed much time to do the same than in Vim. Removing five lines needs shift-down + down + down + down + down + del, while in Vim it’s only pressing 5dd.

I found something in my Sublime configuration file that I really forgot. This is the Vintage mode. First when I started to use Sublime, we weren’t in good with Vim, so I didn’t care for Vim mode. This was the time to be good friend with Vintage, so I removed it from my ignore_packages list and started to use.

I guess Vintage is a really cool extension! I have normal, insert and visual modes. I open a file and I’m in normal mode first. Pressing i switches to insert mode. Moving with hjkl works, so i don’t need to stick out to cursor keys. 5dd works to. % jumps to the pair of the bracket, cmd-b is page up, cmd-f is page down. I have registers, so dd stores the deleted lines and I can paste it later with p. One of my favourite thing is the marks. I have bookmark in Sublime, but I like the way in Vim, pressing m+[a-z] and '+[a-z] to restore.. Unfortunatly the global marks don’t work, but I hope there will be some solution later. I can use :w for saving, :e PATH to open file, but I guess cmd-s and cmd-o is comfortable as well.

The best thing is I have quick file opener in Sublime with cmd-p, moreover I can manage and use a lot of package with cmd-shift-p. For instance if I want to change the file type to rspec, I just press cmd-shift-p, typing rspec and press enter. That’s all folks!

I installed SublimeBlockCursor (I suggest you to use Package Control to install BlockCursor) package and I have block cursor in normal and line cursor in insert mode, changed the default theme to Soda Light and installed the Github color schema for Textmate (Sublime can use Textmate color schemas and bundles).

I just suggest you to try Sublime out with Vintage mode. However Sublime license is 50$ per user, I think it’s worth. If you need any help, just write me on twitter or check my configuration on Github (