3

I want to replace the default behavior of the arrows in insert mode, so that they behave like gk and gj, I have used:

inoremap <up> <Esc>gka
inoremap <down> <Esc>gja

But this doesn't hold the cursor well. What's the right way to do it?

urely
  • 31
  • 2
  • are you really using the - in your mappings or is that a typo? 2) What do you mean by this doesn't hold the cursor well? What is the actual behavior vs. the expected behavior? 3) Have you read How to debug a mapping it could be useful
  • – statox Jan 15 '20 at 17:56
  • @statox Oh, I'm sorry. I corrected it, no -. What I mean is that originally when you press up/down in insert mode the cursor moves over a column and when it passes over an empty or shorter line, it positions itself at the end of the column, but when it continues to move and finds a line with enough length, it remains over the same column. – urely Jan 15 '20 at 18:14