Number of spaces that a <Tab> in the file counts for.express
簡單來說就是一個tab製表位佔多少個空格。說白了就是一個「\t」等於多少個空格。默認值爲8。並且vim做者說了,通常要設置成8的,否則不少狀況下會出問題哦~編程
Number of spaces that a <Tab> counts for while performing editing operations, like inserting a <Tab> or using <BS>. It "feels" like <Tab>s are being inserted, while in fact a mix of spaces and <Tab>s is used. This is useful to keep the 'ts' setting at its standard value of 8, while being able to edit like it is set to 'sts'. However, commands like "x" still work on the actual characters. When 'sts' is zero, this feature is off. When 'sts' is negative, the value of 'shiftwidth' is used. 'softtabstop' is set to 0 when the 'paste' option is set. See also |ins-expandtab|. When 'expandtab' is not set, the number of spaces is minimized by using <Tab>s.vim
初看沒看明白…… 再看,app
Number of spaces to use for each step of (auto)indent. Used for |'cindent'|, |>>|, |<<|, etc. When zero the 'ts' value will be used. Use the |shiftwidth()| function to get the effective shiftwidth value.ide
增長、減小縮進或者是使用了自動縮進時使用此設置的值。默認值爲8。 4. expandtabflex
In Insert mode: Use the appropriate number of spaces to insert a <Tab>. Spaces are used in indents with the '>' and '<' commands and when 'autoindent' is on. To insert a real tab when 'expandtab' is on, use CTRL-V<Tab>. See also |:retab| and |ins-expandtab|.this
將tab自動轉換爲設定的空格數目。默認關閉。lua
There are four main ways to use tabs in Vim: 1. Always keep 'tabstop' at 8, set 'softtabstop' and 'shiftwidth' to 4 (or 3 or whatever you prefer) and use 'noexpandtab'. Then Vim will use a mix of tabs and spaces, but typing <Tab> and <BS> will behave like a tab appears every 4 (or 3) characters. 2. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use 'expandtab'. This way you will always insert spaces. The formatting will never be messed up when 'tabstop' is changed. 3. Set 'tabstop' and 'shiftwidth' to whatever you prefer and use a |modeline| to set these values when editing the file again. Only works when using Vim to edit the file. 4. Always set 'tabstop' and 'shiftwidth' to the same value, and 'noexpandtab'. This should then work (for initial indents only) for any tabstop setting that people use. It might be nice to have tabs after the first non-blank inserted as spaces if you do this though. Otherwise aligned comments will be wrong when 'tabstop' is changed.
Copy indent from current line when starting a new line (typing <CR> in Insert mode or when using the "o" or "O" command). If you do not type anything on the new line except <BS> or CTRL-D and then type <Esc>, CTRL-O or <CR>, the indent is deleted again.spa
簡單來說就是產生的新行的縮進值與上一行保持一致。code
An indent is automatically inserted:
在autoindent的基礎上更加smart了:對編程中{}的相關縮進作了較好的支持。
Enables automatic C program indenting.
對C程序適配的自動縮進。而且與「cinkeys」、「cinwords」、「cinoptions」配合產生效果。
Expression which is evaluated to obtain the proper indent for a line. It is used when a new line is created, for the |=| operator and in Insert mode as specified with the 'indentkeys' option. When this option is not empty, it overrules the 'cindent' and 'smartindent' indenting. When 'lisp' is set, this option is overridden by the Lisp indentation algorithm.
更加個性化的指定縮進的設置。還能夠用Lisp的縮進設置哦~
There are in fact four main methods available for indentation, each one overrides the previous if it is enabled, or non-empty for 'indentexpr': 'autoindent' uses the indent from the previous line. 'smartindent' is like 'autoindent' but also recognizes some C syntax to increase/reduce the indent where appropriate. 'cindent' Works more cleverly than the other two and is configurable to different indenting styles. 'indentexpr' The most flexible of all: Evaluates an expression to compute the indent of a line. When non-empty this method overrides the other ones. See |indent-expression|.