0

I added the following command to my .vimrc, which is designed to insert a blank line below the cursor

nnoremap <leader>o mzo<esc>`z 

The sequence of this command is

  • mark the cursor position
  • use the o command to create a new line
  • use the escape key to go back to normal mode
  • move the cursor back to its original marked position

However, after executing this command, the cursor ends up one character to the right of where it started. Why doesn't the cursor return to its original position?

1 Answer 1

0

There was one character of trailing whitespace at the end of the command, which had the effect of moving the cursor one character to the right (since the space bar moves the cursor to the right in normal mode).

Your Answer

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

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