基本上,我想查看当前缓冲区中所有插件,vimrc等所做的所有键映射,在当前缓冲区。还有别的办法吗?
当前回答
像这样安装这个插头: 塞“https://github.com/tpope/vim-scriptease” 知道什么<M-C-F10>(我自己的映射)做什么? 试试这个
:Verbose nmap <M-C-F10> | omap <M-C-F10> | vmap <M-C-F10> | imap <M-C-F10> | cmap <M-C-F10> | tmap <M-C-F10>
把它放在一个函数中:
func! Leo_keymap(keys)
exe "verbose map " . a:keys
exe "verbose map! " . a:keys
exe "verbose tmap " . a:keys
" 不好 / not good:
" exe "verbose nmap " . a:keys
" exe "verbose omap " . a:keys
" exe "verbose vmap " . a:keys
" exe "verbose imap " . a:keys
" exe "verbose cmap " . a:keys
" exe "verbose tmap " . a:keys
" 不行 / not work
" exe "Verbose map " . a:keys . <Bar> . "verbose map! " . a:keys . <Bar> . "verbose tmap " . a:keys
endfunc
cnoreabbrev <expr> map getcmdtype() == ":" && getcmdline() == 'map' ? 'Verbose call Leo_keymap("")<left><left>' : 'map'
" 不行 / not work
" command! -nargs=* Map :new<CR>:put = Vim_out('call Leo_keymap(input())')
" 不行 / not work
" :put = Vim_out("call Leo_keymap('ls')")
" may be take placed by the above line
cnoreabbrev <expr> nmap getcmdtype() == ":" && getcmdline() == 'nmap' ? 'Verbose map' : 'map'
cnoreabbrev <expr> imap getcmdtype() == ":" && getcmdline() == 'imap' ? 'Verbose imap' : 'imap'
cnoreabbrev <expr> cmap getcmdtype() == ":" && getcmdline() == 'cmap' ? 'Verbose cmap' : 'cmap'
cnoreabbrev <expr> tmap getcmdtype() == ":" && getcmdline() == 'tmap' ? 'Verbose tmap' : 'tmap'
旧内容,可能无用:
func! Leo_keymap(keys)
exe "verbose map " . a:keys
exe "verbose map! " . a:keys
exe "verbose tmap " . a:keys
" exe "Verbose map " . a:keys . <Bar> . "verbose map! " . a:keys . <Bar> . "verbose tmap " . a:keys
" exe "verbose nmap " . a:keys
" exe "verbose omap " . a:keys
" exe "verbose vmap " . a:keys
" exe "verbose imap " . a:keys
" exe "verbose cmap " . a:keys
" exe "verbose tmap " . a:keys
endfunc
command! -nargs=* Map :call Leo_keymap(<q-args>)
Map d得到:
n dL * v$hhd
Last set from ~/dotF/cfg/nvim/plug_wf.vim line 712
n df * ggdG
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 250
n dB * %dab
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 230
n d" * da"
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 212
n dw * diw
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 211
n d' * :call DoubleAsSingle()<CR>da'
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 195
No mapping found
No mapping found
Press ENTER or type command to continue
到目前为止,我不知道如何将其与:Verbose .....结合起来
其他回答
像这样安装这个插头: 塞“https://github.com/tpope/vim-scriptease” 知道什么<M-C-F10>(我自己的映射)做什么? 试试这个
:Verbose nmap <M-C-F10> | omap <M-C-F10> | vmap <M-C-F10> | imap <M-C-F10> | cmap <M-C-F10> | tmap <M-C-F10>
把它放在一个函数中:
func! Leo_keymap(keys)
exe "verbose map " . a:keys
exe "verbose map! " . a:keys
exe "verbose tmap " . a:keys
" 不好 / not good:
" exe "verbose nmap " . a:keys
" exe "verbose omap " . a:keys
" exe "verbose vmap " . a:keys
" exe "verbose imap " . a:keys
" exe "verbose cmap " . a:keys
" exe "verbose tmap " . a:keys
" 不行 / not work
" exe "Verbose map " . a:keys . <Bar> . "verbose map! " . a:keys . <Bar> . "verbose tmap " . a:keys
endfunc
cnoreabbrev <expr> map getcmdtype() == ":" && getcmdline() == 'map' ? 'Verbose call Leo_keymap("")<left><left>' : 'map'
" 不行 / not work
" command! -nargs=* Map :new<CR>:put = Vim_out('call Leo_keymap(input())')
" 不行 / not work
" :put = Vim_out("call Leo_keymap('ls')")
" may be take placed by the above line
cnoreabbrev <expr> nmap getcmdtype() == ":" && getcmdline() == 'nmap' ? 'Verbose map' : 'map'
cnoreabbrev <expr> imap getcmdtype() == ":" && getcmdline() == 'imap' ? 'Verbose imap' : 'imap'
cnoreabbrev <expr> cmap getcmdtype() == ":" && getcmdline() == 'cmap' ? 'Verbose cmap' : 'cmap'
cnoreabbrev <expr> tmap getcmdtype() == ":" && getcmdline() == 'tmap' ? 'Verbose tmap' : 'tmap'
旧内容,可能无用:
func! Leo_keymap(keys)
exe "verbose map " . a:keys
exe "verbose map! " . a:keys
exe "verbose tmap " . a:keys
" exe "Verbose map " . a:keys . <Bar> . "verbose map! " . a:keys . <Bar> . "verbose tmap " . a:keys
" exe "verbose nmap " . a:keys
" exe "verbose omap " . a:keys
" exe "verbose vmap " . a:keys
" exe "verbose imap " . a:keys
" exe "verbose cmap " . a:keys
" exe "verbose tmap " . a:keys
endfunc
command! -nargs=* Map :call Leo_keymap(<q-args>)
Map d得到:
n dL * v$hhd
Last set from ~/dotF/cfg/nvim/plug_wf.vim line 712
n df * ggdG
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 250
n dB * %dab
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 230
n d" * da"
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 212
n dw * diw
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 211
n d' * :call DoubleAsSingle()<CR>da'
Last set from ~/dotF/cfg/nvim/clipboard_regis.vim line 195
No mapping found
No mapping found
Press ENTER or type command to continue
到目前为止,我不知道如何将其与:Verbose .....结合起来
另一种方法是将会话保存到一个文件中,然后编辑这个文件,因为它包含所有的映射和设置。
:mks[ession] [file] -编写一个恢复当前编辑的Vim脚本 会话。
:map和它的朋友是键,:verbose添加信息,:redir允许搜索后细化。
它们是一个完美的组合,可以显示哪些命令绑定到哪些快捷方式,反之亦然,但如果您希望在需要搜索映射时搜索某些键并避免使用临时文件,请查看scriptrim和:Verbose command。
它是verbose上的包装器,用于在预览窗口中显示结果。
这样你就可以在结果中搜索你想要的任何东西,而不需要使用临时文件
类型:详细映射和使用/ ?像往常一样。
:redir! > vim_keys.txt
:silent verbose map
:redir END
这将把定义快捷方式的位置输出到一个文本文件。
除了关于:map不带参数的回答:不要错过它的详细形式(:verbose map),它显示了映射的定义位置(参见:help map-verbose)。