Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting Stays On #72

Closed
ChiliConSql opened this issue Feb 15, 2021 · 5 comments
Closed

Highlighting Stays On #72

ChiliConSql opened this issue Feb 15, 2021 · 5 comments

Comments

@ChiliConSql
Copy link

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

@bradford-smith94
Copy link
Collaborator

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.

@ChiliConSql
Copy link
Author

@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.?

@bradford-smith94
Copy link
Collaborator

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.

@gerazov
Copy link

gerazov commented Nov 9, 2021

This should be in the README 😉

bradford-smith94 added a commit that referenced this issue Jul 5, 2024
This puts details right in the section about highlight_on_keys about the
potential miss-config issue related to when the variable is set vs when
the plugin is initialized.

The README now links to the two issues where this was encountered.

[#72](#72)
[#98](#98)
@bradford-smith94
Copy link
Collaborator

Added a note to README, also see #98.

Closing this issue, as it is now linked in README so finding the relevant discussion should be possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants