summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2020-10-24 17:46:15 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2020-10-24 17:46:15 +0200
commit3c148e9ef5a303a599320eb64e608392db82eeb0 (patch)
treee71e8db8419cd5a94cd37e11e7ebc54e45d4a215
parent739102e06df4fe5bca752d1163b954603912bc98 (diff)
downloadvim-polyglot-3c148e9ef5a303a599320eb64e608392db82eeb0.tar.gz
vim-polyglot-3c148e9ef5a303a599320eb64e608392db82eeb0.zip
Do not set checktime if already set
-rw-r--r--ftdetect/polyglot.vim6
-rw-r--r--plugin/polyglot.vim11
2 files changed, 11 insertions, 6 deletions
diff --git a/ftdetect/polyglot.vim b/ftdetect/polyglot.vim
index c2a6ae17..2f85f2ff 100644
--- a/ftdetect/polyglot.vim
+++ b/ftdetect/polyglot.vim
@@ -3500,12 +3500,6 @@ if !has_key(s:disabled_packages, 'sensible')
" Disable swap, it doesn't play well with autoread
set noswapfile
- " Auto reload if file was changed somewhere else (for autoread)
- augroup polyglot-sensible
- au!
- au CursorHold * checktime
- augroup END
-
" Enable highlighted case-insensitive incremential search.
set incsearch
diff --git a/plugin/polyglot.vim b/plugin/polyglot.vim
index 7143043e..f989d583 100644
--- a/plugin/polyglot.vim
+++ b/plugin/polyglot.vim
@@ -67,6 +67,17 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'sensible') == -
set updatetime=300
endif
+ " Automatically reload file if changed somewhere else
+ redir => capture
+ silent autocmd CursorHold
+ redir END
+ if match(capture, 'checktime') == -1
+ augroup polyglot-sensible
+ au!
+ au CursorHold * checktime
+ augroup END
+ endif
+
" Always save upper case variables to viminfo file.
if !empty(&viminfo)
set viminfo^=!