Tuesday, April 9, 2013

Problem with Visual selection on an empty line

When a "v" Visual selection ends on an empty line it will also delete
the newline and join the next line. Is there a way to avoid this?

Here's an example text with the cursor on b:

abc
d
xyz

Now pressing vj and then d results in:

axyz

I would not have expected line 3 joined to line 1 but I can see that
it's because I also deleted the newline on line 2. Thus I can simply use
h to exclude the newline. Same situation, pressing vjhd gives:

a
xyz

But what if the line between abc and xyz is empty?

abc

xyz

Now vjd will always result in:

axyz

But I don't like this, it goes against my intuition. Is there a way to
tell Vim not to include the newline character in the Visual selection,
so that I get the same result as with vjhd?

Thanks.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: