2

I would like to use 4 spaces for each tab in files in python, c++, and others, but I would like to set it to 2 spaces in javascript and typescript files. Is there a way to do customize it in vimrc?

set tabstop=4 softtabstop=4 shiftwidth=4 " while using py, cpp and others
set tabstop=2 softtabstop=2 shiftwidth=2 " while using js, ts 

What I did is manually change the code above. If I am writing python, I change it to 4 and when I am writing javascript, I change it to 2.

Update: Solved, feel free to check Setting Vim whitespace preferences by filetype

Amos Tan
  • 31
  • 4

0 Answers0