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

Request: Have custom Aerojump mode to only match in the current screen #12

Open
resolritter opened this issue Nov 9, 2019 · 3 comments

Comments

@resolritter
Copy link
Contributor

Description

aerojump.nvim (Default Mode) will prioritize matches forward regardless of if they are in the screen. This is an issue for me as I'll describe below.

Suggestion

I'd like to limit the amount of lines searched to only the current screen. I've tried to take a look at the source code to do this myself, but couldn't figure out how you're getting the constructor parameters for the Aerojump class.

Issues

Previously, I've considered making a strict backwards-matching version of the command (similar to how you have / for forward search and ? for backwards search). However, I found from my usage that most of the time I am able to narrow down backwards matches enough that I land on the right line without having to need a second command. i.e.

unique sentence backwards
<<-- CURSOR HERE
unique word forward

In the above case, I want to jump backwards. I could type unique and notice it's matching forward, but then I type sentence (which doesn't match forward) and I'm able to land in a previous line without having to think of setting up the direction from the start, which feels great.

The use case where this doesn't work well is when you have a match forward outside of the buffer's view. Here's a quick example of a buffer with a lot of "token" words I'd want to match

image

However, unknown to me, there's another "token" word outside of the buffer view forward. When I start AerojumpDefault, the screen will jump completely out of my starting position, which means I am not able to filter my "tokens[1-5]" visually anymore.

image

For my use case, I'd like to have a command which only filters in the current screen. Is that acceptable to you?

@resolritter resolritter changed the title AerojumpDefault prioritizes matches forward (OUTSIDE of buffer view) over backwards matches inside of buffer view Request: Have Aerojump only match in the current screen Nov 9, 2019
@resolritter resolritter changed the title Request: Have Aerojump only match in the current screen Request: Have custom Aerojump mode to only match in the current screen Nov 9, 2019
@ripxorip
Copy link
Owner

Hi, this is the behavior that I wanted to have from the beginning due to the possibility of opening very large files. However it seemed to be fast enough at least for my needs even when opening large files. I can take a look at this over the weekend, you done want the cursor to jump 'off' the screen right?

@resolritter
Copy link
Contributor Author

resolritter commented Nov 22, 2019

@ripxorip That is right. I only want to be able to jump to what I can see in the screen from the starting position. I think slicing the current view out of the buffer's lines is more efficient and can help to solve this issue too (i.e. line("w0") for the line at the top and line("w$") for the one at the bottom).

@resolritter resolritter reopened this Nov 22, 2019
@ripxorip
Copy link
Owner

Yeah, I will try to come up with something, I too can see the use case.

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

2 participants