Oleksandr Manzyuk schrieb: > [...] > nnoremap <silent> [e :<C-U>call ToBeginEnv(v:count1)<CR> > nnoremap <silent> ]e :<C-U>call ToEndEnv(v:count1)<CR> > > " using the above definitions doesn't work, I suppose because hitting > <Esc> discards the count > " prefix if any > vmap <silent> [e :<C-U>call ToBeginEnv(v:count1)<CR><Esc>m'gv`` > vmap <silent> ]e :<C-U>call ToEndEnv(v:count1)<CR><Esc>m'gv`` > vmap <silent> ae :<C-U>call ToBeginEnv(v:count1)<CR>v]e > > " These seem to work fine... > omap <silent> [e :normal v[e<CR> > omap <silent> ]e :normal v]e<CR> > > " ...but this doesn't! > omap <silent> ae :normal vae<CR> > > I cannot figure out what is the problem with the last map. It behaves > as follows: if I do, e.g., y2ae, it goes 2 levels up to the beginning > of the environment, but then instead of yanking the piece of text from > that point to the matching end of environment it actually does 2]e, > that is, it goes to the matching end of the environment, and then goes > one more level up. In other words, the count gets substituted in both > (hidden) instances of [e and ]e. > > Furthermore, although hitting v2ae in normal mode gives the correct > result, typing :normal v2ae selects only the most inner environment > (instead of going one level up). What is the difference between v2ae > and :normal v2ae? > > Any suggestions as to how to fix this? Many thanks in advance to the > whole community! I am relatively new to Vim, but I'd like to say: Vim > rocks! > > Regards, > Oleksandr
I'm not sure why, but v:count1 is only updated for a count that has been typed in by the user. ":normal 2vae" keeps v:count1 at 1. The same applies for v:count. -- Andy --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
