-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #901 from suimong/master
add integration with nushell
- Loading branch information
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export def navi_widget [] { | ||
let current_input = (commandline) | ||
let last_command = ($current_input | navi fn widget::last_command | str trim) | ||
|
||
match ($last_command | is-empty) { | ||
true => {^navi --print | complete | get "stdout"} | ||
false => { | ||
let find = $"($last_command)_NAVIEND" | ||
let replacement = (^navi --print --query $'($last_command)' | complete | get "stdout") | ||
|
||
match ($replacement | str trim | is-empty) { | ||
false => {$"($current_input)_NAVIEND" | str replace $find $replacement} | ||
true => $current_input | ||
} | ||
} | ||
} | ||
| str trim | ||
| commandline edit --replace $in | ||
|
||
commandline set-cursor --end | ||
} | ||
|
||
let nav_keybinding = { | ||
name: "navi", | ||
modifier: control, | ||
keycode: char_g, | ||
mode: [emacs, vi_normal, vi_insert], | ||
event: { | ||
send: executehostcommand, | ||
cmd: navi_widget, | ||
} | ||
} | ||
|
||
$env.config.keybindings = ($env.config.keybindings | append $nav_keybinding) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ pub enum Shell { | |
Zsh, | ||
Fish, | ||
Elvish, | ||
Nushell | ||
} | ||
|
||
#[derive(Error, Debug)] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters