Skip to content

Commit

Permalink
actions: harp, command expansions, count_selections
Browse files Browse the repository at this point in the history
  • Loading branch information
Axlefublr committed Dec 23, 2024
1 parent f92960a commit 7f3f18c
Show file tree
Hide file tree
Showing 8 changed files with 1,767 additions and 3 deletions.
200 changes: 200 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions book/src/generated/static-cmd.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,16 @@
| `command_palette` | Open command palette | normal: `` <space>? ``, select: `` <space>? `` |
| `goto_word` | Jump to a two-character label | normal: `` gw `` |
| `extend_to_word` | Extend to a two-character label | select: `` gw `` |
| `harp_file_get` | Open a file harp | |
| `harp_file_set` | Set a file harp to the current buffer | |
| `harp_relative_file_get` | Open a relative file harp | |
| `harp_relative_file_set` | Set a relative file harp to the current buffer | |
| `harp_cwd_get` | Change directory to a cwd harp | |
| `harp_cwd_set` | Update cwd harp to be the current working directory | |
| `harp_search_get` | Search for a stored search harp | |
| `harp_search_set` | Set a search harp to your last search | |
| `harp_register_get` | Get a register harp into default register | |
| `harp_register_set` | Set a register harp from default register | |
| `harp_command_get` | Execute command harp | |
| `harp_command_set` | Set a command harp from register : | |
| `count_selections` | Print amount of selections to messages | |
1 change: 1 addition & 0 deletions helix-term/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ serde = { version = "1.0", features = ["derive"] }
grep-regex = "0.1.13"
grep-searcher = "0.1.14"
rand = "0.8.5"
axleharp = "2.0.1"

[target.'cfg(not(windows))'.dependencies] # https://github.com/vorner/signal-hook/issues/100
signal-hook-tokio = { version = "0.3", features = ["futures-v0_3"] }
Expand Down
25 changes: 24 additions & 1 deletion helix-term/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
pub(crate) mod dap;
mod forkcommands;
pub(crate) mod lsp;
pub(crate) mod typed;

pub use dap::*;
use forkcommands::*;
use futures_util::FutureExt;
use helix_event::status;
use helix_stdx::{
Expand Down Expand Up @@ -232,6 +234,11 @@ impl MappableCommand {
jobs: cx.jobs,
scroll: None,
};
let (_, doc) = current!(cx.editor);
let args: Vec<Cow<str>> = args
.iter()
.map(|word| Cow::Owned(expand_expansions(word, doc)))
.collect();
if let Err(e) = (command.fun)(&mut cx, &args[..], PromptEvent::Validate) {
cx.editor.set_error(format!("{}", e));
}
Expand Down Expand Up @@ -568,6 +575,20 @@ impl MappableCommand {
command_palette, "Open command palette",
goto_word, "Jump to a two-character label",
extend_to_word, "Extend to a two-character label",
//--------------------------- fork commands ---------------------------
harp_file_get, "Open a file harp",
harp_file_set, "Set a file harp to the current buffer",
harp_relative_file_get, "Open a relative file harp",
harp_relative_file_set, "Set a relative file harp to the current buffer",
harp_cwd_get, "Change directory to a cwd harp",
harp_cwd_set, "Update cwd harp to be the current working directory",
harp_search_get, "Search for a stored search harp",
harp_search_set, "Set a search harp to your last search",
harp_register_get, "Get a register harp into default register",
harp_register_set, "Set a register harp from default register",
harp_command_get, "Execute command harp",
harp_command_set, "Set a command harp from register :",
count_selections, "Print amount of selections to messages",
);
}

Expand Down Expand Up @@ -6057,7 +6078,9 @@ fn shell_prompt(cx: &mut Context, prompt: Cow<'static, str>, behavior: ShellBeha
return;
}

shell(cx, input, &behavior);
let (_, doc) = current!(cx.editor);
let input = expand_expansions(input, doc);
shell(cx, &input, &behavior);
},
);
}
Expand Down
Loading

0 comments on commit 7f3f18c

Please sign in to comment.