Using Vintage Mode in Sublime Text – The Skinny

Vintage Mode

The best coders I know use Vim and the reason is they’ve learned to do everything with just their keyboard. If you never use your mouse, you quickly learn that typing and getting stuff done gets easier and faster.

You have the option of using Vim mode in Sublime (called Vintage Mode). While it doesn’t have all the bells and whistles of Vim, it has enough to make you dangerous. If you want to see all the possibilities out there, check out this link.

I use vintage mode in Sublime Text everytime I use Sublime Text. In order to use this properly, you need to follow several steps and learn several keyboard shortcuts. Here are the steps and the keyboard shortcuts.

Open the User Preferences file and remove Vintage from the ignored files.

Open Preferences File

Preferences > Settings - User

Change this:

{
    "ignored_packages":
    [
        "Vintage"
    ]
}

To this:

note: By default Vim mode is turn off, so you are turning it on by making sure it is not ignored.

{
    "ignored_packages":
    []
}

Enter Vim Mode with keyboard shortcut

I like to add a keyboard shortcut to quickly enter Vintage Mode. There is an option to jump right into Vintage Mode when you open Sublime Text but I’m not a fan of that. With the following key binding implemented, I can quickly jump into Vintage mode by just typing the j + j key binding keyboard shortcut. Here’s how you set this up.

Sublime Text 3 > Preferences > Key BindingsUser

Add this code:


{ "keys": ["j", "j"], "command": "exit_insert_mode", "context": [ { "key": "setting.command_mode", "operand": false }, { "key": "setting.is_widget", "operand": false } ] }

Useful Vintage Commands

Vintage includes most basic actions:

Key Function
Escape Key Gets out of the current mode into the command mode (All keys are bound of commands)
i Insert mode for inserting text (Keys behave as expected)
d delete
y copy
gu lower case
gU upper case
g~ swap case
g? rot13
< unindent
> indent
h left
j down
k up
l right
b move backward one word (previous alphanumeric word)
B move backward one word (delimited by a white space)
5b move backwards 5 words
w move forward one word (next alphanumeric word)
W move forward one word (delimited by a white space)
5w move forward 5 words
G move to the end of the file
gg move to the beginning of the file
0 move cursor to beginning of line
$ move cursor to end of line
a Insert text after the cursor
A Insert text at the end of the line
i Insert text before cursor
o Begin a new line below the cursor
O Begin a new line above the cursor
{ Jump to previous paragraph
} Jump to next paragraph
dd delete line
3dd delete three lines
dgg delete to beginning of file
d) + return delete to end of sentence
dG delete to end of file
x delete charcter
dw delete word
d0 delete to the beginning of a line
d$ delete to end of the line
d delete word
c change
y yank
> shift right
> shift left
~ switch case
dit delete inner tag
di’ delete inside single quote
v enter visual mode (must be in command mode first)
V enter line in visual mode (must be in command mode first)
/search_text search document for search_text going forward
?search_text search document for search_text going backward
n move to the next instance of the result from the search
N move to the previous instance of the result
u undo last operation
ctrl + r redo the last undo
yy copy current line into storage buffer
p paste storage buffer after current line
P paste storage buffer before current line
r{text} Replace the character under the cursor with {text}
R Replace characters instead of inserting them
^ moves the cursor to the first non-empty character of the line

Keyboard key repeat

When working with Sublime Text 3 you must make this change or you won’t be able to uses VIM mode without going insane. So if you are moving around the document with your keyboard you’ll want to hold a key down and keep moving up or down your document. By defaut on Macs you’ll have to press your keyboard key every time you want to move. The following command will enable you to just hold the key down and it will keep moving the way you want. You would think this setting would be on by default but it’s not. So make life better and make the following change using your Terminal.

Add this in the terminal

$ defaults write com.sublimetext.3 ApplePressAndHoldEnabled -bool false

Leave a Reply

Your email address will not be published. Required fields are marked *