I'm using the easymotion plugin and mapping my arrow keys to do calls to easymotion. Concretely:
map <down> <Plug>(easymotion-w)
map <left> <Plug>(easymotion-F)
map <right> <Plug>(easymotion-bd-f)
map <up> <Plug>(easymotion-B)
This works as intended. Now I want it to work also in insert mode so I added:
imap <down> <Esc><down>
imap <left> <Esc><left>
imap <right> <Esc><right>
imap <up> <Esc><up>
Now in insert mode down and up work like the default keys (moving up and down) whereas right left have the intended behaviour. However, to me they seem equivalent mappings.
I've tried changing to imap <down> <Esc>dd
, still does the default behaviour. If I put imap <left> <Esc>dd
it deletes the line. So it may not be related to easymotion in particular.
Question 1 What is happening and how can I solve it?
Question 2: is this the most elegant/correct way to do mappings?
Note: at first I thought it may be affected by the time it takes to go from Insert to Normal mode, so I added the following piece of code that solves it:
set timeout " Do time out on mappings and others
set timeoutlen=2000 " Wait {num} ms before timing out a mapping
"when press Esc to leave Ins mode it no longer takes a second
"or another keystroke to leave Ins mode completely and update
"the satus line.
set ttimeoutlen=0
augroup FastEscape:
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
<up>
and<down>
keys onInsertEnter
. In insert mode, type:<c-o>:verbose imap <down>
.