forked from rafi/vim-config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfiletype.vim
More file actions
136 lines (101 loc) · 3.59 KB
/
filetype.vim
File metadata and controls
136 lines (101 loc) · 3.59 KB
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
" File Types
" ===
augroup user_plugin_filetype " {{{
autocmd!
" Reload vim config automatically
autocmd BufWritePost $VIM_PATH/{*.vim,*.yaml,vimrc} nested
\ source $MYVIMRC | redraw
" Highlight current line only on focused window
autocmd WinEnter,InsertLeave * if &ft !~# 'denite' | set cursorline | endif
autocmd WinLeave,InsertEnter * if &ft !~# 'denite' | set nocursorline | endif
" Automatically set read-only for files being edited elsewhere
autocmd SwapExists * nested let v:swapchoice = 'o'
" Equalize window dimensions when resizing vim window
autocmd VimResized * tabdo wincmd =
" Force write shada on leaving nvim
autocmd VimLeave * if has('nvim') | wshada! | else | wviminfo! | endif
" Check if file changed when its window is focus, more eager than 'autoread'
autocmd FocusGained * checktime
autocmd Syntax * if line('$') > 5000 | 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 !~# 'commit' && ! &diff &&
\ line("'\"") >= 1 && line("'\"") <= line("$")
\| execute 'normal! g`"zvzz'
\| endif
autocmd FileType crontab setlocal nobackup nowritebackup
autocmd FileType yaml.docker-compose setlocal expandtab
autocmd FileType gitcommit setlocal spell
autocmd FileType gitcommit,qfreplace setlocal nofoldenable
" https://webpack.github.io/docs/webpack-dev-server.html#working-with-editors-ides-supporting-safe-write
autocmd FileType css,javascript,jsx,javascript.jsx setlocal backupcopy=yes
autocmd FileType php
\ setlocal matchpairs-=<:> iskeyword+=\\ path+=/usr/local/share/pear
" \ | setlocal formatoptions=qroct " Correct indent after opening a phpdocblock
autocmd FileType python
\ setlocal foldmethod=indent expandtab smarttab nosmartindent
\ | setlocal tabstop=4 softtabstop=4 shiftwidth=4 textwidth=80
autocmd FileType zsh setlocal foldenable foldmethod=marker
autocmd FileType html setlocal path+=./;/
autocmd FileType markdown
\ setlocal expandtab spell conceallevel=0
\ | setlocal autoindent formatoptions=tcroqn2 comments=n:>
autocmd FileType apache setlocal path+=./;/
autocmd FileType cam setlocal nonumber synmaxcol=10000
" autocmd FileType go highlight default link goErr WarningMsg |
" \ match goErr /\<err\>/
augroup END " }}}
" Internal Plugin Settings {{{
" ------------------------
" PHP {{{
let g:PHP_removeCRwhenUnix = 0
" }}}
" 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
" }}}
" JavaScript {{{
let g:SimpleJsIndenter_BriefMode = 1
let g:SimpleJsIndenter_CaseIndentLevel = -1
" }}}
" Ruby {{{
let g:ruby_no_expensive = 1
" }}}
" Folding {{{
" augroup: a
" function: f
let g:vimsyn_folding = 'af'
let g:tex_fold_enabled = 1
let g:xml_syntax_folding = 1
let g:php_folding = 2
let g:php_phpdoc_folding = 1
let g:perl_fold = 1
" }}}
" }}}
" vim: set foldmethod=marker ts=2 sw=2 tw=80 noet :