397

I'm learning new commands in Vim all the time, but I'm sure everyone learns something new once in a while. I just recently learned about this:

zz, zt, zb - position cursor at middle, top, or bottom of screen

What are some other useful or elegant commands you wish you'd learned ages ago?

3
  • 51
    technically, zz, zt, zb are positioning the screen with the cursor at the middle / top / bottom. to position the cursor at the middle / top / bottom use M, H, or L. Both sets of commands are useful!
    – Peter
    Aug 18, 2009 at 0:37
  • 1
    Reading this post months or a year ago has since helped me every day. dap is something I use to move paragraphs multiple times an hour, thanks to this post.
    – dansch
    Nov 1, 2013 at 11:49
  • 37
    I have never picked up so many tricks from a page that has been marked as non constructive :) Thanks all. Feb 25, 2014 at 12:50

45 Answers 45

332

I really wish I'd known that you can use Ctrl+C instead of Esc to switch out of insert mode. That's been a real productivity boost for me.

14
  • 97
    I remapped my Caps-Lock to an Esc. That's both easier than the normal Esc and Ctrl-C
    – Kasper
    Aug 16, 2009 at 14:16
  • 31
    another popular was is to use 'jj' for ESC. I like this approach so far. :map! jj <ESC>
    – claytron
    Sep 29, 2009 at 21:44
  • 28
    You can also use CTRL-[ (which I like because it's both little fingers... just a little rotation of both hands).
    – Jason Down
    Oct 6, 2009 at 4:33
  • 44
    use 'jk' as a variant on @claytron's. if you unknowingly are in INSERT mode already, jk leaves you where you were, so you can hit it whenever (credit: someone else...not my idea). Nov 30, 2012 at 7:24
  • 11
    Keep in mind that using Ctrl-c to exit out of insert mode does not trigger the InsertLeave autocommand event. If you have any plugins or scripts depending on it, they won't work. See :h i_CTRL-C.
    – sharat87
    Mar 26, 2014 at 3:22
205

The most recent "wow" trick that I learnt is a method of doing complicated search-and-replace. Quite often in the past, I've had a really complicated regexp to do substitutions on and it's not worked. There is a better way:

:set incsearch             " I have this in .vimrc
/my complicated regexp     " Highlighted as you enter characters
:%s//replace with this/    " You don't have to type it again

The "trick" here (for want of a better word) is the way that you can use the search to create the regexp (and 'incsearch' highlights it as you enter characters) and then use an empty pattern in the substitution: the empty pattern defaults to the last search pattern.

Example:

/blue\(\d\+\)
:%s//red\1/

Equivalent to:

:%s/blue\(\d\+\)/red\1/

See:

:help 'incsearch'
:help :substitute
5
  • 1
    wow... I've been looking for something like this
    – figurassa
    Feb 24, 2010 at 4:38
  • 1
    yeah, I wish that I knew abou this sooner. But then again, that's what I say about everything I learn that is new in vim. Jun 16, 2010 at 7:28
  • 26
    For anyone really loving this, try hitting <Ctrl-R>/ to insert the last search query. (See :help i_CTRL-R) Really useful for similar to above, but you want to capture part of the search results. (like this: %s:/\\([fF]rank\\) and mary/marie and \1/g)
    – idbrii
    Sep 19, 2010 at 21:50
  • 4
    :%s//... also works with * (search word under cursor). A plugin called visual-star-search extends the functionality of * to match the whole text of a visual selection which makes it easy to search & replace the selected text, e.g. v3e (visually select 3 words) * (search) and :%s//replacement/g (replace all occurences with "replacement"). I use this so often that I have a mapping for the global substitution command: :nmap <Leader>s :%s///g<left><left>. Nov 10, 2013 at 21:19
  • 1
    @idbrii since people reading may be Vim noobs (me), the %s: should be :%s, and for my system, I needed \(\) instead of \\(\\) Aug 6, 2017 at 18:13
166

I created this reference of my most used command for a friend of mine:

select                                   v
select row(s)                            SHIFT + v
select blocks (columns)                  CTRL  + v
indent selected text                     >
unindent selected text                   <
list buffers                             :ls
open buffer                              :bN (N = buffer number)
print                                    :hardcopy
open a file                              :e /path/to/file.txt
                                         :e C:\Path\To\File.txt
sort selected rows                       :sort
search for word under cursor             *
open file under cursor                   gf
  (absolute path or relative)
format selected code                     =
select contents of entire file           ggVG
convert selected text to uppercase       U
convert selected text to lowercase       u
invert case of selected text             ~
convert tabs to spaces                   :retab
start recording a macro                  qX (X = key to assign macro to)
stop recording a macro                   q
playback macro                           @X (X = key macro was assigned to)
replay previously played macro *         @@
auto-complete a word you are typing **   CTRL + n
bookmark current place in file           mX (X = key to assign bookmark to)
jump to bookmark                         `X (X = key bookmark was assigned to
                                             ` = back tick/tilde key)
show all bookmarks                       :marks
delete a bookmark                        :delm X (X = key bookmark to delete)
delete all bookmarks                     :delm!
split screen horizontally                :split
split screen vertically                  :vsplit
navigating split screens                 CTRL + w + j = move down a screen
                                         CTRL + w + k = move up a screen
                                         CTRL + w + h = move left a screen
                                         CTRL + w + l = move right a screen
close all other split screens            :only

*  - As with other commands in vi, you can playback a macro any number of times.
     The following command would playback the macro assigned to the key `w' 100
     times: 100@w

** - Vim uses words that exist in your current buffer and any other buffer you may have open for auto-complete suggestions.
8
  • You list "~X" to go to the mark with name X. That doesn't work for me - instead I use "'X" (single quote).
    – user14038
    Aug 20, 2009 at 6:38
  • Wow. Your absolutely right. When I was typing out the guide I guess my eye only seen the tilde and glossed over the back tick. I will update accordingly. Thanks for the heads up. Aug 20, 2009 at 12:45
  • 5
    this list is nice, but I really want to know how did you draw this table? with VIM? which plugin? I'm looking for one currently.
    – Kent
    Mar 11, 2010 at 14:34
  • 6
    I used VIM, but no plugin. However; using the select block feature made it relatively easy. Glad you found the list useful! ~brian Mar 12, 2010 at 13:29
  • 11
    Ctrl-Q for block-selection is a specificity of mswin.vim that allows CTRL-V to paste. Most vim users would consider this evil and disable mswin.vim. "+P or Ctrl-R + is not that hard to type to insert clipboard contents.
    – Benoit
    Sep 16, 2011 at 13:54
148

gi switches to insertion mode, placing the cursor at the same location it was previously.

6
  • 33
    I was so happy when I found out about g; now this moves me to tears :-) Sep 21, 2013 at 20:15
  • @longdeqidao not at all. It returns to the last insertion point. So you can scroll at your hearts content and it'll pull you back to where you were last inserting. Aug 2, 2015 at 2:22
  • 9
    FYI, g; (which @PatrickOscity referred to above) puts the cursor at the place an edit was made. You can use it multiple times to go back in history. Noting this here because my vim help doesn't mention this for some odd reason.
    – PonyEars
    Aug 7, 2015 at 14:16
  • 14
    Vim's intuitiveness never ceases to impress me. Since @PonyEars mentioned g; I tried if the "opposite" of it would be g, and lo and behold, we can go back and forward! Aug 7, 2015 at 20:29
  • a is shorter. :) But gi is very intuitive indeed, with g usually being an opposite operation. Jul 21, 2016 at 16:24
112
:q!

I wish I knew that before I started vi for the first time.

19
  • 24
    as an emacs guy, that is the funniest comment i've read. not sure you meant it to be though. You made me happy today.
    – pjammer
    Apr 10, 2012 at 18:53
  • 31
    I remember trying vim and emacs for the first time on the same day, not knowing how to exit either. I thought to myself what the heck is wrong with these people!? Dec 31, 2013 at 18:40
  • 14
    +1. The first time you start vim, the default message should be "write :q to quit". I would have save so much time lol Jul 1, 2014 at 10:26
  • 2
    @JoséRamón But it does show it on the screen by default if you enter vim without opening a file. Was this added recently? I can clearly remember trying vim years ago and it was there already. It also tells you to use :q! if you try to quit without saving the buffer.
    – mechalynx
    Sep 8, 2014 at 23:13
  • 5
    @ivy_lynx yes, you may be right, but only if you open vim without files. Usually, the first time you open vim is because you need to edit a config file in Unix, so you write "$ vim file" and you can't find your way out. Or am I the only one? Sep 9, 2014 at 6:52
57

^X-F completes using filenames from the current directory. No more copying/pasting from the terminal or painful double checking.

^X-P completes using words in the current file

:set scrollbind forces one buffer to scroll alongside another. e.g. split your window into two vertical panes. Load one file in each (perhaps different versions of the same file). Do :set scrollbind in each. Now when you scroll in one, both panes will scroll together. Ideal for comparing files.

7
  • How to disable the scrollbind once I've enabled it?
    – Amjith
    Aug 14, 2009 at 14:23
  • 2
    jinxed_coder: :set noscb to turn it off and use :set scb to turn it on (not :scrollbind). :h scrollbind
    – jmdeldin
    Aug 14, 2009 at 16:20
  • Whoops. Corrected for ':set scrollbind'. Aug 14, 2009 at 16:24
  • 7
    ^X-P completes with preference to previous words in the file, ^X-N with preference to the next words in the file. Sep 14, 2009 at 18:15
  • You can also diff files by opening file1 and running :diffsplit file2 or just starting vim with vim -d file1 file2. Vim automatically scrollbinds the two files. Aug 30, 2014 at 23:14
57

You can use a whole set of commands to change text inside brackets / parentheses / quotation marks/ tags. It's super useful to avoid having to find the start and finish of the group. Try ci(, ci{, ci<, ci", ci', ct depending on what kind of object you want to change. And the ca(, ca{, ... variants delete the brackets / quotation marks as well.

Easy to remember: change inside a bracketed statement / change a bracketed statement.

7
  • 17
    this isn't only for c. You can do this with d to delete (e.g. di( or da(), y to yank, v to select etc. Aug 18, 2009 at 18:27
  • Hello! I would like to know there the documentation for this is using :help? I can't find it anywhere. >_<
    – Matej
    Oct 2, 2012 at 13:14
  • 1
    @Peter I've checked those out before, but couldn't find mention of the peculiar "inner + delimiter" behaviour. It turns out to be in :help motion.txt! Thanks!
    – Matej
    Oct 2, 2012 at 19:16
  • 2
    this tip is the sole reason why i switched to vi in the first place :)
    – Justin L.
    Feb 3, 2013 at 3:45
  • 1
    If you're editing HTML or XML you can use cit to change the contents of the current tag. For example in <span>Some text</span>, if your cursor is over the "m" you can do ditto get <span></span>. Apr 30, 2014 at 19:49
48

Some of my latest additions to my Vim brainstore:

  • ^wi: Jump to the tag under the cursor by splitting the window.
  • cib/ciB: Change the text inside the current set of parenthesis () or braces {}, respectively.
  • :set listchars=tab:>-,trail:_ list: Show tabs/trailing spaces visually different from other spaces. It helps a lot with Python coding.
5
  • 5
    This needs more votes! cib is great. Apr 30, 2012 at 15:39
  • also: ciw to change the current word (or caw, the same but left hand only) ciW to change the current W=o.(r-d) Sames with v instead of c will select in visual instead of replacing
    – lajarre
    Nov 22, 2012 at 16:54
  • 5
    cib is equivalent to typing "ci(". You can also do "ci[", "ci{", or (if your vimrc is set up correctly) "ci<", for other types of brackets.
    – Tom Lord
    Jul 11, 2013 at 14:26
  • 2
    Also, "cit" to change the text inside a tag. Very useful when working with XML/HTML.
    – Walter
    Oct 16, 2013 at 14:43
  • it's also worth mentioning that you can suffix w/ the closing brace instead, should you prefer that. also, i've just learned about ci} & cit - wow, this is going to be very useful. vi[m] is proving a very exciting program[s]! Oct 17, 2015 at 20:35
48

The asterisk key, *, will search for the word under the cursor.

[+Tab will take you to the definition of a C function that's under your cursor. (It doesn't always work, though.)

5
  • 1
    Try 'man ctags' if you're using *nix to learn how to generate a "tags" file that tells vim how to find the definition of any function or variable in many languages in addition to C. Use ctrl+] to find the definition of the token under your cursor, or use :tag tokenToFind to find any token it knows about. You can even start vim with "vim -t tokenToFind" to open the appropriate file and position the cursor at the function you need to edit.
    – Adam Liss
    Aug 18, 2009 at 0:22
  • 25
    the # key will search in reverse direction for the word under the cursor
    – dansch
    Apr 29, 2013 at 17:50
  • github.com/bronson/vim-visual-star-search enables star search for visual selections. I don't want to miss it any more. Sep 21, 2013 at 20:22
  • [ + Tab will work always when you extend the path with required folders like set path+=path/to/files
    – dlmeetei
    Feb 1, 2016 at 7:46
  • How can I switch on search without navigation? * goes forward; # backwards; I want to highlight and stay at place.
    – fde-capu
    Aug 28, 2020 at 3:13
47
  1. Don't press Esc ever. See this answer to learn why. As mentioned above, Ctrl + C is a better alternative. I strongly suggest mapping your Caps Lock key to escape.

  2. If you're editing a Ctags compatible language, using a tags file and :ta, Ctrl + ], etc. is a great way to navigate the code, even across multiple files. Also, Ctrl + N and Ctrl + P completion using the tags file is a great way to cut down on keystrokes.

  3. If you're editing a line that is wrapped because it's wider than your buffer, you can move up/down using gk and gj.

  4. Try to focus on effective use of the motion commands before you learn bad habits. Things like using 'dt' or 'd3w' instead of pressing x a bunch of times. Basically, any time that you find yourself pressing the same key repeatedly, there's probably a better/faster/more concise way of accomplishing the same thing.

11
  • 11
    Don't use Escape? That's heresy. Escape is your best friend, both on and off the job.
    – xcramps
    Aug 14, 2009 at 16:54
  • 28
    if it's such a good friend, why is it so far away on the keyboard?
    – anthony
    Aug 14, 2009 at 18:57
  • because 99% of the people never uses it. Aug 16, 2009 at 4:57
  • 5
    Escape is separated from other keys by a few inches on my keyboard. You can't miss it. Aug 18, 2009 at 0:05
  • 15
    #3 is awesome! Still learning new things ... Aug 9, 2011 at 1:59
44

ZZ (works like :wq)

And about the cursor position: I found that a cursor which always stays in the middle of screen is cool -

set scrolloff=9999
3
  • 2
    Didn't know that. :x does that as well
    – sa125
    Sep 25, 2012 at 10:47
  • 18
    Not entirely accurate. Works like :x, which only saves the file if there are changes, whereas :wq always saves the file.
    – Erik B
    Mar 5, 2014 at 9:10
  • ZQ (works like :q!)
    – xialu
    Apr 13, 2018 at 7:18
39

gv starts visual mode and automatically selects what you previously had selected.

34

:shell to launch a shell console from Vim. Useful when for example you want to test a script without quitting Vim. Simply hit ^d when you done with the shell console, and then you come back to Vim and your edited file.

6
  • I guess :!sh was too hard. I prefer that because it's easier to compose command lines using registers/completions from the current buffer or e.g. use %/%:h for the current filename/dirname etc.
    – sehe
    Feb 7, 2015 at 22:55
  • 1
    This one is very cool. I use it every day.. Before that it was, :wq, do cli stuff, reopen vim with same file.. Great optimization
    – Flashin
    Dec 8, 2015 at 9:21
  • 9
    Ctrl-Z to switch to shell and fg<ENTER> to go back to vim.
    – Mario G.
    Mar 12, 2017 at 19:46
  • Put map <Esc>! :shell<CR> in your .vimrc, and you can launch the shell just with Alt+!, or Alt+Shift+1. (Mnemonic: :!{cmd} executes {cmd} with the shell.)
    – musiphil
    May 5, 2017 at 19:37
  • :shell will start a new nested shell level though. Whereas ctrl-z does not.
    – wisbucky
    Jun 26, 2018 at 0:45
34

This always cheers me up:

:help 42
31

vimcryption

vim -x filename.txt

You will be asked for a passphrase, edit and save. Now whenever you open the file in vi again you will have to enter the password to view.

4
28

Build and debug your code from within Vim!

Configuration

Not much, really. You need a Makefile in the current directory.

To Compile

While you're in Vim, type :make to invoke a shell and build your program. Don't worry when the output scrolls by; just press Enter when it's finished to return to Vim.

The Magic

Back within Vim, you have the following commands at your disposal:

  1. :cl lists the errors, warnings, and other messages.
  2. :cc displays the current error/warning message at the bottom of the screen and jumps to the offending line in your code.
  3. :cc n jumps to the nth message.
  4. :cn advances to the next message.
  5. :cp jumps to the previous message.

There are more; if you're interested, type :help :cc from within Vim.

1
  • 1
    works with more than just compiling code. Namely any task written in a makefile is a great use for this. Oct 23, 2015 at 19:23
26

Press % when the cursor is on a quote, parenthesis, bracket, or brace to find its match.

2
  • 21
    If the cursor is not over any of those it shifts to the right until it hits one of them. Sep 2, 2009 at 15:09
  • I just tried it and it seems that it defaults left in you're inside. Experimenting a bit: If the cursor is at the dot, then: (<--. ) or . --(---->) or . --(--(----)--->) or nothing happens if you're to the right of all the braces ( ) .
    – mattb
    Apr 21, 2021 at 11:07
25

^P and ^N

Complete previous (^P) or next (^N) text.

^O and ^I

Go to previous (^O - "O" for old) location or to the next (^I - "I" just near to "O").

When you perform searches, edit files, etc., you can navigate through these "jumps" forward and back.

Marks

Press ma (m- mark, a - name of mark). Later to return to the position, type `a.

5
  • 1
    Wow, I didn't know about ^O and ^I: that is awesome. Might be worth including :help jump-motions etc in your answer in case anyone wants more information.
    – DrAl
    Aug 14, 2009 at 8:15
  • check out ShowMarks vim.org/scripts/script.php?script_id=152 . It will help you remember where and what all of your marks are in a buffer. you can toggle the visualization on and off with \mt
    – tester
    Mar 9, 2011 at 16:45
  • I don't get the difference between ^P and ^N...
    – lajarre
    Nov 22, 2012 at 17:00
  • @lajarre they cycle through the list of available completions in opposite direction Sep 21, 2013 at 20:19
  • 3
    I often use ^O^O when opening up Vim after I noticed that I want to edit the last edited file again. Huge time saver! Sep 21, 2013 at 20:20
23

^r^w to paste the word under the cursor in command mode.

It is really useful when using grep or replace commands.

1
  • If it's the only word you want, then * in normal mode will search for the word under the cursor.
    – idbrii
    Sep 19, 2010 at 22:02
22

Until [character] (t). It is useful for any command which accepts a range. My favorite is ct; or ct) which deletes everything up to the trailing semicolon / closing parentheses and then places you in insert mode.

