1
當我使用等號在vim中縮進文本時,它用3個空格縮進它。我需要4. 我試圖在.vimrc
文件中更改它的代碼(受我發現的一些示例的啓發,但它不起作用):Vim:如何將自動縮進(使用等號)設置爲4個空格?
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
set smartindent
set tabstop=4 " The width of a TAB is set to 4.
" Still it is a \t. It is just that
" Vim will interpret it to be having
" a width of 4.
set shiftwidth=4 " Indents will have a width of 4
set softtabstop=4 " Sets the number of columns for a TAB
set expandtab " Expand TABs to spaces
您知道如何將自動縮進(通過使用等號)更改爲4個空格嗎?非常感謝所有幫助
在許多文件中,一行的縮進取決於上面的行。你能舉一些例子文本和文件類型嗎? – Ben 2015-02-09 17:30:24
不要將縮進設置放在'〜/ .vimrc'文件中。它們是緩衝區本地設置,通常應通過filetype應用於每個緩衝區。而是在'〜/ .vim/after/ftplugin/python.vim'中把你的縮進設置放在'setlocal tabstop = 4'中。 – 2015-02-10 15:46:56