Tabs and spaces in vim

前端 未结 6 1204
生来不讨喜
生来不讨喜 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:59

    Here's part of my .vimrc:

    set autoindent
    set expandtab
    set softtabstop=4
    set shiftwidth=4
    

    This works well for me because I absolutely do not want tabs in my source code. It seems from your question that you do want to keep two tabs and seven spaces on the next line, and I'm not sure there's a way to teach vim to accommodate that style.

提交回复
热议问题