Friday, September 10, 2010

Re: Multiple lines different only in 2 words. How ?

On Fri, September 10, 2010 9:05 am, Andriy Y wrote:
> I'm remapping window navigation in vimrc file and I have use command like
> this:
> nnoremap <M-Right> <C-W><Right>
>
> I need to repeat the line with Right replaced to Left, U, D, hjkl - and I
> feed a bit silly copy-pasting the line and correcting manually.
> What would be the fastest way to do that ?

for i in ['Right', 'Left', 'U','D', 'h','j','k','l']| call append('$',
"nnoremap <M-".i."> <C-W><".i.">")|endfor

(one line, if you don't want to have it included in the current buffer,
substitute the append('$', "....") by an :exe "..." call)

> Also, is there a way to remap all C-W combos to M- using smth like this:
> nnoremap <M-> <C-W><
> ?

are thos <C-W> combow already mapped or are you refering to built-in
functions?

If they are already mapped, you can :redir the output of :map and reuse it
for mapping it again. For Builtin keys, I have no idea how to
pragmatically fetch the keys (other than parsing windows.txt)

regards,
Christian

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

No comments:

Post a Comment