Vim Tips Wiki

Selectively displaying abbreviations

1,614pages on
this wiki
Tip 267 Printable Monobook Previous Next

created June 27, 2002 · complexity basic · author zzapper · version 5.7

Abbreviations have always been one of the most useful parts of Vim, trouble is when you've got too many you forgot what you called them.

You can of course list the whole lot with


But did you know that you can type the first few letters of your abbreviations and get a list of just those abs. eg:

:ab php<CR>

gives me all my php abs

:ab perl<CR>

gives me all my perls

also try control-D instrad of <CR>


It also works for maps.

eg: all my maps beginning with a comma

:map ,


,z :redir @*|sil exec 'g@<\(input\|select\|textarea\|/\=form\)\>@p'|redir END<CR>
,y "yyy@y<CR>
,x :%s#<script\_.*/script>#<script>^M</script>#g
,v :e $VIM/_vimrc
,s :source $VIM/_vimrc
,r :redir! > c:/aaa/xxx
,i :update<CR>: !start c:\progra~1\intern~1\iexplore.exe <cWORD><CR>
,f :update<CR>:silent !start c:\progra~1\intern~1\iexplore.exe file://%:p<CR>
,c c/["'<;)]<CR>
,h "zda<h1><C-R>z</h1> <Esc>2F>

You can use Tab- and Ctrl-D-completion on the Vim commandline for just about everything. Play around. Commands, filenames, maps, abbreviations, buffernames and whatnot. It's context sensitive, so it completes the right thing at the right place. Extraordinarily useful and an extreme speed boost.

Around Wikia's network

Random Wiki