forked from jceb/vimrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto_commands.vim
48 lines (40 loc) · 2.04 KB
/
auto_commands.vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
" Autocommands:
" -------------
if has("autocmd")
augroup filetypesettings
autocmd!
au FileType debchangelog setlocal shiftwidth=2 expandtab spell spelllang=en
au FileType tex,plaintex setlocal makeprg=pdflatex\ \"%:p\"
au FileType java,c,cpp setlocal noexpandtab nosmarttab
au FileType mail setlocal textwidth=72 formatoptions=ltcrqna comments+=b:-- spell spelllang=de
au FileType mail call formatmail#FormatMail()
au FileType txt setlocal formatoptions=ltcrqn textwidth=72
au FileType asciidoc,mkd,tex setlocal formatoptions=ltcrqn textwidth=72
au FileType xml,docbk,xhtml,jsp setlocal formatoptions=lcrq
au FileType ruby setlocal shiftwidth=2
au FileType help setlocal nolist textwidth=0
au FileType org setlocal foldminlines=0 foldlevel=1
au BufReadPost,BufNewFile * setlocal formatoptions-=o " o is really annoying
" Special handling of Makefiles
au FileType automake,make setlocal list noexpandtab
" insert a prompt for every changed file in the commit message
"au FileType svn :1![ -f "%" ] && awk '/^[MDA]/ { print $2 ":\n - " }' %
augroup END
augroup hooks
autocmd!
" line highlighting in insert mode
autocmd InsertLeave * setlocal nocul
autocmd InsertEnter * setlocal cul
" move to the directory of the edited file
"au BufEnter * if isdirectory (expand ('%:p:h')) | cd %:p:h | endif
" jump to last position in the file
"au BufReadPost * if expand('%') !~ '^\[Lusty' && &buftype == '' && &modifiable == 1 && &buflisted == 1 && line("'\"") > 1 && line("'\"") <= line("$") && &filetype != "mail" | exe "normal g`\"" | endif
"au BufWinEnter * if line("'x") > 0 && line("'x") <= line("$") && line("'y") > 0 && line("'y") <= line("$") && &filetype != "mail" | exe "normal g'yztg`x" | endif
"au BufWinLeave * if expand('%') !~ '^\[Lusty' && &buftype == '' && &buflisted == 1 && &modifiable == 1 | exec "normal mxHmy" | endif
augroup END
"augroup highlight
" autocmd!
" " make visual mode dark cyan
" au FileType * hi Visual ctermfg=Black ctermbg=DarkCyan gui=bold guibg=#a6caf0
"augroup END
endif