I am doing the exercise of learn vim the hard way
I have trouble mapping "the - key to "delete the current line, then paste it below the one we're on now".
I tried:
:map - dd p
:map - :dd p
:map - :dd <enter> p <enter>
Any help?
I am doing the exercise of learn vim the hard way
I have trouble mapping "the - key to "delete the current line, then paste it below the one we're on now".
I tried:
:map - dd p
:map - :dd p
:map - :dd <enter> p <enter>
Any help?
Before creating a mapping you should try the actual command by yourself: Here you want to delete a line with dd
and then paste it with p
. When you do that in normal mode you simply press the keys ddp without anything else in between, so that is what you need to do too in your mapping.
This means that you mapping should be map - ddp
. You don't need to use the command mode (with :
and <enter>
) since dd
and p
are normal mode commands, i.e. the key you press directly in normal mode.
Also two other things:
nnoremap - ddp
<enter>
is not a valid key representation in vimscript, you want to use <CR>
instead.