Monday, December 8, 2014

Re: Definition of visual mode map

Am Samstag, 6. Dezember 2014 01:30:30 UTC+1 schrieb 颖黄:
> Hi,
> I want to define a visual mode mapping f.
> My intention is first,press "v" to visually select words, and press key "f", the selected would be copied into register @@, and my vaa.sh would be called, with 2 parameters, one is current file name, two is the content from @@ register.
> Bellowing is my code.
> xnoremap f :exec '!sh ~/bashrc/vaa.sh ' . expand("%:p") . @@<CR>
> But, I got following error:
> "E481: No range allowed"

Hi,

When you press : in visual mode, Vim inserts the range markers :'<,'>
But :exec doesn't allow a range. So, replace ":exec" with ":<C-U>exec", this will clear the range.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment