Reader small image

You're reading from  Mastering Sublime Text

Product typeBook
Published inDec 2013
PublisherPackt
ISBN-139781849698429
Edition1st Edition
Right arrow
Author (1)
Dan Peleg
Dan Peleg
author image
Dan Peleg

Dan Peleg is an accomplished software engineer. As a former developer in the Israeli Intelligence Force, he holds extensive experience in both defense and robotic industries, and has previously lectured at DefCon conventions. Dan has developed unique algorithms for robotic platforms, specializes in a variety of software platforms, and currently works as the CTO for an American startup company.
Read more about Dan Peleg

Right arrow

Chapter 5. Unravelling Vintage Mode

This chapter is for the vi fans among us. In this chapter, we will cover the following topics:

  • Understanding Vintage Mode

  • Setting up Vintage Mode

  • Experiencing Vintage Mode

  • Knowing about Vintageous

Understanding Vintage Mode


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.

Discovering vi

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...

Setting up Vintage Mode


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.

Experiencing Vintage Mode features


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 editing modes

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

Vintage Mode commands

Vintage Mode...

Knowing about Vintageous


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.

Tip

For full information, visit the following link:

https://github.com/guillermooo/Vintageous

Summary


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.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Mastering Sublime Text
Published in: Dec 2013Publisher: PacktISBN-13: 9781849698429
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Dan Peleg

Dan Peleg is an accomplished software engineer. As a former developer in the Israeli Intelligence Force, he holds extensive experience in both defense and robotic industries, and has previously lectured at DefCon conventions. Dan has developed unique algorithms for robotic platforms, specializes in a variety of software platforms, and currently works as the CTO for an American startup company.
Read more about Dan Peleg