0

On my machine, mapping Ctrl ends up deleting lines in both insert as well as normal mode. I tried to find where exactly these mappings were being sourced from:

I tried: :verbose map <C-Left>, :verbose imap <C-Left> and :verbose nmap <C-Left> and all of them returned No mapping found. If no mapping was found, why does any change occur to the buffer at all on issuing this sequence of key strokes?

How can I find out the source of this action for the keyboard shortcut?


As suggested in the comments, abc|def (cursor after c in insert mode) followed by CtrlvCtrl ends up giving: abc^[[1;5Ddef

2 Answers 2

1

For starters…

  • Vim has commands, not "shortcuts".
  • Those commands are not "mappings".

Exceptions: built-in plugins provide mappings and menus are implemented via mappings.

Now…

:help <c-left tells you that it is synonymous with b in normal mode, and :help i_<c-left tells you that it moves the cursor back one word. None of that should delete lines.

But…

<Left> being synonymous with h and <C-h> being the control code for "backspace", it is possible that Vim is confused by the keys it receives from the terminal.

In insert mode, what do you get if you press <C-v> and then <C-Left>?

1
  • Thank you for the syntax and your help. I was trying :help CTRL-<Left> (based on my understanding of the answer vi.stackexchange.com/a/6886/31759) and vim stated that there was no help available for that. I have updated my OP with the response to your question.
    – Tryer
    Dec 8, 2022 at 6:33
0

had the same issue and so far I could not figure out why it happens, but according to https://github.com/vim/vim/issues/9059 there is a workaround by adding this to your .vimrc:

nnoremap <Esc>[1;5C <C-Right>
nnoremap <Esc>[1;5D <C-Left>
inoremap <Esc>[1;5C <C-Right>
inoremap <Esc>[1;5D <C-Left>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.