开发者

Detect if a F# key is mapped on VIM

How can I view/list only the <F#> keys with :map? I need to know what <F#>开发者_如何学编程; is doing... Newbie here!


Entering the following will list function key mappings for to :

:for i in range(1, 12) | execute("map <F".i.">") | endfor

If you add a "verbose", you will be told where the key mappings were defined:

:for i in range(1, 12) | execute("verbose map <F".i.">") | endfor

If you have more than 12 function keys, adjust the second parameter of the "range()" expression accordingly.


you can just write

:map <F1>

to find out what the key is mapped to. I other mappings like the ones that start with \ you can type

:map \

and vim will list all mappings starting with \ for for the function keys I think you have to check them individually.


:map (without arguments) shows all the maps available for n, v and o modes. For the other modes, try the correspondent command (for example :imap for insert mode).

Now it's just a matter of skimming the output looking for function key maps. If you give the command a specific key:

:nmap <F4>

That map will be presented.


To Extend Jeets solution by mapping it in your .vimrc .

I'm always changing the configuration of my Function Keys so it's really useful to be able to remind myself what's there.

Just type ,f in normal mode to list the Function keys F1-F12

:nnoremap ,f :for i in range(1, 12) <bar> execute("map <F".i.">") <bar> endfor
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