r/coding • • Oct 04 '13

Just use Sublime Text (instead of vim)

http://delvarworld.github.io/blog/2013/03/16/just-use-sublime-text/
43 Upvotes

254 comments sorted by

View all comments

Show parent comments

1

u/unknownmosquito Oct 05 '13

Not to mention you can just enable the mouse, even in console vim or Evil mode in emacs.

Task: I want to change the text inside the quotes of "This is a test" visible halfway down the screen.

Sublime: Click carefully before the T and drag to the end of test. Begin typing.

Vim/Evil Mode: Click quickly anywhere between the quotes. Type ci" and begin typing. Or jump there with f or /. Or use easymotion. Or use line numbers. You know, whatever's fastest. I guarantee you can do it faster in vim.

6

u/Tenobrus Oct 05 '13

Actually...

Sublime: Click quickly anywhere between the quotes. Press Shift+Ctrl+Space and begin typing.

1

u/rs-485 Oct 05 '13

What about brackets? You can do ci( in vim, how do you that in Sublime?

3

u/Tenobrus Oct 05 '13

Shift+Ctrl+Space is actually just "expand selection to context", so it will still work. Or Shift+Ctrl+D, which is specifically "expand to brackets".

1

u/rs-485 Oct 05 '13

It's funny, but I find it harder to memorize such key combinations in comparison to vim's operators. Those key combinations just seem rather arbitrarily chosen, while with ci", it's very clear what it does: Change Inner/Inside ".

8

u/mirhagk Oct 06 '13

It's actually pretty intuitive. Shift is for highlighting (like everywhere), ctrl is to select by a group (again like everywhere) and space is to select by context. Only the space you have to remember or learn. Vi is the only editor you have to learn in order to do anything. With most other editors you could browse a quick list of shortcuts after using it for about 1 month, you'd already know most of them just by guessing/it being the same for most programs, and the rest you could learn in 15 minutes.

3

u/Tenobrus Oct 05 '13

Ok. Each to his own.

1

u/[deleted] Oct 17 '13

Those key combinations just seem rather arbitrarily chosen

Why is delete a line DD. Why not DL?
Same with CC(Change line)
Why is $ end of line?

Sometimes things just are arbitrarily chosen. They have to pick SOMETHING, and that keyboard shortcut makes the most sense to the devs.

1

u/rs-485 Oct 18 '13

Why is delete a line DD. Why not DL? Same with CC(Change line)

I can't say what the reason behind picking that combination is, other than the fact that this function was naturally copied from vim's predecessor, vi. However, I think dd is far faster to type than dl, and the same goes for cc. It's also a "pattern" across various commands: dd deletes a single line, cc changes a single line, and yy copies a single line into register 0.

Also, mind those caps. "DD" is not the same as "dd". (And why would a decent text editor force you to press shift for that?)

Why is $ end of line?

I'm not sure, either, because vim and vi have been existing since ages and non-graphical systems were naturally far more common back then. However, a modern reasoning would be that regular expressions also use $ to symbolize the end of a line.

(According to Wikipedia, the dollar sign has been used since 40 years for this purpose, which consequently was why regular expressions used the dollar sign just in the same way.)

Sometimes things just are arbitrarily chosen. They have to pick SOMETHING, and that keyboard shortcut makes the most sense to the devs.

Yeah, they do. But I think we can also agree on this: Unlike new text editors like gedit or Sublime Text which have been developed essentially from ground up with modern computers and OSes in mind, vim and Emacs have a very, very long history.

Computing was different back then. That's also why vi and vim traditionally use "hjkl" instead of the arrow keys on reasonably modern keyboards - the arrow keys didn't exist on the terminal vi's creator used. Naturally, if you don't want to totally be pragmatic, you can freely use the arrow keys instead.

0

u/nairebis Oct 28 '13

the arrow keys didn't exist on the terminal vi's creator used.

I'm pretty sure they had arrow keys. But hjkl are right underneath your fingers. Most of the time, you have to reach for arrow keys, which slows you down.

1

u/codygman Nov 25 '13

$ is not randomly chosen, $ means end of line in regular expressions.

1

u/MediumRay Oct 05 '13

It becomes really obvious it's a better option than the mouse when you have to do it multiple times. I mean, changing what is inside the quotes in a = "this is so..." + "why " + keyword + "me";. Using the mouse requires careful selecting and retyping. Vim, just jump between "s changing the contents. If you want to change some of them to similar things it also requires only a keystroke.

0

u/joesb Oct 05 '13

Sublime Text: Click anywhere within the quote, use Arrow Key and Control key to quickly move to before the T (3-4 keystroke?). Begin typing. Use Arrow Key+Shift+Ctrl to select until the end of the quote (Or use Shift+End if the quote goes till the end. Press Delete.

It sounds alot more, but it require no remembering of command and don't require planning ahead. Your comment of "I could do this, or this, or this..." sounds like that, by the time I have thought about which command to use, I would have been done with just mindlessly using Ctrl keys and Arrow.