-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Tools: Vim
If you are a vim user and you want to customise tabs and indentation, just read the following guide.
In order to customise your vim configuration, you'll need to modify the file .vimrc in your home directory. If this file does not already exist, you just need to create it.
Don't put anything in your .vimrc you don't understand!
To customise tabs length, you can add the following line to your ~/.vimrc:
set tabstop=8 shiftwidth=8Here, the size of a tab character in Vim is set to 8, so Vim will display 8 spaces on your screen to represent a single tab. You can modify this value, to put a smaller one if you want, but just keep in mind that it's a good habit to keep an indentation of 8 columns: it makes your code more readable.
To indent automatically a line depending on the previous one when you hit Enter, just add the following line to your .vimrc:
set autoindentYou can also use intelligent indentation for C code with Vim:
set smartindent
set cindentYou can enable syntax highlighting in Vim by adding the following rule in your .vimrc:
syntax enableYou can display the current line and column in Vim with the following rule:
set number0.1 - Betty-style usage
0.2 - Betty-doc usage
0.3 - References
1.1 - Indentation
1.2 - Breaking long lines and strings
1.3 - Placing Braces
1.4 - Placing Spaces
1.5 - Naming
1.6 - Functions
1.7 - Commenting
1.8 - Macros and Enums
1.9 - Header files
2.1 - Functions
2.2 - Data structures
3.1 - Emacs
3.2 - Vim
3.3 - Atom