3

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.

4

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.

  • 1
    I use it to avoid "delete something then enter insert" separately. It's nice to be able to hit v for highlight, then 4e to highlight 4 words, then hit s and start typing. – user859 Mar 29 '17 at 10:43
  • 1
    I don't use 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
  • 1
    @Dumitru Can you touch type numbers? Cause that's the only reason I see to "don't like moving too ofthen that far up the keyboard". – user1685095 Mar 30 '17 at 21:32
  • @user1685095, Yeah, I can. What do you mean with the only reason? The inability or the ability? – Dumitru Mar 30 '17 at 21:50
  • @Dumitru Inability. – user1685095 Mar 30 '17 at 21:53
2

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.