Make Sublime text 2 as VIM replacement

Sublime Text 2 is great text editor. No question about that. But If you are came from VIM world. you can tweak a little bit and make it as near perfect vim replacement.

1. Turn vintage mode

Sublime is shipped with package called ‘Vintage’, but it is disabled by default.

Image

Preference – Setting – DefaultImageSearch ‘ignored_packages’ and remove ‘vintage’ from [] and add “vintage_start_in command_mode” : true

Now you can use most of key binding of Vim, including cursor movement, deletion, visual mode selection, extra. But Ex-mode commands including search & replacement (%s/…/…/g) is still missing. In order to emulate Ex mode in sublime text, you should install another package called ‘VintageEx’.

2. Install Package Control and VintageEx

It is better to install ‘Package Control’, which enable to manage various packages available for Sublime text 2. To install Package Control, open console (Ctrl-`) and paste the following command in console line.

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Restart the sublime and using command pallette (shift+command+P) and select ‘install packages’

Select ‘VintageEx’

VintageEx Packages will be downloaded and installed. Restart Sublime Text and let’s press ‘:’ as we did in vi/vim.Now you can execute various Ex mode commands. For examples,

You can delete lines using regular expression

Search and Replacements

2 thoughts on “Make Sublime text 2 as VIM replacement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s