Fandom

Vim Tips Wiki

Selectively displaying abbreviations

1,624pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

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

:ab<CR>

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>

CommentsEdit

It also works for maps.

eg: all my maps beginning with a comma

:map ,

displays

,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.


Also on Fandom

Random Wiki