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

feat: Create, Delete, Copy, Move, Rename files in the new File Explorer #12902

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
87b5bd5
feat: add API to register additional hooks with Pickrs
nik-rev Feb 17, 2025
f4e5c26
feat: figure out how to pass custom callback function set by keymap t…
nik-rev Feb 17, 2025
9a28d4f
feat: create operations for create, delete, copy, rename in file expl…
nik-rev Feb 17, 2025
5d29a17
refactor: utility macro to declare multiple handlers with ease
nik-rev Feb 17, 2025
d5fb7b2
refactor: improve the declare_key_handlers macro
nik-rev Feb 17, 2025
43f40d3
chore: add TODO comments
nik-rev Feb 17, 2025
7dc631d
chore: allow macro to destructure
nik-rev Feb 17, 2025
2eef82e
feat: implement basic callback functions for prompt operarions
nik-rev Feb 17, 2025
f59c596
feat: implement creating new files and directory
nik-rev Feb 17, 2025
469115e
feat: implement delete files
nik-rev Feb 17, 2025
a96841d
feat: implement copying
nik-rev Feb 17, 2025
835cda1
refactor: variable renaming
nik-rev Feb 18, 2025
b3d0f16
feat: use display method on paths
nik-rev Feb 18, 2025
7fd7b72
feat: implement copy path of selected item
nik-rev Feb 18, 2025
eecabdb
feat: pass context to all callbacks in file operations
nik-rev Feb 18, 2025
eafd8ac
style: formatting
nik-rev Feb 18, 2025
a099ae1
style: formatting
nik-rev Feb 18, 2025
e177c48
refactor: use Option<Result> to indicate if a status message should n…
nik-rev Feb 18, 2025
382803c
feat: add confirmation prompt when overwriting
nik-rev Feb 18, 2025
baddacf
docs: add file explorer keymap info
nik-rev Feb 18, 2025
cd6584f
chore: appease clippy
nik-rev Feb 18, 2025
0e6e3e8
refactor: rename variable
nik-rev Feb 18, 2025
6a558be
feat: better initial prompts when using file picker commands
nik-rev Feb 18, 2025
b6bbd4f
fix: delete path, not confirmation e.g. `y`
nik-rev Feb 18, 2025
fac6c7c
chore: appease clippy
nik-rev Feb 18, 2025
8eac1c2
feat: refresh picker when directory operations are performed
nik-rev Feb 18, 2025
9227267
chore: remove TODO comment
nik-rev Feb 18, 2025
24bd148
feat: restore cursor when performing file operations
nik-rev Feb 18, 2025
4fabd79
refactor: remove unneeded macro
nik-rev Feb 18, 2025
a97ebc2
style: format
nik-rev Feb 18, 2025
e6e80e2
fix: remove unneeded panics
nik-rev Feb 18, 2025
6dbb09f
style: format mod.rs
nik-rev Feb 18, 2025
a9612da
refactor: extract into a type alias
nik-rev Feb 18, 2025
ed570d9
fix: use MAIN_SEPARATOR instead of just unix separator
nik-rev Feb 18, 2025
eb35b60
fix: remove previous pickers when refreshing the current one
nik-rev Feb 18, 2025
7fdf2ba
refactor: simplify function
nik-rev Feb 18, 2025
f193705
feat: add main separator when showing current file's directory
nik-rev Feb 18, 2025
67ca955
refactor: extract into a function
nik-rev Feb 18, 2025
984ad4b
refactor: pass EditorData to callbacks, do not "compute" the root
nik-rev Feb 18, 2025
a6e1109
refactor: do not explicitlys specify the types everywhere
nik-rev Feb 18, 2025
fae93aa
refactor: move statement elsewhere
nik-rev Feb 18, 2025
488e955
refactor: use type aliases instead of fully writing out the type
nik-rev Feb 18, 2025
d55b8f3
feat: add file explorer keymappings to docs
nik-rev Feb 18, 2025
7a52c3f
fix: delete directories
nik-rev Feb 20, 2025
59a1d24
refactor: rename vars
nik-rev Feb 22, 2025
674afbf
refactor: inversion of control
nik-rev Feb 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions book/src/keymap.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,8 @@ This layer is a kludge of mappings, mostly pickers.
| ----- | ----------- | ------- |
| `f` | Open file picker at LSP workspace root | `file_picker` |
| `F` | Open file picker at current working directory | `file_picker_in_current_directory` |
| `e` | Open file explorer at LSP workspace root | `file_explorer` |
| `E` | Open file explorer at the opened file's directory | `file_explorer_in_current_buffer_directory`|
| `b` | Open buffer picker | `buffer_picker` |
| `j` | Open jumplist picker | `jumplist_picker` |
| `g` | Open changed file picker | `changed_file_picker` |
Expand Down Expand Up @@ -463,6 +465,18 @@ See the documentation page on [pickers](./pickers.md) for more info.
| `Ctrl-t` | Toggle preview |
| `Escape`, `Ctrl-c` | Close picker |

### File Explorer

There are additional keys accessible when using the File Explorer (`Space-e` and `Space-E`).

| Key | Description |
| ----- | ------------- |
| `Alt-m` | Move selected file or directory |
| `Alt-n` | Create a new file or directory |
| `Alt-d` | Delete the selected file or directory |
| `Alt-c` | Copy the selected file |
| `Alt-y` | Yank the path to the selected file or directory |

## Prompt

Keys to use within prompt, Remapping currently not supported.
Expand Down
6 changes: 3 additions & 3 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3013,7 +3013,7 @@ fn file_explorer(cx: &mut Context) {
return;
}

if let Ok(picker) = ui::file_explorer(root, cx.editor) {
if let Ok(picker) = ui::file_explorer(None, root, cx.editor) {
cx.push_layer(Box::new(overlaid(picker)));
}
}
Expand All @@ -3040,7 +3040,7 @@ fn file_explorer_in_current_buffer_directory(cx: &mut Context) {
}
};

if let Ok(picker) = ui::file_explorer(path, cx.editor) {
if let Ok(picker) = ui::file_explorer(None, path, cx.editor) {
cx.push_layer(Box::new(overlaid(picker)));
}
}
Expand All @@ -3053,7 +3053,7 @@ fn file_explorer_in_current_directory(cx: &mut Context) {
return;
}

if let Ok(picker) = ui::file_explorer(cwd, cx.editor) {
if let Ok(picker) = ui::file_explorer(None, cwd, cx.editor) {
cx.push_layer(Box::new(overlaid(picker)));
}
}
Expand Down
Loading