User Tools

Site Tools


vim:config:indentation:indentation_with_mixed_tabs_and_spaces

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
vim:config:indentation:indentation_with_mixed_tabs_and_spaces [2022/10/08 14:08] – created petervim:config:indentation:indentation_with_mixed_tabs_and_spaces [2022/10/08 14:12] (current) peter
Line 1: Line 1:
 ====== VIM - Config - Indentation - Indentation with mixed tabs and spaces ====== ====== VIM - Config - Indentation - Indentation with mixed tabs and spaces ======
  
 +To indent with mixed tabs and spaces.
 +
 +<code>
 +set shiftwidth=2
 +set softtabstop=2
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  These settings will result in a mix of tabs and spaces being used for indentation.
 +
 +  * The principle is to set **set shiftwidth** and **set softtabstop** to the same value, leave **expandtab** at its default (**noexpandtab**).
 +    * Usually, **tabstop** is left at its default value as well.
 +
 +  * **shiftwidth** affects what happens when you press **>>**, **<<** or **==**.
 +    * It also affects how automatic indentation works.
 +
 +  * **softtabstop** affects what happens when you press the **<TAB>** or **<BS>** keys.
 +    * Its default value is the same as the value of **tabstop**, but when using indentation without hard tabs or mixed indentation, you want to set it to the same value as **shiftwidth**.
 +    * If **expandtab** is unset, and **tabstop** is different from **softtabstop**, the **<TAB>** key will minimize the amount of spaces inserted by using multiples of TAB characters.
 +      * For instance, if **tabstop** is 8, and the amount of consecutive space inserted is 20, two TAB characters and four spaces will be used.
 +</WRAP>
 +
 +
 +----
vim/config/indentation/indentation_with_mixed_tabs_and_spaces.1665238095.txt.gz · Last modified: 2022/10/08 14:08 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki