quick-scope icon indicating copy to clipboard operation
quick-scope copied to clipboard

Highlighting Stays On

Open ChiliConSql opened this issue 4 years ago • 4 comments

Even though I set let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] the highlighting is always on.

I am using Neovim v.0.4.4

ChiliConSql avatar Feb 15 '21 20:02 ChiliConSql

I installed Neovim (v0.4.4) and did not reproduce this.

I used the init.vim configuration of:

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

in order to run with my Vim config (which has the highlight on keys set in it - line 108) as suggested by the Neovim help.

My current guess is that it could be a configuration error or conflict with another plugin or setting, I suggest you try to determine the minimal configuration file that will reproduce the issue.

bradford-smith94 avatar Feb 16 '21 23:02 bradford-smith94

@bradford-smith94 thank you for your input.

It looks like the issue is "where" I put the directive. If I put it in nvimrc after initializing the plugin, it works. But if I put it in "plugins" folder, it doesn't, even though opening a file and issuing: :echo g:qs_highlight_on_keys produces the correct result of ['f', 'F', 't', 'T'].

Any idea why, and where can I place this directive outside of nvimrc/init.vim.?

ChiliConSql avatar Feb 18 '21 05:02 ChiliConSql

Sure, the why is most likely because of the order in which the vim/nvim configuration files are sourced. When the quick-scope plugin file is sourced is when it checks for the value of g:qs_highlight_on_keys, so if your settings file is sourced after that it will not matter what you set it to. This particular value isn't setup to be changed or toggled at runtime so it isn't checked anywhere else in the code, but that could be a possible enhancement.

The builtin help page :help initialization can provide more detail on the order that files are loaded, specifically the :help load-plugins section applies here, although the help page doesn't seem to provide much information on how the plugins are ordered themselves.

You can use the command :scriptnames to see the order in which vim/nvim has processed files, the goal here would be to get the file that contains the g:qs_highlight_on_keys setting to be loaded before .../quick-scope/plugin/quick_scope.vim (the ... changes depending on where your plugins are installed). I'm not exactly sure how much you can do to force vim/nvim to load your file first, but it might be worth it to experiment with changing the name of the file (I would guess that some sort of alphabetical loading might take place, but my :scriptnames output doesn't seem to be ordered).

If nothing else works you can put the file in a place that vim/nvim will not automatically load (I like to use ~/.vim/custom/ for this purpose) and then explicitly source that file in your vimrc/init.vim so that it loads before vim/nvim move on to processing plugin files.

bradford-smith94 avatar Feb 18 '21 22:02 bradford-smith94

This should be in the README :wink:

gerazov avatar Nov 09 '21 15:11 gerazov