I have the following setting on:

set ve+=onemore "allows us to go one-past the last character, emulating ctrl-e in normal programs

This is helpful for a lot of navigations and other commands I use. However, when I use vim-surround and highlight an entire line (for example, doing ShiftV), it ends up going to the next line in surround:

enter image description here

Is there a way to customize or apply an option to vim-surround such that when highlighting a line, it doesn't continue onto the next? Note: this is fixed, when I do something like V$h to compensate for the "onemore" option, but this is quite annoying to have to do everytime. What might be a better way?

1 Answer 1


I use yss more often than VS; however, even without onemore set, I get this behavior. From :help surround:

In visual mode, a simple "S" with an argument wraps the selection.  This is
referred to as the *vS* mapping, although ordinarily there will be
additional keystrokes between the v and S.  In linewise visual mode, the
surroundings are placed on separate lines and indented.  In blockwise visual
mode, each line is surrounded.

yss won't do this and is easier to type.

  • @D -- I see, but that grabs the full-line instead of often I'll just want to do something until the end of the line. Here's an example with css: gyazo.com/59d16ac11e3144bfb3ca2e300e509054.
    – David542
    Commented Jun 1, 2020 at 22:34
  • 1
    If you need to end of line, you're stuck with, e.g., ys$ @David542
    – D. Ben Knoble
    Commented Jun 1, 2020 at 22:36
  • @D -- that works. Is there a way to do that in visual mode too (non linewise), here's an example of what I mean (though note I'm using the h after going to the end of the line): gyazo.com/4e0724bdc9070d6d2127cb6a10efc8fc.
    – David542
    Commented Jun 1, 2020 at 22:40
  • 1
    I just tried your example (set ve=onemore, then select v$ and type S"), and I got the "expected" behavior sans h (that is, it surrounded what I expected to, despite the wonky visual selection)
    – D. Ben Knoble
    Commented Jun 1, 2020 at 22:48
  • Hmm...in that case, is there a way when I press S that if in the visual mode and I'm to to-the-right of the last \S character, that it does an h automatically. to move me over to the last character?
    – David542
    Commented Jun 1, 2020 at 23:01

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.