diff options
Diffstat (limited to 'vim/init/config.vim')
-rw-r--r-- | vim/init/config.vim | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/vim/init/config.vim b/vim/init/config.vim index 2d37b66..ec9f090 100644 --- a/vim/init/config.vim +++ b/vim/init/config.vim | |||
@@ -184,8 +184,36 @@ augroup InitFileTypesGroup | |||
184 | au FileType markdown setlocal foldexpr=MarkdownLevel() | 184 | au FileType markdown setlocal foldexpr=MarkdownLevel() |
185 | au FileType markdown setlocal foldmethod=expr | 185 | au FileType markdown setlocal foldmethod=expr |
186 | 186 | ||
187 | " Hide the first line of a file if editing password file | ||
188 | " TODO a better way to determine a file is related to password-store, now use | ||
189 | " files under /dev/shm as filter | ||
190 | autocmd BufRead /dev/shm/*.txt call SetPasswordFile() | ||
191 | function SetPasswordFile() | ||
192 | setlocal foldminlines=0 | ||
193 | setlocal foldmethod=manual | ||
194 | function s:custom() | ||
195 | return "Password" | ||
196 | endfunction | ||
197 | setlocal foldtext=s:custom() | ||
198 | norm! ggzfl | ||
199 | endfunction | ||
200 | |||
201 | " Set filetype for beancount | ||
202 | autocmd BufRead,BufNewFile *.bean call PrepareBean() | ||
203 | function PrepareBean() | ||
204 | set filetype=beancount | ||
205 | silent !setsid fava ~/bean/main.bean &>/dev/null | ||
206 | autocmd VimLeave * silent !killall fava | ||
207 | endfunction | ||
208 | |||
209 | " Set filetype for index.html | ||
210 | autocmd BufWrite *.html,*.js,*.css call ReloadServer() | ||
211 | function ReloadServer() | ||
212 | silent !browser-sync reload &>/dev/null | ||
213 | endfunction | ||
214 | |||
187 | " quickfix: hide line number | 215 | " quickfix: hide line number |
188 | au FileType qf setlocal nonumber | 216 | au FileType quickfix setlocal nonumber |
189 | 217 | ||
190 | " 强制对某些扩展名的 filetype 进行纠正 | 218 | " 强制对某些扩展名的 filetype 进行纠正 |
191 | au BufNewFile,BufRead *.as setlocal filetype=actionscript | 219 | au BufNewFile,BufRead *.as setlocal filetype=actionscript |