Also, G and gg are useful (Go to bottom and top respectively).

4
  • best one here, though some of the others are useful too, I just knew about em all already
    – dansch
    Apr 24, 2013 at 20:42
  • 1
    Also f instead of t, which will [action] up through that character; for instance, having the cursor on the beginning of a function argument, df, will delete it (in suitable languages, of course).
    – fmt
    Oct 25, 2013 at 4:33
  • t and f are great for editing part of a camelCase variable. Eg, if you just duplicated a line and need to change firstVariable to secondVariable, position your cursor at the start of firstVariable, then ctV
    – Greg
    Sep 19, 2014 at 15:07
  • 1
    T and F also work, but in the opposite direction.
    – Fede
    Jul 30, 2016 at 12:20
18

^y will copy the character above the cursor.

3
  • 8
    ... and ^E will insert the character below the cursor Aug 18, 2009 at 0:15
  • doesn't work for me, it just moves a cursor to the beginning of text
    – Alex
    Dec 29, 2019 at 0:09
  • 1
    @Alex This is to be used in Insert mode
    – Noel Evans
    Oct 15, 2020 at 15:22
18

Typing a line number followed by gg will take you to that line.

3
  • 31
    : followed by line number does the same :42 goes to line number 42 Aug 24, 2009 at 17:56
  • 12
    Typing a line number followed by G has the same effect. Sep 2, 2009 at 15:12
  • 3
    <number>go goes to the <number>th character in the file.
    – fmt
    Oct 25, 2013 at 4:35
