How to insert tab character when expandtab option is on in Vim

后端 未结 3 1628
孤街浪徒
孤街浪徒 2021-01-29 17:14

When I\'m in insert mode and I have the expandtab option switched on, pressing Tab ↹ results in inserting the configured number of spaces.

But occasionally I

3条回答
  •  你的背包
    2021-01-29 17:49

    From the documentation on expandtab:

    To insert a real tab when expandtab is on, use CTRL-V. See also :retab and ins-expandtab.
    This option is reset when the paste option is set and restored when the paste option is reset.

    So if you have a mapping for toggling the paste option, e.g.

    set pastetoggle=
    

    you could also do Tab.

提交回复
热议问题