Skip to content

Instantly share code, notes, and snippets.

@paulevans
Forked from lmeadows/.vimrc
Created February 13, 2017 05:46
Show Gist options
  • Save paulevans/21b3b92a8fe7f637e2ad16487c2a60ee to your computer and use it in GitHub Desktop.
Save paulevans/21b3b92a8fe7f637e2ad16487c2a60ee 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