User Tools

Site Tools


vim:config:indentation:indentation_with_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_spaces [2022/10/08 13:57] – created petervim:config:indentation:indentation_with_spaces [2022/10/08 14:02] (current) peter
Line 1: Line 1:
 ====== VIM - Config - Indentation - Indentation with spaces ====== ====== VIM - Config - Indentation - Indentation with spaces ======
 +
 +To indent with only spaces, and not with tabs.
 +
 +<code>
 +set expandtab
 +set shiftwidth=2
 +set softtabstop=2
 +</code>
 +
 +<WRAP info>
 +**NOTE:**  These settings will result in spaces being used for all indentation.
 +
 +  * The principle is to set **expandtab**, and **set shiftwidth** and **set softtabstop** to the same value, while leaving **tabstop** at its default value.
 +
 +  * **expandtab** affects what happens when you press the **<TAB>** key.
 +    * If **expandtab** is set, pressing the **<TAB>** key will always insert **softtabstop** amount of space characters.
 +    * Otherwise, the amount of spaces inserted is minimized by using TAB characters.
 +
 +  * **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_spaces.1665237423.txt.gz · Last modified: 2022/10/08 13:57 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki