Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying learn the keybindings of vim one by one. I thing that I thought I should get good at early is to find a string of text and replace them with something else.

I had successfully done this on E-TextEditor on Windows where I will key in v/something/\rsomethingelse

for the desired effect.

but I find that isn't the case in the commmand mode in SublimeText 2. What happens in ST2 is that once I am in command mode, I press v which puts the editor in visual mode, then if I key in /, it enters search, then I key in the word "something", if I press "/", it will be part of the search query instead of ending the regexp, okay, I thought, then i press return to see if an instance of something gets selected, but it doesn't, nor does esc or any other key I can think of. Note that the instances of "something" do get found but just not selected for further operations.

Does this feature not exist in SublimeText2 or am I missing something?

share|improve this question
Could you give an example of a "string of text" ... that is an awfully wide term, considering. – Rook Nov 5 '11 at 2:45
@Idigas for example: say if I want to change the string inside the print function print('awfullyWide') to print('notReally') – Nik So Nov 5 '11 at 8:04
up vote 7 down vote accepted

Nik, either you learn Vim or you learn Sublime Text 2.

ST2's vintage mode is at best a good approximation of Vim's most basic features within the constraints of Sublime Text.

For example, it doesn't have the same command line and thus doesn't provide Vim's awesome search/replace feature.

For that you must use ST2's own search/replace mechanism accessible by typing Ctrl+h.

When you type / in "command mode" you have the search bar showing at the bottom of the window. Since it's ST2's own search bar (also accessible via Ctrl+f) it doesn't work at all like the replace bar. Much less like Vim's command line.

The list of vintage mode/vim similarities is a thousands time shorter than the list of their differences so I suggest you pause and think about what you actually want to do:

a) learn how to use Sublime Text 2 which is a very fine text editor


b) learn how to use Vim which is one of the two best text editors out there (how diplomatic I am).

If you choose a) you don't need to activate the vintage mode at all since most of its features are 1/1 mappings to ST2's own features. Stop looking at Vim articles, instead invest your time in learning how ST2 works and how to make the best out of it.

If you choose b) the first step must be to do the vim tutorial accessible via type vimtutor and follow along. Once you have done vimtutor (maybe a couple of times) you can download a recent build of MacVim and start applying your newfound knowledge.

Not making this choice won't lead you anywhere because most of what you will find about Vim won't work in ST2 and what works there is a tiny little fraction of what makes Vim so amazing.

In the end, your choice is irrelevant. What counts is that you make it and focus.

share|improve this answer
THANKS! You're going to find his dumb: There's a vimtutor thing?!?! -- Yeah I heard of the MacVim from Peepcode's video ( in fact, for some reason, I have this feeling that there are many flavors of vim ever so slightly different from each other in existence) --- You couldn't be more right about the focus and texteditor getting out of one's way thing. One small reason that's very specific to me, I think , to use vim, is so that I can be keyboard agnostic,having just moved to mac, I can't live with that keyboard so I thought if from now on I can edit with just a-z0-9 and occasional ctrl. – Nik So Nov 5 '11 at 18:24
Actually there is only one flavor of Vim. It can be compiled with or without a huge number of options and have a lot of exotic settings but you still get Vim. MacVim is just Vim wrapped in a nice native Mac OS X GUI. If you really are enthusiastic for Vim you should drop ST2 and dive into Vim without wasting time and energy juggling with editors. – romainl Nov 5 '11 at 19:52

Nik, although I'm certain your intentions are best, I must say I agree (for the most part) with @romaini on this.

Vim and Sublime Text 2 (ST2) are, although trying to be similar (well, one trying more than the other) two different editors. I have not used ST2 much, but Vim I've used quite a bit, and it excels at this kind of thing, so it is well worth learning. It could take some, yes, but as time goes along and you learn "new tricks" things start to be "logical" more and more.

Vim's "power" comes from several things; mappings, operator/movement combinations and regular expressions.

For example, if we take your string:


You're at the beginning of the first line, and you wish to replace the content within the apostrophes. By typing ci' which stands for change inside apostrophe (change is the operator, inside ' is the movement (text) upon which the operator will be executed, you will get print('') after which you can replace the text inside.

Vim's way of working in this manner is best thought of if you ask yourself "What do I wish to accomplish with some particular piece of text?". Then it starts making sense.

Of course, if you wish to do so in one go :%s/AwfullyWide/NotReally a simple substitution will accomplish the same result. Of course, regexes have much more potential than this simple substitution.

share|improve this answer
thanks a million!I thought something might be fishy about the ST2's command mode. Here's why, I actually took the heart to say eff it on windows and switched and thought vim or death. and I bought the peepcode and one other book on it awhile back, and I vaguely remember some commands learned from peepcode's video being different than what's offered but I thought it was just my memory corrupted or something.. now I know for sure. Well that sucks, cuz I kind of like SublimeText's snippets and stuff. I thought, that's VIM with an attractive interface. Thanks though, for such thorough explanation! – Nik So Nov 5 '11 at 18:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.