ljs.dev
ljs.dev

Reputation: 4483

Vim delete visual selection and switch to insert mode

I often find myself doing a visual selection, then hitting d or x to delete and switching to Insert mode with i.

Is there a single keystroke that will delete the current visual selection and put me in Insert mode?

Upvotes: 2

Views: 1661

Answers (3)

Kent
Kent

Reputation: 195029

The vim help just answers your question exactly:

{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}

                            *v_r*
{Visual}["x]r{char} Replace all selected characters by {char}.

                            *v_C*
{Visual}["x]C       Delete the highlighted lines [into register x] and
            start insert.  In Visual block mode it works
            differently |v_b_C|.  {not in Vi}
                            *v_S*
{Visual}["x]S       Delete the highlighted lines [into register x] and
            start insert (for {Visual} see |Visual-mode|).  {not
            in Vi}
                            *v_R*
{Visual}["x]R       Currently just like {Visual}["x]S.  In a next version
            it might work differently. {not in Vi}

I would remind the surround plugin users, with its default mapping, it overwrites the {visual}S.

Upvotes: 3

Christian Brabandt
Christian Brabandt

Reputation: 8248

Use c or s to change the text and remain in insert mode

Upvotes: 8

YXD
YXD

Reputation: 32511

I think you just want to press s

Upvotes: 7

Related Questions