2011-09-21 08:26:27 +10:00
|
|
|
" Source vimrc after saving it
|
|
|
|
autocmd! BufWritePost .vimrc,vimrc source $MYVIMRC | NERDTreeToggle | NERDTreeToggle
|
|
|
|
|
|
|
|
" Auto save files on window blur
|
2011-10-24 11:00:30 +11:00
|
|
|
autocmd! FocusLost * :silent! up
|
2011-09-21 08:26:27 +10:00
|
|
|
|
|
|
|
" make and python use real tabs
|
|
|
|
au! FileType make set noexpandtab
|
|
|
|
au! FileType python set noexpandtab
|
|
|
|
|
|
|
|
au! FileType scss syntax cluster sassCssAttributes add=@cssColors
|
|
|
|
|
|
|
|
" Thorfile, Rakefile and Gemfile are Ruby
|
|
|
|
au! BufRead,BufNewFile {Gemfile,Rakefile,Thorfile,config.ru} set ft=ruby
|
|
|
|
|
|
|
|
au! BufRead,BufNewFile gitconfig set ft=gitconfig
|
2011-12-28 09:42:45 +11:00
|
|
|
|
2012-03-29 01:18:53 +11:00
|
|
|
" Attempted fix for Vim losing mouse support when inside Tmux
|
|
|
|
au! TermResponse,CursorHold,CursorHoldI * set ttymouse=xterm2
|
|
|
|
|
2011-12-28 09:42:45 +11:00
|
|
|
function! <SID>StripTrailingWhitespaces()
|
|
|
|
" Preparation: save last search, and cursor position.
|
|
|
|
let _s=@/
|
|
|
|
let l = line(".")
|
|
|
|
let c = col(".")
|
|
|
|
" Do the business:
|
|
|
|
%s/\s\+$//e
|
|
|
|
" Clean up: restore previous search history, and cursor position
|
|
|
|
let @/=_s
|
|
|
|
call cursor(l, c)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" Strip trailing whitespace on save
|
|
|
|
autocmd! BufWritePre * :call <SID>StripTrailingWhitespaces()
|
|
|
|
|
|
|
|
" Strip trailing whitespace on command
|
|
|
|
nmap <Leader>sw :call <SID>StripTrailingWhitespaces()<CR>
|
|
|
|
|
|
|
|
|