aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/auto_file.vim
blob: 72e782fd538bf1169f17b45075caa1684e5f889b (plain)
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
" auto_file.vim - Automatically file reading, saving; directory changer.

" Autoread {{{
"
" http://vim.wikia.com/wiki/Have_Vim_check_automatically_if_the_file_has_changed_externally
" http://stackoverflow.com/questions/2490227/how-does-vims-autoread-work
" http://stackoverflow.com/questions/2490227/how-does-vims-autoread-work
"au FocusGained,BufEnter * :silent! !
"au FocusLost,WinLeave * :silent! w
" }}}

" Autosave {{{
" See https://github.com/vim-scripts/vim-auto-save
"let g:auto_save = 1
" }}}

" Auto change dir {{{
"
" Automatically set the current working directory to the current buffer file's
" directory
"
" See http://vim.wikia.com/wiki/Set_working_directory_to_the_current_file
"set autochdir
augroup changedir
  autocmd!
  autocmd BufEnter * silent! lcd %:p:h
augroup END
" }}}