aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/better_autoread.vim
blob: 73eae6c3fbed7fe1985f133ec577d260a4980c1e (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
" Better autoread
" Better detection for when files have changed outside of vim. Will 
" automatically reload files if they changed. If you've made modifications to 
" the file, you'll be prompted before the file is loaded.
"
" Taken from Greg Sexton:
" http://stackoverflow.com/a/10962191

set autoread

if v:version <# 800
	augroup checktime
		autocmd!
		if !has("gui_running")
			"silent! necessary otherwise throws errors when using command
			"line window.
			autocmd BufEnter        * silent! checktime
			autocmd CursorHold      * silent! checktime
			autocmd CursorHoldI     * silent! checktime
			"these two _may_ slow things down. Remove if they do.
			" autocmd CursorMoved     * silent! checktime
			" autocmd CursorMovedI    * silent! checktime
		endif
	augroup END
endif