aboutsummaryrefslogtreecommitdiff
path: root/helix-view/src
diff options
context:
space:
mode:
authorOmnikar2021-08-31 09:13:16 +0000
committerGitHub2021-08-31 09:13:16 +0000
commite772808a5b0417e4d074eb9683d79376f83dae2d (patch)
treebd0b8f7011543d3592b51e5c0c260842118fade9 /helix-view/src
parentdbfd054562ba97a73128c49fae0cea95deabec5d (diff)
Shell commands (#547)
* Implement shell interaction commands * Use slice instead of iterator for shell invocation * Default to `sh` instead of `$SHELL` for shell commands * Enforce trailing comma in `commands` macro * Use `|` register for shell commands * Move shell config to `editor` and use in command * Update shell command prompts * Remove clone of shell config * Change shell function names to match prompts * Log stderr contents upon external command error * Remove `unwrap` calls on potential common errors `shell` will no longer panic if: * The user-configured shell cannot be found * The shell command does not output UTF-8 * Remove redundant `pipe` parameter * Rename `ShellBehavior::None` to `Ignore` * Display error when shell command is used and `shell = []` * Document shell commands in `keymap.md`
Diffstat (limited to 'helix-view/src')
-rw-r--r--helix-view/src/editor.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs
index 18cb9106..e5ff93ad 100644
--- a/helix-view/src/editor.rs
+++ b/helix-view/src/editor.rs
@@ -33,6 +33,8 @@ pub struct Config {
pub scroll_lines: isize,
/// Mouse support. Defaults to true.
pub mouse: bool,
+ /// Shell to use for shell commands. Defaults to ["cmd", "/C"] on Windows and ["sh", "-c"] otherwise.
+ pub shell: Vec<String>,
/// Line number mode.
pub line_number: LineNumber,
/// Middle click paste support. Defaults to true
@@ -55,6 +57,11 @@ impl Default for Config {
scrolloff: 5,
scroll_lines: 3,
mouse: true,
+ shell: if cfg!(windows) {
+ vec!["cmd".to_owned(), "/C".to_owned()]
+ } else {
+ vec!["sh".to_owned(), "-c".to_owned()]
+ },
line_number: LineNumber::Absolute,
middle_click_paste: true,
}