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".
:map - dd p
:map - :dd p
:map - :dd <enter> p <enter>
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
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
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