2

When in visual mode you can select the new line character. E.g.:

The quick brown fox jumps over the lazy dog.⏎

In visual mode you can select both the period and the (invisible) carriage return, or even just the carriage return (if you delete it you'll join the current and the next lines).

In normal mode, on the other hand, I can't get the cursor on top of that character, which really annoys me. Every now and then I want to select some text including the new line before it. So I have to go to visual mode, select what I want and then type o and go back a character to select the new line. It would be a lot better if I could have the cursor on the new line to begin with, so I'd just go into visual mode and select what I want.

Any ideas on how to make that happen?

6

If you simply want the cursor to be able to go one past the end of the line for the purpose of starting visual mode, you want the setting set virtualedit=onemore (see :help 've). However, this does not let you remove the new line character in normal mode (in vim you usually use J to do this).

4

You can use 'virtualedit' for this:

:set virtualedit=onemore

Note however the warnings in :help 'virtualedit':

"onemore" is not the same, it will only allow moving the cursor just after the last character of the line. This makes some commands more consistent. Previously the cursor was always past the end of the line if the line was empty. But it is far from Vi compatible. It may also break some plugins or Vim scripts. For example because |l| can move the cursor after the last character. Use with care!

  • I accepted the other answer because it was posted 19 seconds before yours, haha, sorry. But thanks! – dbmrq Dec 7 '17 at 18:01
  • 1
    @dbmrq Haha. I knew I shouldn't have wasted time pasting in the info from :help! – Rich Dec 7 '17 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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