You're reading from Mastering Sublime Text
Vintage Mode is a package that gives Sublime the editing features of vi. It allows us to use vi's commands while also having the advantage of Sublime's features, such as multiple selections that we learned before. Vintage Mode is an open source project and can be found at http://github.com/sublimehq/Vintage.
vi is a an old but still very popular text editor. vi was originally created for Unix operating systems. The original vi was written in 1976 as an open source project. Surprisingly, it's still being used today because of its speed, small size, and portability. It is a popular command line editor (for example, in server environments) because it does not require a mouse.
Many different vi ports have been developed since its original release. One of the most popular of them is vim (vi improved), which supports customization like Sublime does, with macros, plugins, and key mappings.
The following is a screenshot of a spilt-windowed vi screen, which is...
Vintage Mode is installed by default but is also disabled by default via the ignored_packages
settings that is set in User Preferences. To enable the Vintage Mode, we'll need to remove it from the ignore packages list. To do this, let's open the user settings by going to Preferences | Settings–User. The following code is present in the user settings:
"ignored_packages": [ "Vintage" ]
We will change the preceding code to the following one:
"ignored_packages": []
We have just enabled Vintage Mode! We should see INSERT MODE at the status bar. Insert Mode is the mode where we can type freely.
In this section, we are going to cover some vi commands, basic interactions, and usage of the Vintage Mode. If you have used vi before, you can skip this section.
Vintage Mode will start in INSERT MODE by default instead of COMMAND MODE; to change this behavior, we'll need to open up user settings again by going to Preferences | Settings–User and then adding the following code:
"vintage_start_in_command_mode": true
Don't worry if you are still confused about Insert Mode and Command Mode by the end of this chapter, you will understand it all.
Vintage has four supported modes that can be switched between:
Mode |
Description |
Key |
---|---|---|
Command Mode |
Waits for the user to enter a command |
Esc |
Insert Mode |
Text can be inserted in different positions |
i/I/a/A |
Visual Mode |
Select/highlight the text using the Movement Commands |
V |
Visual Line Mode |
Select/highlight lines of text using the arrow keys |
Shift + V |
Sublime's default Vintage Mode is a little outdated as well as VintageEx Mode, which is only supported by Sublime Text 2, not 3. That's why Guillermo (@guillermooo
) created its own Vintage package for Sublime Text 3, which emulates vi/vim more closely than the normal Vintage Mode.
Vintageous can be downloaded using Package Control, but we must first disable the default Sublime's Vintage Mode so Vintageous can take over.
We do this by adding back "Vintage"
to "ignored_packages"
; don't worry, all we learned about Vintage Mode still applies for Vintageous.
In this chapter, we have discovered what vi/vim is and the fact that we can use it freely with all the shortcuts we mastered. It is important to know that vi functionality is huge and never-ending; hence, it can't be covered in one chapter and needs a whole book for it. We covered the basics.
I recommend having the vi graphical cheat sheet that can be found at http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html. Keeping a copy under your keyboard can be really helpful.
The next chapter will guide us on how to use Sublime for testing with several languages such as PHP and Ruby.