forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetype.vim
127 lines (95 loc) · 3.07 KB
/
filetype.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
" File Types
"-------------------------------------------------
" Reload vim config automatically {{{
execute 'autocmd MyAutoCmd BufWritePost '.$VIMPATH.'/config/*,vimrc nested'
\ .' source $MYVIMRC | redraw | silent doautocmd ColorScheme'
" }}}
augroup MyAutoCmd " {{{
" Highlight current line only on focused window
autocmd WinEnter,InsertLeave * set cursorline
autocmd WinLeave,InsertEnter * set nocursorline
" Automatically set read-only for files being edited elsewhere
autocmd SwapExists * nested let v:swapchoice = 'o'
" Check if file changed when its window is focus, more eager than 'autoread'
autocmd WinEnter,FocusGained * checktime
autocmd Syntax * if 5000 < line('$') | syntax sync minlines=200 | endif
" Update filetype on save if empty
autocmd BufWritePost * nested
\ if &l:filetype ==# '' || exists('b:ftdetect')
\ | unlet! b:ftdetect
\ | filetype detect
\ | endif
" Reload Vim script automatically if setlocal autoread
autocmd BufWritePost,FileWritePost *.vim nested
\ if &l:autoread > 0 | source <afile> |
\ echo 'source '.bufname('%') |
\ endif
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
autocmd BufReadPost *
\ if &ft !~ '^git\c' && ! &diff && line("'\"") > 0 && line("'\"") <= line("$")
\| execute 'normal! g`"zvzz'
\| endif
autocmd TabLeave * let g:lasttab = tabpagenr()
autocmd FileType crontab setlocal nobackup nowritebackup
autocmd FileType yaml.docker-compose setlocal expandtab
autocmd FileType gitcommit setlocal spell
autocmd FileType gitcommit,qfreplace setlocal nofoldenable
autocmd FileType zsh setlocal foldenable foldmethod=marker
autocmd FileType html
\ setlocal path+=./;/
\ | setlocal equalprg=tidy\ -i\ -q
" autocmd FileType json setlocal equalprg=jsonlint
autocmd FileType markdown
\ set expandtab
\ | setlocal autoindent formatoptions=tcroqn2 comments=n:>
\ | setlocal spell conceallevel=0
autocmd FileType apache setlocal path+=./;/
autocmd FileType cam setlocal nonumber synmaxcol=10000
" autocmd FileType go highlight default link goErr WarningMsg |
" \ match goErr /\<err\>/
autocmd FileType xml
\ setlocal equalprg=xmllint\ --format\ --recover\ -\ 2>/dev/null
augroup END " }}}
" Internal Plugin Settings {{{
" ------------------------
" Python {{{
let g:python_highlight_all = 1
" }}}
" Vim {{{
let g:vimsyntax_noerror = 1
let g:vim_indent_cont = &shiftwidth
" }}}
" Bash {{{
let g:is_bash = 1
" }}}
" Java {{{
let g:java_highlight_functions = 'style'
let g:java_highlight_all = 1
let g:java_highlight_debug = 1
let g:java_allow_cpp_keywords = 1
let g:java_space_errors = 1
let g:java_highlight_functions = 1
" }}}
" Markdown {{{
let g:markdown_fenced_languages = [
\ 'python',
\ 'py=python',
\ 'makefile=make',
\ 'sh',
\ 'sass',
\ 'xml',
\ 'yaml',
\ 'vim'
\]
" }}}
" Folding {{{
" augroup: a
" function: f
let g:vimsyn_folding = 'af'
let g:tex_fold_enabled = 1
let g:xml_syntax_folding = 1
let g:perl_fold = 1
" }}}
" }}}
" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :