In #31 I noticed:
While testing this I noticed that it's not possible to use these to modify the behavior at runtime like:
- I have a viewer open
- I do
:let g:vivify_auto_scroll = 0
- Would expect that viewer to stop auto-scrolling, but this didn't work
The settings would be much more useful if they could be used to programmatically change the viewer behavior, in my opinion.
At first I thought it would be easy to change like this:
diff --git a/plugin/vivify.vim b/plugin/vivify.vim
index f9fb6c7..d4e7fac 100644
--- a/plugin/vivify.vim
+++ b/plugin/vivify.vim
@@ -3,9 +3,6 @@ if exists("g:loaded_vivify")
endif
let g:loaded_vivify = 1
-let s:vivify_instant_refresh = get(g:, "vivify_instant_refresh", 1)
-let s:vivify_auto_scroll = get(g:, "vivify_auto_scroll", 1)
-
let s:filetype_match_str = 'markdown'
if exists("g:vivify_filetypes")
call add(g:vivify_filetypes, s:filetype_match_str)
@@ -19,14 +16,14 @@ endfunction
function! s:init()
augroup vivify_sync
autocmd!
- if s:vivify_instant_refresh
+ if get(g:, "vivify_instant_refresh", 1)
autocmd TextChanged,TextChangedI *
\ if s:is_vivify_filetype(&filetype) | call vivify#sync_content() | endif
else
autocmd CursorHold,CursorHoldI *
\ if s:is_vivify_filetype(&filetype) | call vivify#sync_content() | endif
endif
- if s:vivify_auto_scroll
+ if get(g:, "vivify_auto_scroll", 1)
autocmd CursorMoved,CursorMovedI *
\ if s:is_vivify_filetype(&filetype) | call vivify#sync_cursor() | endif
endif
But surprised to see it didn't work. Maybe it has to do with it being inside an autocmd?
In #31 I noticed:
The settings would be much more useful if they could be used to programmatically change the viewer behavior, in my opinion.
At first I thought it would be easy to change like this:
But surprised to see it didn't work. Maybe it has to do with it being inside an autocmd?