在我的 VIM 中,我所有的选项卡都是 2 个空格。但是当我推送到 github 时,它们被转换为 4 个空格。谁能帮我弄清楚如何防止它们转换为 4 个空格?
我的 vimrc 文件:
call pathogen#infect()
call pathogen#runtime_append_all_bundles()
" search
set hlsearch " highlight the search
set incsearch " incremental search
set ignorecase " search ignoring case
set showmatch " show matching bracket
" colors
set background=dark
let g:solarized_termcolors=8 " proper solarized coloring
colorscheme peachpuff
" syntax
syntax on
filetype on " Enable filetype detection
filetype plugin on " Enable filetype-specific plugins
filetype indent on " Enable filetype-specific indenting
set ruler " show the line number on the bar
set more " use more prompt
set autoread " watch for file changes
set number " line numbers
set hidden
set noautowrite " don't write old file out when switching files
set lazyredraw " don't redraw when don't have to
set showmode
set showcmd
set nocompatible " vim, not vi
set autoindent smartindent " auto/smart indent
set smarttab " tab and backspace are smart
set tabstop=2 " 6 spaces
set shiftwidth=2
set scrolloff=5 " keep at least 5 lines above/below
set sidescrolloff=5 " keep at least 5 lines left/right
set history=200
set backspace=indent,eol,start
set linebreak
set cmdheight=2 " command line two lines high
set undolevels=1000 " 1000 undos
set updatecount=100 " switch every 100 chars
set complete=.,w,b,u,U,t,i,d " do lots of scanning on tab completion
set ttyfast " we have a fast terminal
set noerrorbells " No error bells please
set shell=bash
set fileformats=unix
set ff=unix
set wildmode=longest:full
set wildmenu " menu has tab completion
set laststatus=2
set diffopt=filler,iwhite " ignore all whitespace and sync
" scss formatting
autocmd BufRead,BufNewFile *.scss ""set ft=scss.css
" jade formatting
autocmd BufRead,BufNewFile *.jade setlocal ft=jade noexpandtab
autocmd FileType jade :setlocal sw=2 ts=2 sts=2
autocmd VimEnter * NERDTree
autocmd VimEnter * wincmd p
autocmd Filetype javascript setlocal ts=2 sw=2 sts=0 noexpandtab