Reputation: 12051
I have a bad habit of pressing the Return immediately after pressing the i key, when the o key would save keystrokes. I would like to disable the i-Return combination to help me break this habit.
I tried to add
imap <Return> <NOP>
to my ~/.config/nvim/init.vim
, but this disables pressing it in insert mode entirely. Is there a way to disable it only upon immediately entering insert mode?
Upvotes: 0
Views: 78
Reputation: 172590
How about this combo:
nnoremap <silent> i<CR> :echoerr "Use o instead"<CR>
This will issue the error only if you press both i
and <Enter>
within 'timeoutline'
(default one second).
Upvotes: 3