17

I wish I'd known basic visual block mode stuff earlier. Even if you don't use Vim for anything else, it can be a big time saver to open up a file in Vim just for some block operations. I'm quite sure I wasted a ton of time doing this kind of thing manually.

Examples I've found particularly useful, when, say, refactoring lists of symbolic constant names consistently:

Enter Visual Block mode (Ctrl + Q for me on Windows instead of Ctrl + V)

Move the cursor to highlight the desired block.

Then, I whatever text and press Esc to have the text inserted in front of the block on every line.

Use A instead of I to have the text inserted after the block on every line.

Also - simply toggling the case of a visual selection with ~ can be a big time saver.

And simply deleting columns, too, with d of course.

14

q<letter> - records a macro.

and

@<same-letter> - plays it back.

These are by far the most useful commands in Vim since you can have the computer do a whole lot of work for you, and you don't even have to write a program or anything.

5
  • The use of q simplifies matters, but you aren't required to use it: just save into a named buffer the buffer command " - for example, using buffer a - "ad$ ...
    – Mei
    Oct 21, 2013 at 18:12
  • @Mei q records a macro; macros can contain commands, not just text, so "ad$ is different from qa. Aug 31, 2014 at 0:11
  • @Sortofabeginner That's irrelevant here. The command "ad$ puts text into buffer a and qa runs it.
    – Mei
    Aug 31, 2014 at 0:14
  • 2
    @Mei qa doesn't run it; qa records it and @a runs it. It is true that you can write a macro in plain text, store it in register a with something like "ad$, and then execute it with @a, but this is quite a bit more work. There is a fundamental difference between cut-and-paste and record-and-run. Aug 31, 2014 at 0:32
  • Doh! I knew that. Thanks for the correction
    – Mei
    Aug 31, 2014 at 0:52
