Live data from Hacker News

Vim tricks

hillelwayne.com

1–10 of 63 posts

Re: Vim tricks

#2
I’ve discovered q: when trying to quit vim in a hurry. You always keep finding new quirky things to do in vim but I guess the same hold true for other text editors like Emacs

Re: Vim tricks

#3
":, @: ": is the register storing the last executed command. You can write ":p to print it to the buffer. @: reruns the last command.

That seems like a mouthful. I use : to run the last command and some more to run the ones before that.

Re: Vim tricks

#6
post #3

":, @: ": is the register storing the last executed command. You can write ":p to print it to the buffer. @: reruns the last command. That seems like a mouthful. I use : to run the last command and some more to run the ones before that.

You can also use `:^F` to navigate your history in a horizontal split using regular motion/search keys.

Re: Vim tricks

#7
post #3

":, @: ": is the register storing the last executed command. You can write ":p to print it to the buffer. @: reruns the last command. That seems like a mouthful. I use : to run the last command and some more to run the ones before that.

And if you wanted to repeat that 10 times you would...?

Re: Vim tricks

#8
> U is the same as u except it does the undo as a new change, which is functionally useless.

Unless I’m mistaken, this is the default undo behavior for emacs...What horror to only have vim’s forward and backward undo history! Said the emacser on the vimmer’s post.

Re: Vim tricks

#9
There's a few commands I LOVE but find frequently unmentioned.

In insert mode, is a contextual completion. So like the normal or you just do and you can keep hammering the to fill in multiple "words". You can also complete lines, file paths, dictionary words, thesaurus words, tags, spelling, etc. See `help ins-completion`. Seriously, I can't do without this command. needs to be in everyone's daily use.

Also in insert mode: deletes a word back. You'll commonly find this is a lot of editors and stuff where it doesn't close a window. Similar to , though I many times accidentally hit in my browser instead of because I use this so much (bad speller).

much easier than pressing Esc

0 much easier than pressing ^ (honestly I have anything that is $,%,^,&. They aren't easy to reach)

Honestly, vim has some of the best written documentation I've read. If you really want to master vim, just read the docs on commands you already use. I guarantee you'll find something you didn't know.

Re: Vim tricks

#10
post #2

I’ve discovered q: when trying to quit vim in a hurry. You always keep finding new quirky things to do in vim but I guess the same hold true for other text editors like Emacs

That's how I found `K`. I was surprised the first time I got a man page open. Now I find it pretty useful and wish it extended to more than man pages.
Post reply on HN