Skip to content

Instantly share code, notes, and snippets.

@lmeadows
Created February 12, 2017 22:59
Show Gist options
  • Save lmeadows/a6a5e8409f25a9ee25222d56cf3849fe to your computer and use it in GitHub Desktop.
Save lmeadows/a6a5e8409f25a9ee25222d56cf3849fe to your computer and use it in GitHub Desktop.
my vimrc
set expandtab
set tabstop=4
set shiftwidth=4
set smarttab
set autoindent
set ruler
syntax on
autocmd BufNewFile,BufRead Gemfile,*.pp set filetype=ruby
autocmd BufNewFile,BufRead *.erb set filetype=eruby.html
autocmd BufNewFile,BufRead *.sls set filetype=yaml
autocmd BufNewFile,BufRead *.json set filetype=javascript
autocmd BufNewFile,BufRead *.jinja set filetype=jinja
" special rules by file type
autocmd Filetype yaml call SetYAMLOptions()
function SetYAMLOptions()
set tabstop=2
set shiftwidth=2
endfunction
autocmd Filetype html call SetHTMLOptions()
function SetHTMLOptions()
set tabstop=2
set shiftwidth=2
endfunction
autocmd Filetype sh call SetBASHOptions()
function SetBASHOptions()
set tabstop=2
set shiftwidth=2
endfunction
autocmd Filetype php call SetPHPOptions()
function SetPHPOptions()
set tabstop=4
set shiftwidth=4
set noexpandtab
endfunction
" nice formatting for text files
autocmd BufNewFile,BufRead *.txt set filetype=txt
autocmd FileType txt set wrap
autocmd FileType txt set linebreak
autocmd FileType txt set nolist
execute pathogen#infect()
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment