What is the intended use case for the s command in normal mode?
I've been looking at it for some time, inadvertently pressing s, but can't find any use case that would make sense for me.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityWhat is the intended use case for the s command in normal mode?
I've been looking at it for some time, inadvertently pressing s, but can't find any use case that would make sense for me.
I don't think there's a more specific use mode than to delete the character under the cursor and enter insert mode. By using a number modifier you can delete several characters before entering insert mode. E.g. if you want to change foobar
into fubar
, then I would set to cursor to f
, and press 3sfu
. Of course, you don't need to use s
, you could also do e.g. ctbu
. I guess you can always get away without using s
. That being said, I use s
very often.
s
that way because I don't like moving too often that far up the keyboard for editing stuff. I would use c
for that. That being said, I was wondering if there's some other intended use case. It just fells against the vim way I got used to.
– Dumitru
Mar 29 '17 at 11:12
s
is short for cl
which is mentioned in help s
:
["x]s Delete [count] characters [into register x] and start
insert (s stands for Substitute). Synonym for "cl"
(not linewise).
I've mapped s
to my own command and haven't missed the default 'substitute' so far.