Vim delete visual selection and switch to insert mode

你。 提交于 2019-12-04 14:40:48

问题


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?


回答1:


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




回答2:


I think you just want to press s




回答3:


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.



来源:https://stackoverflow.com/questions/19305556/vim-delete-visual-selection-and-switch-to-insert-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!