automorphic
automorphic

Reputation: 800

Vim 's' Key Broken

s in command mode normally deletes the character under the cursor and enters Insert mode. But typing s now opens a prompt like this (in the lower-left corner)

>

instead of the usual substitution mode.

What I checked:

    x  s             <Plug>Sneak_s
    n  s             <Plug>Sneak_s

Is that remapping x-s or s?

What could cause this behavior?

Edit: I am using the vundle plugin manager. And removing this line from .vimrc solves the problem.

call vundle#end()

Isn't that required?

Edit 2: As @yolenoyer notes, the vundle#end() is required, or all plugins are disabled. Using that advice, narrows it down to the vim-sneak plugin which even says in it's documentation:

How dare you remap s?

Upvotes: 1

Views: 945

Answers (2)

yolenoyer
yolenoyer

Reputation: 9445

  • I don't see any other way than mapping to alter the behaviour of s normal command. Are you really sure there's no mapping? Please check again your mappings, by running the following command:

    :map s
    
  • Don't remove the call vundle#end() line in your .vimrc : it will disable all the plugins you installed.

    Instead, try to comment each plugin listed just before this line (lines beginning with Plugin), each time launching vim again to check if the behaviour changed.

Some clarification about modes

When you type s in normal mode, you don't enter in any 'substitution' mode, but in insert mode after having deleted one (or more) char(s) in front of the cursor.

The confusion you make by using the word 'substitution' (in your title and your question content) is problematic because it makes people think you're talking about the :s command (which can be really called ... the substitute command!)

Upvotes: 1

Pejman
Pejman

Reputation: 1358

Vim's search and replace (substitute) does not require any additional module or mapping in .vimrc. You can simply use :%s/foo/bar/g to replace any instance of foo with bar. For more information checkout here.

Note that substitute command s without : (normal command) which may be prefixed with a number x, deletes x characters and switches to insert mode.

Upvotes: 0

Related Questions