aboutsummaryrefslogtreecommitdiff
path: root/vim.dot.link/plugin/auto_file.vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim.dot.link/plugin/auto_file.vim')
-rw-r--r--vim.dot.link/plugin/auto_file.vim28
1 files changed, 28 insertions, 0 deletions
diff --git a/vim.dot.link/plugin/auto_file.vim b/vim.dot.link/plugin/auto_file.vim
new file mode 100644
index 0000000..2d46efc
--- /dev/null
+++ b/vim.dot.link/plugin/auto_file.vim
@@ -0,0 +1,28 @@
+" auto_file.vim - Automatically file reading, saving; directory change {{{
+
+" 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
+" }}}