Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change default indent in macvim?

Tags:

macvim

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?

like image 972
mko Avatar asked Feb 24 '11 05:02

mko


People also ask

How do I set VI tab to 4 spaces?

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.

How do you indent in Gvim?

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.

How do I use spaces instead of tabs in Vim?

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 .


1 Answers

Open your $HOME/.vimrc file in MacVim,

:edit $MYVIMRC

write the following lines,

set tabstop=2
set shiftwidth=2

and save.

:wq
like image 178
Kazuki Sakamoto Avatar answered Nov 11 '22 14:11

Kazuki Sakamoto