2013-09-14 14:35:23 +02:00
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
" Filename: .vimrc "
|
|
|
|
|
" Maintainer: Michael J. Smalley <michaeljsmalley@gmail.com> "
|
|
|
|
|
" URL: http://github.com/michaeljsmalley/dotfiles "
|
|
|
|
|
" "
|
|
|
|
|
" "
|
|
|
|
|
" Sections: "
|
|
|
|
|
" 01. General ................. General Vim behavior "
|
|
|
|
|
" 02. Events .................. General autocmd events "
|
|
|
|
|
" 03. Theme/Colors ............ Colors, fonts, etc. "
|
|
|
|
|
" 04. Vim UI .................. User interface behavior "
|
|
|
|
|
" 05. Text Formatting/Layout .. Text, tab, indentation related "
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
" 01. General "
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
set nocompatible " get rid of Vi compatibility mode. SET FIRST!
|
|
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
" 02. Events "
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
filetype plugin indent on " filetype detection[ON] plugin[ON] indent[ON]
|
|
|
|
|
|
|
|
|
|
" In Makefiles DO NOT use spaces instead of tabs
|
|
|
|
|
autocmd FileType make setlocal noexpandtab
|
|
|
|
|
" In Ruby files, use 2 spaces instead of 4 for tabs
|
|
|
|
|
autocmd FileType ruby setlocal sw=2 ts=2 sts=2
|
|
|
|
|
|
|
|
|
|
" Enable omnicompletion (to use, hold Ctrl+X then Ctrl+O while in Insert mode.
|
|
|
|
|
set ofu=syntaxcomplete#Complete
|
|
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
" 03. Theme/Colors "
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
set t_Co=256 " enable 256-color mode.
|
|
|
|
|
syntax enable " enable syntax highlighting (previously syntax on).
|
|
|
|
|
"colorscheme molokai " set colorscheme
|
|
|
|
|
|
|
|
|
|
" Prettify JSON files
|
|
|
|
|
autocmd BufRead,BufNewFile *.json set filetype=json
|
|
|
|
|
autocmd Syntax json sou ~/.vim/syntax/json.vim
|
|
|
|
|
|
|
|
|
|
" Prettify Vagrantfile
|
|
|
|
|
autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby
|
|
|
|
|
|
|
|
|
|
" Highlight characters that go over 80 columns
|
|
|
|
|
highlight OverLength ctermbg=red ctermfg=white guibg=#592929
|
|
|
|
|
match OverLength /\%81v.\+/
|
|
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
" 04. Vim UI "
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
set number " show line numbers
|
|
|
|
|
set cul " highlight current line
|
|
|
|
|
set laststatus=2 " last window always has a statusline
|
|
|
|
|
set nohlsearch " Don't continue to highlight searched phrases.
|
|
|
|
|
set incsearch " But do highlight as you type your search.
|
|
|
|
|
set ignorecase " Make searches case-insensitive.
|
|
|
|
|
set ruler " Always show info along bottom.
|
|
|
|
|
set showmatch
|
|
|
|
|
set statusline=%<%f\%h%m%r%=%-20.(line=%l\ \ col=%c%V\ \ totlin=%L%)\ \ \%h%m%r%=%-40(bytval=0x%B,%n%Y%)\%P
|
|
|
|
|
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
" 05. Text Formatting/Layout "
|
|
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
|
|
|
|
set autoindent " auto-indent
|
|
|
|
|
set tabstop=4 " tab spacing
|
|
|
|
|
set softtabstop=4 " unify
|
|
|
|
|
set shiftwidth=4 " indent/outdent by 4 columns
|
|
|
|
|
set shiftround " always indent/outdent to the nearest tabstop
|
|
|
|
|
set expandtab " use spaces instead of tabs
|
|
|
|
|
set smarttab " use tabs at the start of a line, spaces elsewhere
|
|
|
|
|
set nowrap " don't wrap text
|
2013-09-15 21:04:27 +02:00
|
|
|
|
|
|
|
|
match ErrorMsg '\s\+$' " mark trailing whitespace
|
|
|
|
|
|
|
|
|
|
" Removes trailing spaces
|
|
|
|
|
function! TrimWhiteSpace()
|
|
|
|
|
%s/\s\+$//e
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
autocmd FileWritePre * :call TrimWhiteSpace()
|
|
|
|
|
autocmd FileAppendPre * :call TrimWhiteSpace()
|
|
|
|
|
autocmd FilterWritePre * :call TrimWhiteSpace()
|
|
|
|
|
autocmd BufWritePre * :call TrimWhiteSpace()
|