diff --git a/.vim/filetype.vim b/.vim/filetype.vim index 0d0b969..3d0b228 100644 --- a/.vim/filetype.vim +++ b/.vim/filetype.vim @@ -2,6 +2,7 @@ if exists("did\_load\_filetypes") finish endif +let b:auto_trim_whitespace=0 " Filetype mappingss augroup markdown au! BufRead,BufNewFile *.mkd setfiletype mkd @@ -18,6 +19,7 @@ augroup END augroup java autocmd BufRead *.java set efm=%A\ %#[javac]\ %f:%l:\ %m,%-Z\ %#[javac]\ %p^,%-C%.%# autocmd BufRead *.java set makeprg=ant\ -find\ build.xml + autocmd FileType java let b:auto_trim_whitespace=1 augroup END au BufNewFile,BufRead motd.public,/tmp/motd.public.r.* setf motd @@ -26,6 +28,7 @@ au Filetype html,xml,xsl source ~/.vim/closetag.vim au BufRead,BufNewFile *.go set filetype=go + "Settings per filetype augroup python "autocmd FileType python set omnifunc=pythoncomplete#Complete @@ -36,13 +39,14 @@ augroup python autocmd FileType python set shiftwidth=4 autocmd FileType python set expandtab autocmd FileType python set nosmartindent - + autocmd FileType python let b:auto_trim_whitespace=1 augroup END augroup javascript autocmd FileType javascript set ts=4 autocmd FileType javascript set softtabstop=4 autocmd FileType javascript set shiftwidth=4 autocmd FileType javascript set expandtab + autocmd FileType javascript let b:auto_trim_whitespace=1 augroup END augroup mkd @@ -54,3 +58,7 @@ augroup mediawiki autocmd BufRead,BufNewFile *.wikipedia.org* setfiletype mediawiki augroup END +autocmd FileType go let b:auto_trim_whitespace=1 +autocmd FileType cpp let b:auto_trim_whitespace=1 +autocmd FileType perl let b:auto_trim_whitespace=1 +autocmd FileType borg let b:auto_trim_whitespace=1 diff --git a/.vimrc b/.vimrc index ca99dc2..21e98e6 100644 --- a/.vimrc +++ b/.vimrc @@ -258,6 +258,15 @@ if g:google != 0 augroup filetypedetect au WinEnter,BufNewFile,BufRead * call HighlightTooLongLines() augroup END + if filereadable("/home/williasr/.vim.d/blaze.vim") + source /home/williasr/.vim.d/blaze.vim + " Load Blaze errors into quickfix mode + nmap bl :call LoadBlazeErrors():cc + " Run the most appropriate blaze command on the target for the current file. + nmap bb :call BlazeDwim() + " Run update_deps on the target for the current file. + nmap bu :call UpdateDepsDwim() + endif endif if filereadable("/home/build/nonconf/google3/tools/tags/gtags.vim") @@ -316,3 +325,12 @@ function! AutoHighlightToggle() endif endfunction +" Removes trailing spaces +function AutoTrimWhitespace() + if b:auto_trim_whitespace == 1 + %s/\s\+$//e + '' + endif +endfunction + +autocmd BufWritePre * :call AutoTrimWhitespace()