Hacker News new | ask | show | jobs
by cm127 4367 days ago
First you'll learn how to orientate around text quickly using normal mode, then you'll start playing with tabs, splits and buffers to search between multiple files, and then you'll start using registers to save phrases and regular expressions to search directories. At that point you'll never want to leave Vim again.

:wq

3 comments

> then you'll start playing with tabs, splits and buffers

I want to like vim's window management but it's pretty quirky, at times it seems to be following the principle of most surprise.

Ideally one could use tabs (that aren't renamed to the buffer name when populating a named tab), splits, and buffers together in such a way that one's layout never, for example, collapses, leaving a single displayed buffer and N hidden ones, or a buffer getting cloned across 2 splits (the latter is pretty disorienting, unless I'm diff'ing versions of a file I don't ever want to see 2 versions of the code consuming visible screen area).

Granted am only 3 days into the vim WM experiment here, lot's to learn...

Multiple files is exactly where Vim falls short to me. Sublime and Emacs do that much better, while in Vim it never feels natural. It seems the Vi-way is to exit, and start a new one from the terminal (which is slow for most projects but great for editing /etc/hosts).
:x

(It's the same as :wq, but one character shorter.)

Even shorter:

    ZZ
"Shift z z" is one key shorter than "shift colon x enter"
Colon? That sounds painful, map it to some single keystroke. I use back slash on my tiny cherry keyboard.

    noremap \ :
Isn't backslash the default <leader> keystroke?
yep, have leader mapped to space ;-)
No it is not the same. x only writes if not already written.