开发者

VIM: Know which command executed when a key pressed

开发者 https://www.devze.com 2023-02-21 11:36 出处:网络
How do I know which com开发者_运维技巧mand will be executed when I press a key, for example <Leader>c?To see mappings use:

How do I know which com开发者_运维技巧mand will be executed when I press a key, for example <Leader>c?


To see mappings use:

:verbose map <leader>c

Replace map by the corresponding imap, cmap, etc., as needed.

For Vim's built-in commands you'll need to use the help:

:help gq

See :help context for pointers.


Sometimes if map <keys> is not enough you may use one of the following:

  • :debug normal <keys><CR>: for normal, visual, select, operator-pending and insert/replace/virtual replace modes but not for ex/command-line mode. You will have to precede <keys> with something that enters target mode.
  • :set verbosefile=/tmp/verbose.log verbose=15<CR><keys>:set verbose=0<CR>: for all modes it will procude a log of all commands executed in file /tmp/verbose.log. You will see errors if there is a recursive structure somewhere.
  • Start vim with vim -s <(echo '<keys>') -D. It will enter debug mode immediately after vim starts, but you will have to skip all initializations manually.

These are all advanced debugging features and they are very time-consuming, but they may help where something more simple cannot.

0

精彩评论

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