On 2014-11-15 13:59, porphyry5 wrote: > On Friday, November 14, 2014 4:02:55 PM UTC-8, porphyry5 wrote: > > In a key mapping I use the command ':%s//\=@o/gce'. > > > > The command executes as expected except that it behaves as if the > > c flag were not set. Is this flag unavailable in a key mapping, > > or is there some other option that needs to be set for it to > > work. It works as expected at the command line. > > This is the mapping concerned: > "map ,, /@@<CR>"myWcwqq<Esc>h"oywxx"nywma:let > @/=@m<CR>:%s//\=@n/ge<CR>:let @/=@n<CR>:%s//\=@o/gce<CR>`ay2h`a:if > @" != 'qq'<CR>:norm "Zyw<CR>:en<CR><CR>
Ah, I believe the problem is triggered because the atoms after the ":%s//\=@o/gce<CR>" are interpreted as answers to the y/n/a/q/l/^E/^Y prompt. The back-tick is ignored and the "a" (the subsequent atom) is interpreted as "a"ll the remaining matches. For this to work (actually prompting the user), the ":%s//\=@o/gce<cr>" has to be the last item in your mapping, leaving the :s command in the user-prompting state. > The input file it processes has certain words flagged with a > leading '@@' to indicate a possible error that can only be resolved > by inspection. The mapping strips the leading @@ from all > occurrences of the current word with the first :%s, then runs the > second :%s with the c flag to allow the user to respond either 'a' > or 'q' depending on whether the word is actually an error, or > should be added to the reference word list. I'm not sure I completely follow your process. You have words flagged with "@@" that you need to ask the user about, potentially adding them to a reference word list (which it looks like you're storing in the Z register). Do the "@@" remain at the end of the process? I see them getting replaced by "qq" but didn't see them getting returned to "@@" at any point. With a sample "before" and "after" document, along with what/how you want your reference word-list and the y/n answers you gave, it should be possible to rewrite this mapping so that it gives you the functionality that you want. -tim -- -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.