Set tab width in VIM to 4 spaces or a single tab


Vim by default adds two tabs when you indent something. It also messes up the whole thing if you paste a large code block with tabs into it.

Here's how you can set the tabs to 4 space width, and fix that messing up issue.

Edit your vim config file and add this at the bottom of it.

vim ~/.vimrc

and add the following.

set tabstop=4

Now save and quit. Start vim to see that it now indents your code only by a single tab :)

11 comments :

  1. Congratulations on your article, it was very helpful and successful. 64adc8b64263b6e96d930cb2845e842f
    website kurma
    numara onay
    sms onay

    ReplyDelete
  2. Thank you for your explanation, very good content. 06d7972bace9e4c91c5856e90b829cea
    altın dedektörü

    ReplyDelete