Question

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 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

why don't show the Error output ?

Was it helpful?

Solution

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>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top