I am learning to configure the macvim.
Now my tab indent is 4 character, I want to change it to 2. What should I add to the macvim configure file?
Is there any beginner guide for me to learn configure mac vim?
As for tabs, there are two settings. Within Vim, type a colon and then "set tabstop=4" which will set the tabs to display as four spaces. Hit colon again and type "set expandtab" which will insert spaces for tabs.
If you first enter SHIFT-V, and than shift+arrows to select the text, it will indent. You can also use SHIFT-V, and use 'hjkl' to select the block.
To easily change a tab-based indent to use spaces instead when 'noexpandtab' is set, you can temporarily set 'expandtab' and use :retab with a range. For example, to convert only the current line to use spaces, use :. retab .
Open your $HOME/.vimrc file in MacVim,
:edit $MYVIMRC
write the following lines,
set tabstop=2
set shiftwidth=2
and save.
:wq
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With