9

I have downloaded a new version of Tim Pope's surround plugin. I noticed he deprecated 's' in favor of uppercase 'S'.

He said this was to prevent interference with a lot of Vim user's muscle memory for hitting lower-case 's' in visual mode. I did some googling but I can't seem to find what exactly this does?

I'd like to know, just in case there is a good bit of info I should know about that key combo :)

Tallboy
  • 12,847
  • 13
  • 82
  • 173

2 Answers2

10

As described in the Vim manual:

{Visual}["x]c or v_c v_s {Visual}["x]s Delete the highlighted text [into register x] and start insert (for {Visual} see Visual-mode). {not in Vi}

So both c and s do the same thing in visual mode.

Also, in general, if you want to know what a key does in something other than normal mode, just prefix the key with the first letter of the mode and a underscore.

For example:

:help v_s

to find out what the s key does in visual mode.

rjk
  • 1,462
  • 9
  • 11
2

s does the same thing as x then i

essentially deleting the currently highlighted character(s) then entering insert mode

g19fanatic
  • 10,567
  • 6
  • 33
  • 63
  • thank you. some of this still confuses me, i dont see how that's different from just hitting c... maybe it has to do with my vim config – Tallboy May 04 '12 at 19:30
  • `s` works character-wise, whereas `c` modifies a motion command. – Prince Goulash May 04 '12 at 20:03
  • 1
    Wow, thanks for a great new shortcut! To me _s_ now represents the fastest way to modify camel case variable names! For example: I will now use s to change camelCaseWord to funkyCamelCaseWord! – jahroy May 04 '12 at 20:58