Tuesday, September 19, 2017

q: in mapping not invoking commandline window, only the command line

Here is a mapping using q: that works, copies cursor WORD into @" and uses it to build a substitute command in command line window, ends by waiting for user to type a character the cursor should move back to.
    nmap <F6>W yiWq:i%s/\<^R "\>/^R "/g^[ F
Note ^U ^R ^[ ^M are all the ctrl-v ctrl-? form
Here is an adaptation of the above to capture 2 or more WORDs at a time
    nmap <F6>n : ^Ulet @n=v:count^M@nyWq:i%s/\<\(^R "\)\>//ge^[ T>a
The mapping works as expected thru @nyW, but then fails because q: does not activate the command line window as expected, apparently the q is ignored and the : then fires up the command line instead, resulting in E488 Trailing characters.  If one removes the %s... from the right hand end the mapping ends by typing :i in the command line.



--
Graham Lawrence

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