Tabs and spaces in vim

前端 未结 6 1131
生来不讨喜
生来不讨喜 2021-01-29 18:07

How do I prevent vim from replacing spaces with tabs when autoindent is on?

An example: if I have two tabs and 7 spaces in the beginning of the line, and tabstop=3

6条回答
  •  迷失自我
    2021-01-29 18:41

    Maybe the bottom of this can help you?

    Standard vi interprets the tab key literally, but there are popular vi-derived alternatives that are smarter, like vim. To get vim to interpret tab as an ``indent'' command instead of an insert-a-tab command, do this:

    set softtabstop=2
    

提交回复
热议问题