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

prompt add a shortcut c-s to pick a word under cursor. command search make histories as completions. #831

Merged
merged 4 commits into from
Nov 4, 2021

Conversation

cossonleo
Copy link
Contributor

@cossonleo cossonleo commented Oct 12, 2021

Like title
ui prompt add a shortcut to pick a word.
Command search make histories as completions
The global search currently has no completions because it does't have histories register.

@pickfire
Copy link
Contributor

pickfire commented Oct 14, 2021

Oh, I don't think I have seen this in other text editors but seemed like an interesting idea.

But wouldn't a history completion be more useful? Like fish.

@cossonleo
Copy link
Contributor Author

cossonleo commented Oct 14, 2021

Oh, I don't think I have seen this in other text editors but seemed like an interesting idea.

But wouldn't a history completion be more useful? Like fish.

In vim/neovim, we can use <c-r><c-w> to fast pick the word under cursor. But I think using completions is more ergonomics.

@cossonleo
Copy link
Contributor Author

@archseer @pickfire
What do you think this PR?
I often need to search for a word for maintain a project.
Personly I think picking a word searched more faster is very useful.

@pickfire
Copy link
Contributor

It seemed to only complete the word under the cursor. I doubt I am gonna need it. What is your use case?

@archseer
Copy link
Member

I'm still thinking about this, it seems similar to what you can do with miw*nnnn (miw to select word, * to set search to main selection, then n to search).

@cossonleo
Copy link
Contributor Author

cossonleo commented Oct 26, 2021

I'm still thinking about this, it seems similar to what you can do with miw*nnnn (miw to select word, * to set search to main selection, then n to search).

My main purpose is for global search. It also reduces the keys inputed on document search.

@cossonleo cossonleo changed the title add completions for search and global search prompt add a shortcut c-s to pick a word under cursor. command search make histories as completions. Oct 29, 2021
@pickfire
Copy link
Contributor

Can you please update the book for this key as well? Also, can also add a comment there that this will probably be changed to ctrl-r w later (that will probably be done together with an infobox).

Add completions to search
Add c-s to pick word under doc cursor to prompt line
@cossonleo
Copy link
Contributor Author

Already add it to book

@archseer
Copy link
Member

archseer commented Nov 2, 2021

Sorry for the delay, I will test the PR later today!

book/src/keymap.md Outdated Show resolved Hide resolved
Copy link
Contributor

@pickfire pickfire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good to me. Only left some minor text fix on the doc.

helix-term/src/commands.rs Show resolved Hide resolved
helix-term/src/commands.rs Outdated Show resolved Hide resolved
true
}
})
.take(20)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we limit the amount of items? The rendering UI will already limit it to a maximum

Copy link
Contributor Author

@cossonleo cossonleo Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may affect performance When completions computed compete_fn with clone is large.
I have changed to 200. Do you think it need to cancel limit?

@cossonleo cossonleo requested a review from archseer November 3, 2021 10:24
@archseer archseer merged commit 39584cb into helix-editor:master Nov 4, 2021
@cossonleo cossonleo deleted the global_search branch November 4, 2021 03:31
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

Successfully merging this pull request may close these issues.

3 participants