ggandor / lightspeed.nvim Goto Github PK
View Code? Open in Web Editor NEWdeprecated in favor of leap.nvim
License: MIT License
deprecated in favor of leap.nvim
License: MIT License
When I do the following:
fa
dfb
f<CR>
I will jump to the next a
instead of b
.
Is this intended behavior? I'd assume it'd jump to b
instead of a
.
Love the plugin, but f,F,t,T do not work in macros anymore.
If you try it, you'll get a nice E5108: Error executing lua Vim:E475: Invalid argument :ull
message. Don't know why this has not surfaced earlier.
Subsequent repeats work as intended, staying in Normal mode.
This suggestion naturally follows from the second part of #46
Include boolean option for including native ;
and ,
functionality, rather than suggesting that the user copy one of the implementations that are included in the documentation; this will help avoid further clutter in users' config files, and also simplify the documentation.
And useless search character prefix, which confuses user.
In screenshot above, I searched for e
, The green color parts don't need first e
to jump to, so they are confusing.
f
& j
in purple color need space
key to be pressed first, which is not obvious, and space is neither in the labels config.
And why do I have very few 1 character jumps in Screenshot 2? Hop & Easymotion make jump labels as short as possible. See Line 1-6 in Hop screenshot.
In Screenshot 4, there is a capital H
, which I didn't include in labels config, why is it there?
How to remove space
form labels & e from those green color areas.
require'lightspeed'.setup({
jump_to_first_match = false,
highlight_unique_chars = false,
grey_out_search_area = true,
-- Target keys
labels = {'d', 'k', 'f', 'j', 's', 'l', 'a', ';', ',', 'c', 'm', 'e', 'i', 'w', 'o', 'g', 'h', 'v', 'n', 'r', 'u', 't', 'x', ',', 'q', 'p', '[', ']', 'z', '.', '/', 'y', 'b'}
})
I'm wondering what theme your using in the screenshots (and what theme(s) you're personally using currently if different)
Title. I think it would improve user adoption rate based. A picture is worth a thousand words so for some of the more meatier plugins it really helped me understand their purpose when I was new to vim.
Willing/able to do this myself but I adopted this plugin today and need to familiarize myself.
If the decision is that this is not the right move then I'm still interested if anyone has something they want to show off to someone new.
After pressing the second character, lightspeed
immediately jumps to the first match. Unfortunately, if one has 'scrolloff'
activated, this may cause the screen to scroll, making it hard to keep focus on the remaining labels. Would it be possible to temporarily disable the setting?
Hey ππΌ,
I'm a bit confused if the highlighting is working correctly or not. In the ππΌ attached mp4
I want to move to the last instance of match
.
I input sm and this gives me 5
hits, for parameters
and match
. I then input a and it narrows it down even further to only match
. This is the state that is confusing to me as lightspeed
is still highlighting a
over the matches. I would assume it to only view valid input options and a is not valid in this case. The correct input would be d.
I want to disable it when filetype=NeogitStatus, because it conflicts with neogit mappings.
Right now it seems to use s,f,n,/,t,g
and the shifted forms of those, maybe more. I suppose because those keys are associated with searching before. but they are also all over the place, I was thinking that using home row keys (starting from index finger and going out) should be better. At least for me, thats why I wondered if there is a config option yet?
First: thanks for this awesome plugin! I really start to get the hang of it.
But after some weeks of use I found one thing that could maybe be tweaked. It's about this feature (from the README):
the cursor automatically jumps to the first match by default; pressing any other key than a group-switch or a target label exits the plugin now
After typing 2 chars I often find, that I'm already where I wanted to go. But now the area is still greyed out. All I wanted to do is go to that new location, e.g. to reason about some piece of code. But my brain feels disturbed a lot by the still greyed out area. I now feel a disruption because I have think about "How can I get rid of that greyed out area?". I could press a key without any binding (ESC
is to far away. On my german keyboard Γ€
may be a good candidate). But it still requires me to press yet another key - for no real action.
I wonder if we couldn't just get a (configurable) timeout: After the cursor jumped to the first match, we could wait x
seconds and then exit the plugin and restore the greyed out area.
Does this make sense? Or is there an even better alternative that I'm missing?
I would rather just bind keys as lua functions
This should definitely be an option at least, even for 2-character search maybe. I wonder what would be the best solution interface-wise. Should we add an opts
flag, something like limit_scope_to_current_line_for_macros
? Or a prefix key that switches off multiline search on demand? Any ideas/preferences?
Also, is there any hack out there that makes it possible to detect whether we are currently executing a normal
command, and not actually typing it live (like we can check macro playback with reg_executing
)?
When svermeulen/vim-cutlass is registered after lightspeed the repeating single character searches does not work. The initial single character search still works, but pressing, as an example, f
again just starts a new f
single character search.
I'm able to work around this issue by
nnoremap s <nop>
Plug 'svermeulen/vim-cutlass'
unmap s
Plug 'ggandor/lightspeed.nvim'
but thought you might want to be aware of the potential conflict. In particular cutlass does not, that I can tell, ever mess with any of fFtT.
Steps to reproduce:
.tex
file with the following content:\begin{document}
$\beta$
\end{document}
:set conceallevel=2
ytt
conceallevel
becomes 0
Operator-pending mode z
and Z
do restore conceallevel
, but f
/F
/t
/T
don't.
I was wondering how one can modify the highlight colors and particularly change the background color of the Shortcut labels. I read the documentation and I think that it is related to lightspeed-highlighting and the LightspeedShortcut part in the :help section but it is not clear how to use it. Thank you!
I appreciate that the current design is much easier to maintain, but it would be nice to have lightspeed
do proper on-demand loading (similarly to how old vimscript plugins did the heavy lifting in autoload
functions that are not sourced unconditionally at startup).
(Basically, you want to move as much as possible into modules that are require
d only on executing the mappings.)
Hey ππΌ,
I'm trying to run the following config:
-- β» β»βββΈβ» β»βΊβ³βΈβββββββββΈβββΈβΊβ³β
-- β βββΊββ£ββ« β ββββ£βββ£βΈ β£βΈ ββ
-- βββΈβΉββββΉ βΉ βΉ ββββΉ βββΈβββΈβΊβ»β
return function()
require('lightspeed').setup {
jump_to_first_match = false,
cycle_group_fwd_key = '<tab>',
cycle_group_bwd_key = '<s-tab>'
}
end
but the cycle
keybind overrides are not working. Strangely the default Space is no longer working either. This must be a bug, no? π π¨
A minor thought is that I find it somewhat strange that a option alters the default keymap. What's the reasoning behind this?
I'd like to remap s to another key. I see in the docs you have:
`<Plug>Lightspeed_s`
But for those of us not using vim-plug
how does one accomplish a remap?
It might be nice to be able to set stand-ins for characters in labels.
See in this attached screenshot, where I have run vs0
from the start of the line (taken with Nord colorscheme so probably reasonably representative of many users):
Technically the first match is 0<space>
, which makes sense, but it can be easy to overlook, I naturally want to type 00
because my brain reads it as a shortcut jump. I know this is wrong but still it happens.
If I could specify space_label = "Λ½"
, my brain might read it correctly.
I don't really know what the complexity would be, I think it's totally serviceable as is, but maybe a nice to have?
Hello. The main reason why I use hop is Omni-direction. I can press just shortcut for :Hop2char
and press two characters and move both top or bottom direction. I don't care about two different shortcuts.
May I do it with lightspeed
?
NVIM v0.6.0-dev+266-g5fd21b8d3
Lightspeed: 27625ea
If I have some very long lines which are wrapped, lightspeed doesn't seem to let me search everything visible. This may be a deliberate limitation for performance?
It's easier to see with a video. I have 3 lines. From line 1, I can only "query" (with s
) into lines 1 and 2. From line 2, I can only query into line 2. I think it's to do with line 3 ending off screen?
(if embed is broken https://streamable.com/rvs7as)
Content used, but any long, wrapped content will work.
Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia. Quae animi veritatis at ex unde! Natus doloribus ducimus mollitia provident facere Pariatur hic omnis adipisci eos consequuntur Ipsum accusamus minus totam eum aliquid. Nisi animi accusantium nam suscipit mollitia.
Consectetur autem cupiditate nemo harum pariatur! Vero unde adipisci velit aperiam in. Nostrum aspernatur eligendi hic praesentium optio Tenetur officiis aperiam non necessitatibus architecto Beatae sit ex dolor doloremque doloribus. Consectetur autem cupiditate nemo harum pariatur! Vero unde adipisci velit aperiam in. Nostrum aspernatur eligendi hic praesentium optio Tenetur officiis aperiam non necessitatibus architecto Beatae sit ex dolor doloremque doloribus. Consectetur autem cupiditate nemo harum pariatur! Vero unde adipisci velit aperiam in. Nostrum aspernatur eligendi hic praesentium optio Tenetur officiis aperiam non necessitatibus architecto Beatae sit ex dolor doloremque doloribus. Consectetur autem cupiditate nemo harum pariatur! Vero unde adipisci velit aperiam in. Nostrum aspernatur eligendi hic praesentium optio Tenetur officiis aperiam non necessitatibus architecto Beatae sit ex dolor doloremque doloribus.
Adipisicing consequuntur obcaecati dolorem quae reprehenderit Perspiciatis reiciendis architecto molestiae odio corporis Architecto soluta optio quaerat expedita expedita. Neque voluptate tempora magni consectetur suscipit ea. Architecto nihil vitae delectus a? Adipisicing consequuntur obcaecati dolorem quae reprehenderit Perspiciatis reiciendis architecto molestiae odio corporis Architecto soluta optio quaerat expedita expedita. Neque voluptate tempora magni consectetur suscipit ea. Architecto nihil vitae delectus a? Adipisicing consequuntur obcaecati dolorem quae reprehenderit Perspiciatis reiciendis architecto molestiae odio corporis Architecto soluta optio quaerat expedita expedita. Neque voluptate tempora magni consectetur suscipit ea. Architecto nihil vitae delectus a? Adipisicing consequuntur obcaecati dolorem quae reprehenderit Perspiciatis reiciendis architecto molestiae odio corporis Architecto soluta optio quaerat expedita expedita. Neque voluptate tempora magni consectetur suscipit ea. Architecto nihil vitae delectus a? Adipisicing consequuntur obcaecati dolorem quae reprehenderit Perspiciatis reiciendis architecto molestiae odio corporis Architecto soluta optio quaerat expedita expedita. Neque volupccctate tempora magni consectetur suscipit ea. Architecto nihil vitae delectus a? Adipisicing consequuntur obcaecati dolorem quae reprehenderit Perspiciatis reiciendis architecto molestiae odio corporis Architecto soluta optio quaerat expedita expedita. Neque voluptate tempora magni consectetur suscipit ea. Architecto nihil vitae delectus a?
One type of highlights changes the label's font color only (e.g. red), whereas another type changes the background and the font color (e.g. red bg, white font):
2021-06-29-02:00:27-screenshot
Is there any way to make it the former only? The latter is too low contrast so it's not easy on the eyes.
Also, why do the highlights differ anyway? Functionality, they seem to achieve the same purpose since they're of the same group of labels.
When I set the line
lua require'lightspeed'.opts['limit_ft_matches'] = 0
And search with F
or f
(Fa
or fa
) for example and then try to reverse the search with F
I get the warning not found: [character typed]
and I have to press F
twice for each reverse jump. The problem goes away when I set limit_ft_matches
to a value of one or greater. The problem does not occur using T
.
Just installed and using standard config:
require("lightspeed").setup({})
In visual mode, using 's' to select forwards works as expected. However, 'S' from visual mode does not. It stays in Visual mode but does not enter 'lightpeed'.
It is a good functionality that I've come to like. There were some design decisions I wasn't sure of but after thinking about it I've come to like it. But I think it would be more elegant/UNIX-philosophy compliant if this was in a separate plugin. I know that someone who doesn't want these features can just unmap them but I think it is more elegant and maintainable to only add what you want to your config, as opposed to adding and removing.
An alternative would be a boolean option of whether to include this functionality rather than making it the responsibility of the user to write unmaps.
ππΌ,
I explicitly set my cursor color in alacritty
which help me track it. The cursor color changes when lightspeed
is activated though - which is very confusing to me and I have a really hard time seeing where my cursor is.
This is highly noticable when using t or f repeatedly. The cursor color changes depending on the syntax highlighting and it's just confusing...
Is there an option to disable this or is it possible to add one? ππΌ
We need some more sophisticated logic here. That seemed a clever workaround back then (much simpler than what Sneak does), but I haven't thought about this edge case.
If the third character make the match unique, use that third character to jump, this way we can reduce the "surprise" factor.
In this case if I search for pr
there are only 2 possibilities: project
and previousTctTask_
The ideal it would be I could jump to project
with o
and previousTctTask_
with e
The jump to the first match could be automatically, but you get the idea.
Also, it is necessary that r
when I have already pressed pr
?
Hi, this is a relatively small issue but when changing the command triggers found in the help for ; and , repeating, it stops working in visual mode. (Changing the <cmd>
to :
). When trying to use ; or , in visual mode, it doesn't expand the selection after the first search with f or t. However, it works fine when I do what the help says. I'm not sure if this is a Neovim or Lightspeed issue so if it doesn't seem like a Lightspeed issue (or if it's a non-problem) feel free to just resolve this.
Thank you
Thanks for this plugin!
Just like there is a way to map ; and , (or custom keys) to repeat f/t motions, is there a way to map keys to repeat s
(2-key) motions? If not, is there a way to repeat them at all? perhaps, by pressing s
again?
It isn't currently documented and I tried to do it myself adhoc by adjusting the example for ft
but from looking at the code, the ft
and the s
tables aren't exactly identical so I couldn't simply adjust the code in the documentation to apply to s
.
I wonder if it's just a niche use-case? I'm using 2-key motions for everything; same line, next line or across half a screen. I find that the cost of pressing the second character is almost zero and the benefits it brings in disambiguation to reduce the number of matches is big. I also have jump-to-first-match enabled.
Thanks again!
If you have multiple (VIM) windows open which show different buffers lightspeed
commands (s, S, f, t, F, T) will exit visual mode.
:sp
f i
, f
, f
etc.
f i
, f
, f
etc.
local install_path = vim.fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
local is_packer_installed = vim.fn.isdirectory(install_path) == 1
if not is_packer_installed then
vim.api.nvim_command('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
end
require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'ggandor/lightspeed.nvim'
end)
I have had a look in the code, but could not see what could cause this behavior π
Lightspeed is not for searching in the first place, but in case of s/S
, this can be considered an actual bug, as it breaks the whole labeling system.
If I search for a ';' then its not found, is this a known issue?
I don't use the matchparen plugin so this command does's exist for me. I've set vim.g.loaded_matchparen = 1
so the
lightspeed.nvim/fnl/lightspeed.fnl
Line 253 in 5dcfbb9
For example, if the cursor is on the beginning of "jump", and the user types cVzx
(where "x" is unique in the direction), the whole line should be highlighted with strikethrough, instead of this:
This is doable, as vim.fn.mode
can now return information about forced-motion, but requires a bit of work. Will fix it soon.
Hello!
I understand that this the cursor being moved to this "blank portion"(for lack of a better term) is intended behavior, but how can the resizing of the editor itself be handled?
Here's a video showing the said behavior using 2 character search and f:
I have a few of ideas on how it could work, simplest of them being:
VimResize autocommand on start -> winrestview(winsaveview-saved-somewhere) -> disable autocommand on end
But then how best would it be best to implement the saving of window view?
Since there is no VimResizePre auto command, Would it be a CursorMoved autocommand that enables when lightspeed is active? Or would it be better to use a completely different approach?
Sorry for the questions, curious about what approach others would take :D
Thanks for creating this plugin. I'm liking it so far but I encountered one issue where the native f/t was nicer (or I'm doing it wrong π)
Imagine this situation where |
is the cursor.
| hello abcade
When I would want to delete abca
.
With native f
I would type fad;
.
With lightspeed I haven't found a way except fadfa
. I would have expected fadf<CR>
to work but this deleted until the end of line.
I'm getting:
E5108: Error executing lua /home/mc/.vim/plugged/lightspeed.nvim/lua/lightspeed.lua:35: attempt to call field 'nvim_echo' (a nil value)
when I try hitting s
after installing via Plug.
I've pulled the very latest Neovim nightly (Ubuntu) on two different machines:
> apt policy neovim
neovim:
Installed: 0.5.0+ubuntu2+git202106150022-b28d458f8-d569569c9-e70091b15~ubuntu18.04.1
Candidate: 0.5.0+ubuntu2+git202106150022-b28d458f8-d569569c9-e70091b15~ubuntu18.04.1
Version table:
*** 0.5.0+ubuntu2+git202106150022-b28d458f8-d569569c9-e70091b15~ubuntu18.04.1 500
500 http://ppa.launchpad.net/neovim-ppa/unstable/ubuntu bionic/main amd64 Packages
100 /var/lib/dpkg/status
0.4.4-1~ubuntu18.04.1~ppa1 500
500 http://ppa.launchpad.net/neovim-ppa/stable/ubuntu bionic/main amd64 Packages
0.2.2-3 500
500 http://au.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
I've also tried a minimal vimrc file with only this Plug install and nothing else - same error.
This looks like a Neovim / Lua API problem - It was my understanding that Lua was now bundled with Neovim. Is there some way to check I have a compatible version of Lua compiled into Neovim correctly?
Hey, just noticed this issue: when using your plugin I can't create manual folds anymore. zf
triggers f-navigation. Disabling the plugin makes it work again.
The Highlighting groups don't provide any cterm
definitions for the TUI.
I found in lua/lightspeed.lua
around line 175 the definition of the highlight groups
Is a target of this project to support TUI too?, then I could open a PR with my changes to discuss a possible implementation.
Over at LunarVim we are wanting to integrate lightspeed, some users also want to have quick-scope installed, but this is vim-script only.
Would this functionality be something you'd consider adding to lightspeed (or accepting a patch for)..
It would be great to have the one lightspeed plugin to rule them all.
I have a mapping which looks like this:
nmap <expr> ; sneak#is_sneaking() ? '<Plug>Sneak_;' : ':'
vmap <expr> ; sneak#is_sneaking() ? '<Plug>Sneak_;' : ':'
Basically means map ;
to :
when not in "label mode" otherwise let the plugin handle the mapping.
Is it currently possible to have the same behavior?
the problem is that when conceallevel > 0 you can't really see where you are trying to jump to. So it would make to disable conceal while jumping.
Is there anyway easy way to do this? or could this be feature of this plugin?
Hi, first of all I want to say this is an amazing plugin! I consider this to be an essential plugin in my workflow now. Not really an issue but since you have implemented this in Lisp, I was wondering if you are interested in implementing this plugin in Emacs? Evil-snipe and Avy are substitutes for vim-sneak and EasyMotion, but I don't think there is anything like lightspeed in Emacs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.