Comments (9)
Every different highlight type has a function, the ones with the filled background are "shortcuts". You can reach those matches by typing the label character right after entering the first input. See the relevant part in the readme. I'm planning to add a separate section on the highlighting strategy though, with more elaborate explanations.
As for the low contrast, you can tweak any of the highlight groups to your liking, see :h lightspeed-highlight
. (If you need further help, just ask, I don't know how experienced you are with Vim.)
I'm closing the issue, but feel free to continue the discussion here, and ask more questions if needed!
from lightspeed.nvim.
Appreciate the explanation! The shortcut highlights must've zipped through my head when reading about it but I totally get it now.
I'm new to lua and neovim's api, but I assume I'm going to have to use vim.api.nvim_set_hl()
to change the hightlights right?
from lightspeed.nvim.
You can execute Vimscript in Lua by using vim.cmd('...')
, I think that is the simplest way for the moment.
" Insert your preferred colors in place of XXX, see :h highlight-guibg, :h highlight-guifg, also :h highlight-args
vim.cmd("highlight LightspeedLabel guifg=XXX guibg=XXX gui=bold")
vim.cmd("highlight LightspeedShortcut guifg=XXX guibg=XXX gui=bold,underline")
" ...and so on, for all the highlight groups you want to modify
from lightspeed.nvim.
Sorry for digging this out @ggandor.
I'm not really sure what the difference between LightspeedLabel
and LightspeedShortcut
is. They're highlighted differently but in the end it makes no difference typing f
or j
in the screenshot above. Even though f
is a Label
and j
is a Shortcut
.
I get that a Label
is defined by require 'lightspeed'.setup { labels = { ... } }
. Is there any other difference?
from lightspeed.nvim.
Sorry, I just found it out myself...
When typing s{char1}{char2}
there seems to be no difference (right?).
When typing s{char1}
the Shortcut
can be used omitting the second char.
Maybe it'd be less confusing if the Shortcuts
would highlight as Label
when the 2nd char is typed (when above assumption is true).
What do you think?
from lightspeed.nvim.
When typing s{char1}{char2} there seems to be no difference (right?).
When typing s{char1} the Shortcut can be used omitting the second char.
Yep, exactly.
Maybe it'd be less confusing if the Shortcuts would highlight as Label when the 2nd char is typed (when above assumption is true).
What do you think?
The basic principle is that after s{char1}
, every "beacon" should stays as it is, we just eliminate certain targets from the set in the following step. The reason behind this is that it doesn't work like s{char1}... what is the next step? hmm... {char2} ... let's check the label then... {label}
, but instead s-char1-char2--while-almost-unconsciously-processing-the-appearing-label--label
, in one continuous flow, that is the very point of this plugin, as opposed to its predecessors. This works significantly worse if there's any kind of change in the position or the appearance of the label between the steps.
I have tired many variations while developing the plugin. I have even tried a version similar to your suggestion, quite recently, a week or so ago: I wanted to make the system (presumably) more consistent, based on the principle that every entity gets the same highlight if that leads to the target directly (= if you press it, you'll land on the target in the next step), be it a character from the match itself, or a label. This means that in the 2nd step, all normal labels will suddenly change to "shortcuts". But, because of the reasons described above, it didn't work so well as I imagined. I'm pretty convinced now that the current system is the most efficient/ergonomic one, that cannot be improved significantly (at least without some totally new, groundbreaking approach we haven't even thought about yet).
from lightspeed.nvim.
The reason behind this is that it doesn't work like s{char1}... what is the next step? hmm... {char2} ... let's check the label then... {label}, but instead s-char1-char2--while-almost-unconsciously-processing-the-appearing-label--label
That is exactly the reason why I find it confusing.
I never typed s{char1}
so I didn't even notice that the second char would stay the same. So I wondered why some chars look different than others.
When pausing after s{char1}
it does make sense though as it indicates a quicker jump.
This also explains the strong highlight.
from lightspeed.nvim.
Right, shortcutting only works when one types slower than usual, e.g. starting with something like s(
. But that doesn't invalidate the above reasoning, that is, the highlights should stay the same for the 2nd round, whether it's a shortcut or not, because your brain starts processing the label unconsciously after the first input anyway, and any change has the potential to confuse it. At the same time, shortcuts obviously need some different highlight than the labels, by definition, so I don't see any other way to do this.
from lightspeed.nvim.
Only solution I'd see is to introduce another highlight group for the Shortcuts after the second char which would look identically but could be linked otherwise.
But I'm not sure if it's worth the additional complexity.
from lightspeed.nvim.
Related Issues (20)
- Update configuration in init.vim HOT 6
- Control timeout of instant jump/instant repeat labels separately HOT 4
- Error in `set_editor_opts` in `LightspeedLeave` autocommand HOT 3
- fatal: invalid reference: master when Installing or Updating with vim-plug HOT 1
- A suggestion for f/t HOT 3
- Problems when setting safe_labels = {} HOT 1
- Error on yank after jumping HOT 1
- Features Request: Search all windows in the tabpage HOT 1
- Configurable delay/timeout for f motions HOT 1
- Option to add characters to special character list HOT 1
- Lightspeed overwriting neogit shortcuts HOT 4
- Newly installed lightspeed.nvim throws error. Doesn't override nvim defaults. HOT 2
- Potential matched words get highlighted, doesn't go away HOT 2
- Matching Issues HOT 2
- lightspeed with vim-multiple-cursors
- Lightspeed resets scrolloff to 0 HOT 1
- automatically exit f/F HOT 3
- multibyte bug with display bounds computation HOT 2
- how to begin troubleshooting if plugin does not seem to have mapped keys? HOT 2
- Cursor not refreshing.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightspeed.nvim.