-
Notifications
You must be signed in to change notification settings - Fork 0
/
filetype.rc.vim
174 lines (141 loc) · 4.4 KB
/
filetype.rc.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
"---------------------------------------------------------------------------
" FileType:
"
augroup MyAutoCmd
autocmd FileType,Syntax * call s:my_on_filetype()
" Enable gauche syntax.
autocmd FileType scheme nested let b:is_gauche=1 | setlocal lispwords=define |
\let b:current_syntax='' | syntax enable
" Auto reload VimScript.
autocmd BufWritePost,FileWritePost *.vim if &autoread
\ | source <afile> | echo 'source ' . bufname('%') | endif
" Manage long Rakefile easily
autocmd BufNewfile,BufRead Rakefile set foldmethod=syntax foldnestmax=1
autocmd FileType gitcommit,qfreplace setlocal nofoldenable
autocmd FileType ref nnoremap <buffer> <TAB> <C-w>w
" Enable omni completion.
" autocmd FileType ada setlocal omnifunc=adacomplete#Complete
" autocmd FileType c setlocal omnifunc=ccomplete#Complete
autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
autocmd FileType java setlocal omnifunc=javacomplete#Complete
autocmd FileType php setlocal omnifunc=phpcomplete#CompletePHP
if has('python3')
autocmd FileType python setlocal omnifunc=python3complete#Complete
else
autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
endif
"autocmd FileType ruby setlocal omnifunc=rubycomplete#Complete
"autocmd FileType sql setlocal omnifunc=sqlcomplete#Complete
autocmd FileType sql setlocal omnifunc=
autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
autocmd FileType python setlocal foldmethod=indent
" autocmd FileType vim setlocal foldmethod=syntax
" Update filetype.
autocmd BufWritePost *
\ if &l:filetype ==# '' || exists('b:ftdetect')
\ | unlet! b:ftdetect
\ | filetype detect
\ | endif
" Improved include pattern.
autocmd FileType html
\ setlocal includeexpr=substitute(v:fname,'^\\/','','') |
\ setlocal path+=./;/
autocmd FileType php setlocal path+=/usr/local/share/pear
autocmd FileType apache setlocal path+=./;/
autocmd FileType go highlight default link goErr WarningMsg |
\ match goErr /\<err\>/
" autocmd Syntax * syntax sync minlines=100
augroup END
" PHP
let g:php_folding = 0
" Python
let g:python_highlight_all = 1
" XML
let g:xml_syntax_folding = 1
" Vim
let g:vimsyntax_noerror = 1
"let g:vim_indent_cont = 0
" 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
" JavaScript
let g:SimpleJsIndenter_BriefMode = 1
let g:SimpleJsIndenter_CaseIndentLevel = -1
" Go
if $GOPATH != ''
set runtimepath+=$GOROOT/misc/vim
endif
" Vim script
" augroup: a
" function: f
" lua: l
" perl: p
" ruby: r
" python: P
" tcl: t
" mzscheme: m
let g:vimsyn_folding = 'af'
" http://mattn.kaoriya.net/software/vim/20140523124903.htm
let g:markdown_fenced_languages = [
\ 'coffee',
\ 'css',
\ 'erb=eruby',
\ 'javascript',
\ 'js=javascript',
\ 'json=javascript',
\ 'ruby',
\ 'sass',
\ 'xml',
\ 'vim',
\]
" Syntax highlight for user commands.
augroup syntax-highlight-extends
autocmd!
autocmd Syntax vim
\ call s:set_syntax_of_user_defined_commands()
augroup END
function! s:set_syntax_of_user_defined_commands() "{{{
redir => _
silent! command
redir END
let command_names = join(map(split(_, '\n')[1:],
\ "matchstr(v:val, '[!\"b]*\\s\\+\\zs\\u\\w*\\ze')"))
if command_names == '' | return | endif
execute 'syntax keyword vimCommand ' . command_names
endfunction"}}}
function! s:my_on_filetype() "{{{
" Disable automatically insert comment.
setl formatoptions-=ro | setl formatoptions+=mMBl
" Disable auto wrap.
if &l:textwidth != 70 && &filetype !=# 'help'
setlocal textwidth=0
endif
" Use FoldCCtext().
if &filetype !=# 'help'
setlocal foldtext=FoldCCtext()
endif
if !&l:modifiable
setlocal nofoldenable
setlocal foldcolumn=0
if v:version >= 703
setlocal colorcolumn=
endif
endif
endfunction "}}}
" Do not display completion messages
" Patch: https://groups.google.com/forum/#!topic/vim_dev/WeBBjkXE8H8
set noshowmode
try
set shortmess+=c
catch /^Vim\%((\a\+)\)\=:E539: Illegal character/
autocmd MyAutoCmd VimEnter *
\ highlight ModeMsg guifg=bg guibg=bg |
\ highlight Question guifg=bg guibg=bg
endtry