From 066f30a39f97e3c6fd7717587218e8a5193a7d6a Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 6 Nov 2024 13:44:03 +0100 Subject: [PATCH] vim:au: Pass Funcref to timer_start Apparently on older neovim versions, passing the name of script-local functions to `timer_start` is not enough (in v0.10.2 this works, but v0.7.2 not). Fix this by wrapping it in `function(...)` to pass a Funcref. See :h timer_start: > timer_start({time}, {callback} [, {options}]) > [...] > {callback} is the function to call. It can be the name of a function > or a |Funcref|. [...] --- .config/vim/vimrc.d/80-autocommands.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index 15cc354..9da68db 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -80,7 +80,7 @@ function! s:highlight_cword() " Delay the highlight by 100ms so that not every word is highlighted " while moving the cursor fast. (This kind of simulates a CursorHold " event with a custom time) - let w:cword_timer_id = timer_start(100, "s:_highlight_cword") + let w:cword_timer_id = timer_start(100, function("s:_highlight_cword")) endfunction function! s:_highlight_cword(timer_id) @@ -112,14 +112,14 @@ function! s:highlight_selection() call timer_stop(w:selection_timer_id) " Make sure that the old selection is deleted soon-ish if exists("w:visual_match_ids") && !exists("w:selection_clear_timer_id") - let w:selection_clear_timer_id = timer_start(150, 's:clear_visual_timer') + let w:selection_clear_timer_id = timer_start(150, function('s:clear_visual_timer')) endif endif " Delay the highlight by 100ms so that not every selection is highlighted " while moving the cursor fast. (This kind of simulates a CursorHold " event with a custom time) - let w:selection_timer_id = timer_start(100, "s:_highlight_selection") + let w:selection_timer_id = timer_start(100, function("s:_highlight_selection")) endfunction function! s:_highlight_selection(timer)