14

Opening multiple files using tabs

:tabe filepath

Navigating between open files

gt and gT or :tabn and :tabp

Save the open session so that you can get back to your list of open files later

:mksession session_file_name.vim

Open a created session

vim -S session_file_name.vim

Close all files at once

:qa

Another command I learned recently

autocmd

It allows you to run a command on an event, so you could for example run the command make when you save a file using something like:

:autocmd BufWritePost *.cpp :make
12

qx will start recording keystrokes. You can do pretty much any editing task and Vim remembers it. Hit q again when you're finished, and press @x to replay your keystrokes. This is great for repetitive edits which are too complex to write a mapping for. You can have many recordings by using a character other than x.

2
  • 5
    Also the same character 'x' is shared between the 'q' record macro command and the named clipboards ("x...). You can leave snippets of macros sitting around your file and copy them to a named clipboard (e.g. "xyy) and then play them back (@x). Sep 2, 2009 at 15:07
  • And if you create the awesomist macro ever, you can past that clipboard into your _vimrc with a 'let @x = ""' (putting the macro in the "") and save it forever! Apr 2, 2013 at 14:59
11

I would have to say that one of my favorites is putting the help window in a new tab:

:tab help <help_topic>

This opens up help in a new tab and, as somebody that loves Vim tabs, this is ridiculously useful.

