Closed w2kpro closed 2 months ago
Exact same problem here with NVIM v0.9.4
and
vim.cmd [[
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
augroup qs_colors
autocmd!
autocmd ColorScheme * highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline
autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline
augroup END
]]
Any solution for this?
Issue still present. Issue happens when qs_highlight_on_keys
is set
I can't reproduce the error while running NVIM v0.9.4
on Ubuntu 22.04
. Can someone provide more context, possibly their .vimrc
?
I'm able to reproduce it with this configuration. It only fails at the beginning of the lines at the end of the config
-- Install `lazy.nvim` plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
require("lazy").setup({
{
"unblevable/quick-scope",
config = function()
vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" }
end,
},
})
-- NVIM v0.10.0
--------------------------------------
--- Next lines will give an error
--------------------------------------
--
-- export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
--
-- # zstyle ':omz:update' mode disabled # disable automatic updates
--
Thanks @ktowen, using this config I can reproduce (nvim v0.10.0 on Archlinux).
Interesting findings:
g:qs_highlight_on_keys
is not set
:autocmd CursorMoved
and seeing call quick_scope#HighlightLineDelay(2, g:qs_accepted_chars)
registeredg:qs_highlight_on_keys
) does not reproduce the issueI'm still trying to dig into the why a bit more, but from this I can already tell that g:qs_highlight_on_keys
(although it is being set) is not being set before quick-scope is initialized, which is something the plugin does not currently support.
This error has something to do with when folke/lazy.nvim
is actually setting the variable. I haven't checked out that plugin yet, but I've confirmed this by moving the variable set line to outside of that lazy plugin and the error has disappeared (as well as quick-scope actually runs in g:qs_highlight_on_keys
mode) -- i.e. - the following config does not cause the error:
-- Install `lazy.nvim` plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
end ---@diagnostic disable-next-line: undefined-field
vim.opt.rtp:prepend(lazypath)
vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" }
require("lazy").setup({
{
"unblevable/quick-scope",
config = function()
vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" }
end,
},
})
-- NVIM v0.10.0
--------------------------------------
--- Next lines will give an error
--------------------------------------
--
-- export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
--
-- # zstyle ':omz:update' mode disabled # disable automatic updates
--
Removed the "plugin-interactions" label, while the specific config I tested was caused by another plugin interaction this issue is more generally a timing issue caused by when g:qs_highlight_on_keys
is set.
The latest update v2.6.2
should avoid the errors by locking in the operating mode at plugin initialization. But there still exists a potential for miss-config where the user thinks they have set g:qs_highlight_on_keys
(as above) but because of when the plugin is actually initialized vs when the variable is actually set quick-scope may not behave in "keys" highlighting mode.
Added a note to README, also see #72.
Closing this issue, as it is now linked in README so finding the relevant discussion should be possible.
You want to use the init
function in the Lazy plugin manager spec for this plugin:
return {
"unblevable/quick-scope",
init = function()
vim.g.qs_highlight_on_keys = { "f", "F", "t", "T" }
end,
}
Vim 9.1 on Manjaro Linux (vim -f -u .vimrc-core) quick-scope installed using Plug Added "let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']" to .vimrc-core Characters are highlighted, but when cursor is moved to a new line the following error occurs: Error detected while processing function quick_scope#HighlightLineDelayCallback[2]..quick_scope
HighlightLine[12]..49_get_highlight_patterns[130]..49_save_chars_with_secondary_high
lights: line 6: E121: Undefined variable: s:chars_s