LoginSignup
14
13

More than 5 years have passed since last update.

vimでファイルの拡張子に応じてタブ幅を変更する

Last updated at Posted at 2013-03-24

~/.vim/filetype.vim へ以下の様に記述する。

if exists("did_load_filetypes")
  finish
endif
augroup filetypedetect
  " Cのタブ幅は4で
  au BufNewFile,BufRead *.c    setlocal tabstop=4 shiftwidth=4
  au BufNewFile,BufRead *.cpp  setlocal tabstop=4 shiftwidth=4
  au BufNewFile,BufRead *.h    setlocal tabstop=4 shiftwidth=4
augroup END

if exists("did_load_filetypes") のあたりの理解があやふやだけど、今日はここまで。

参考

14
13
7

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13