2
  • 2
    Buffers are the tabs of vim. They are better supported by the vim workflow. I suspect tabs were only added to vim because too many people did not understand buffers. Jun 7, 2015 at 12:42
  • 1
    Ok so very soon after saying that, I found a use for tabs in vim. It is true that if you are using one buffer per tab, you need to learn about buffers. That is not how tabs were intended to be used in vim. Most advanced vim users use buffers the way tabs are used in most programs. Many people think tabs should have been named layouts in vim. They are mostly for having different collections of windows open in different tabs. You could also have a specific buffer that you go back to a lot open in one tab, and use the other tab for viewing all other buffers. Jun 7, 2015 at 13:15
9
:x #(Save and Quit a File)

Same as :wq or ZZ

1
  • For those who like :wq too much, I use :command! Wq :wq<CR> to deal with the pesky cases when I can't get off my shift key fast enough.
    – fmt
    Oct 25, 2013 at 4:36
9

cw

Change word - deletes the word under the cursor and puts you in insert mode to type a new one. Of course this works with other movement keys, so you can do things like c$ to change to the end of the line.

f + character

Finds the next occurrence of the character on the current line. So you can do vft to select all the text up to the next "t" on the current line. It's another movement key, so it works with other commands too.

9

:b [any portion of a buffer name] to switch buffers. So if you have two buffers, "somefile1.txt", and "someotherfile2.txt", you can switch to the second with simply ":b 2.t<enter>". It also supports tab completion, although it's not required.

Speaking of tab completion, the setting :set wildmode=full wildmenu is also very helpful. It enables complete tab completion for command-mode, as well as a very helpful ncurses-style menu of all the possible matches when using it.

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