-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add c-f c-d keymap to file_picker to filter option. #1405
Conversation
helix-term/src/ui/picker.rs
Outdated
EventResult::Consumed(None) | ||
} | ||
ctrl!('f') => { | ||
if let Some(cwd) = doc!(ctx.editor).path().and_then(|p| p.parent()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cwd
is misleading, as the current file will not always be in the current working directory. This should be something like doc_dir
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does doc_dir
mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document directory...
@@ -306,6 +306,15 @@ Keys to use within picker. Remapping currently not supported. | |||
| `Ctrl-v` | Open vertically | | |||
| `Escape`, `Ctrl-c` | Close picker | | |||
|
|||
## File Picker extra keymap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason these can't just go into the Picker section's table?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shortcut only works on FilePicker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you telling me that these shortcuts in the File Picker section work outside of the file picker?
Lines 297 to 309 in ddbf036
# Picker | |
Keys to use within picker. Remapping currently not supported. | |
| Key | Description | | |
| ----- | ------------- | | |
| `Up`, `Ctrl-k`, `Ctrl-p` | Previous entry | | |
| `Down`, `Ctrl-j`, `Ctrl-n` | Next entry | | |
| `Ctrl-space` | Filter options | | |
| `Enter` | Open selected | | |
| `Ctrl-s` | Open horizontally | | |
| `Ctrl-v` | Open vertically | | |
| `Escape`, `Ctrl-c` | Close picker | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, those shortcuts works on any picker and this is specific to file picker.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohhhh, I see, sorry for my confusion. In that case, could we update the title to just "File picker", and update the wording in the sentence just below here to say that these are specific to the file picker?
69020ed
to
6d36207
Compare
Love the idea of having this functionality. Just calling out that there is an open issue (#1467) to add Another alternative could be to introduce more |
helix-term/src/ui/picker.rs
Outdated
ctrl!('a') => { | ||
if let Ok(cwd) = std::env::current_dir() { | ||
filter(cwd.as_path()); | ||
} | ||
EventResult::Consumed(None) | ||
} | ||
ctrl!('f') => { | ||
if let Some(cwd) = doc!(cx.editor).path().and_then(|p| p.parent()) { | ||
filter(cwd); | ||
} | ||
EventResult::Consumed(None) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this seemed oddly specific. Do you know any prior art that do something similar? I don't see something like this in doom emacs IIRC or maybe I didn't dig deep, also stuff like these are hard to discover. And what is your usecase?
I wonder if it would be good to C-r %
to paste the current file and C-w
to remove the last file path to do the same without doing something so specific?
While I think these filters are a nice addition, I also think we should be careful with binding |
Maybe you could start a search string in a specialized way and helix would know to interpret it as
...would only look up entries in Or more restrictive but more obvious, too:
...translates to effectively searching for:
|
If this will be merged, #1352 can be closed as this one solves the same issue without taking away any space shortcut. |
How about |
6d36207
to
8e985be
Compare
Nope, @bbodi I think it would be good to have
Not sure if we want this but I think it would be good to rethink the approach. For me I think it's better to |
FWIW Could we somehow make this optional for a time with a way to add it as a keybind? Then see how the bindings progress across the editor? |
add c-f to file_picker for filter path starts_with current file's dir
0ef3605
to
64a79d5
Compare
If you ask me, I probably won't give approval for this pull request since it is very specific and not inter-changable with other parts, other users may not be able to figure this out easily. If anything I still think |
#2458 (support insert register in prompt) is now merged, so if we add support for |
I am closig this PR as it has gone stale. I also don't think we will be looking to add a feature like this to core. Its too specific/niche and IMO better covered by features like Thank you for contributing! |
add c-f to file_picker for filter path starts_with current file's dir
add c-d to file_picker for filter path starts_with cwd