I'm a user of the surround.vim plugin that lets me surround words with quotes, brackets, etc.

I'm facing an issue with surrounding a single character with e.g. quotes, when the character is adjacent to other characters. Thus, I cannot use ysw" to quote the single character.

How can I operate on a single character? I'm used to using x to delete a single character, but I'm not familiar with a motion like w that describes a single character.


2 Answers 2


Faster than visual mode: ysl"

You can use both text-objects and motions with any operator, and hjkl are motions!

Note that according to :help x, the command x is equivalent to dl, while X is equivalent to dh. They have a kind of paradoxical definition that turns out to be nicely intuitive in practice.

The reason they work this is both are exclusive motions, which means the last character of the selection is not included. This "last character" is always determined relative to the buffer end: in other words, characters closer to G$ are "later" than characters closer to gg0! So yl will only yank the character you're on, while yh yanks the previous character. This holds for any operator, including the surround version given at the top.

  • Thank you, but shouldn’t l affect the next character and not the character under the cursor?
    – Shuzheng
    Commented Feb 18, 2020 at 16:12
  • Press vl and realize that the character under the cursor is highlighted; l in this case is a sort of exclusive motion that includes only the current char. In fact, x is equivalent to dl
    – D. Ben Knoble
    Commented Feb 18, 2020 at 16:52
  • Shouldn’t dh be equivalent to dl then?
    – Shuzheng
    Commented Feb 18, 2020 at 19:33
  • @Shuzheng i’m sure, but (somewhat paradoxically) I wouldnt expect so: probably equivalent to X
    – D. Ben Knoble
    Commented Feb 18, 2020 at 19:34
  • @Shuzheng i just checked the docs and confirmed my above comment.
    – D. Ben Knoble
    Commented Feb 18, 2020 at 19:46

S in visual mode with an argument wraps the selected text. So:

  1. Put your cursor on the character you want to quote.
  2. Press v to select it.
  3. Press S" to quoto.
  • how did you get so good at vim?
    – MCI
    Commented Aug 14, 2020 at 1:22

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.