开发者

vim : <silent> nmap

In vim I have this nmap

nmap <silent> ,mu : marks ABCDEFGHIJKLMNOPQRSTUVWXYZ<CR>

If I don´t have Upper marks and try ,mu I get

E283: No marks matching "ABCDEFGHIJKLMNOPQR开发者_高级运维STUVWXYZ"

why don't show the Error output ?


Try

 nnoremap <silent> ,mu :execute "try\nmarks ABCDEFGHIJKLMNOPQRSTUVWXYZ\ncatch /\\V\\^Vim(marks):E283:/\nendtry"<CR>

By the way, is there a reason for writing :nmap instead of :nnoremap? You should not do this if you don't have a reason unless you want to run in the situation where you can't predict what will be the result of adding another mapping (directly to vimrc or by installing a plugin).

Edit (sehe)

To make things more readable, I'd suggest using a snippet like this in your $MYVIMRC:

function! ShowGlobalMarks()
    try
        marks ABCDEFGHIJKLMNOPQRSTUVWXYZ
    catch /E283:/
    endtry
endfu

nnoremap <silent> ,mu :call ShowGlobalMarks()<CR>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