Eric Leenman wrote:
Hi,
Is it possible to remap the up and down key to behave a bit different.
For example I have text like below
aaaa : b123
cccc : d456
eeee : g789
And then I want everything after the : starting with xx_
When I then move the b, press i and type xx_ then it looks like xx_b123
When I then press the down-key its position to insert a character
between 5 and 6.
Is it possible to remap so that it goes to the postion between the
<space> and the d?
And when that looks like xx_d456 and I press the down-key it goes to the
postion between the <space> and the g?
Rgds,
Eric
You can remap any key to anything provided that (a) Vim sees the key in
question when you hit it, and (b) you can formulate what you want to remap it
to. For instance, I use 'wrap', so I've remapped the up and down key to move
by "screen" lines (in both Normal and Insert modes) while j k (in Normal mode)
still move by "file" lines (which sometimes occupy several "screen" lines):
map <Up> gk
map <Down> gj
imap <Up> <C-O>gj
imap <Down> <C-O>gk
In this case I don't quite understand what (which key sequences) you want to
remap <Up> and <Down> to: once you figure that, how to achieve it should be
obvious.
Best regards,
Tony.
--
He who attacks the fundamentals of the American broadcasting industry
attacks democracy itself.
-- William S. Paley, chairman of CBS