Theme by nostrich.
I’ve mentioned in the past that I’ve been using
vim as my primary
editor for some time, so I figure now is probably as good of a time as
any to give some tips I’ve picked up during my extensive use of
First, people wonder why I use
vim when I work primarily in GUI
These aren’t necessarily any better than anybody else’s tips, just a random smattering of lessons I’ve learned along the way.
VISUALenvironment variables, and begin deliberately forgetting to use
-mwhen checking in code via
svnso that you get forced to use it.
vimtutor. Make yourself at least 30 minutes to go through the whole tutorial, and on multiple days. Do everything it says to do. You’ll only get better at using
vimby using it, so you have to do what the tutorial says to do in order to start developng the muscle emory required.
.commands early. These shortcuts alone make me more efficient than most other editors.
.vimrc. Mine is pretty minimal, but I’m working on it.
set paste. You’re welcome.
~/.vim/ftplugin/<type>.viminstead of using a bunch of
autocmd’s in your
:helpcommand. First, just do
:helpto learn how to bounce around within the help. (
Ctrl-]will follow a tag, if you don’t bother to read that far initially).
lso that one of these days when you’re on a vt100 terminal and the arrow keys don’t work, you don’t suddenly get stuck with an editor that won’t work at all for you. (You can use the arrow keys if you’re in
INSERTmode and don’t want to constantly switch back and forth - although I’d recommend figuring out how to accomplish what you want to do with normal mode.)
vim, you’re kinda’ expected to be able to use them to your benefit.
Ctrl-ris redo. You’re welcome. (Incidentally,
vim’s undo history is non-linear - if you make change 1, then 2, then undo back to 1, make change 3, you can go back to 2. There are some decent sites which explain how to make sense of this, but maybe
:earlier 20swill do what you really need.)
vimto do everything you want it to do, install some plugins.
:set numberbecause a lot of the commands I use are easier to use by knowing line numbers. I don’t use visual mode too much (although I’m getting better). Because I use line numbers so much, but because on a terminal, they’ll be copied to the clipboard if you’re selecting something to put in an email, say - you’ll want a way to quickly turn those off. I use a keyboard shortcut, but
:set nu!is not too slow if you’re only going to do it on occasion.