mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
parent
d9a7486eb6
commit
4627b5db0b
5 changed files with 16 additions and 9 deletions
12
README.md
12
README.md
|
@ -120,14 +120,18 @@ You can use **navi** as a widget to your shell:
|
|||
|
||||
This way, your history is correctly populated and you can edit the command as you wish before executing it.
|
||||
|
||||
Right now, there's only a widget for zsh. If you want for other shells, please upvote [this issue](https://github.com/denisidoro/navi/issues/37).
|
||||
|
||||
In order to use it, add this line to your `.zshrc`-like file:
|
||||
In order to use it, add this line to your `.bashrc`-like file:
|
||||
```sh
|
||||
# bash
|
||||
source "$(navi widget bash)"
|
||||
|
||||
# zsh
|
||||
source "$(navi widget zsh)"
|
||||
```
|
||||
|
||||
Then, simply hit `Alt+G`.
|
||||
By default, `Ctrl+G` is assigned to launching **navi**. If you want to change the keybinding, replace the argument of `bind` or `bindkey` in [the widget file](https://github.com/denisidoro/navi/search?q=filename%3Anavi.plugin.*&unscoped_q=filename%3Anavi.plugin.*).
|
||||
|
||||
If you want a widget for other shells, please upvote [this issue](https://github.com/denisidoro/navi/issues/37).
|
||||
|
||||
|
||||
### More options
|
||||
|
|
2
navi
2
navi
|
@ -35,7 +35,7 @@ source "${SCRIPT_DIR}/src/main.sh"
|
|||
##? full docs
|
||||
##? Please refer to the README at https://github.com/denisidoro/navi
|
||||
|
||||
VERSION="0.10.3"
|
||||
VERSION="0.11.0"
|
||||
NAVI_ENV="${NAVI_ENV:-prod}"
|
||||
|
||||
opts::eval "$@"
|
||||
|
|
3
navi.plugin.bash
Normal file
3
navi.plugin.bash
Normal file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
bind '"\C-g": " \C-u \C-a\C-k`printf \"\\e\" && navi --print`\e\C-e\C-y\C-a\C-d\C-y\ey\C-h\C-e\C-b"'
|
|
@ -1,13 +1,12 @@
|
|||
local _navi_path=$(dirname $0:A)
|
||||
_navi_path=$(dirname $0:A)
|
||||
|
||||
_call_navi() {
|
||||
local buff="$BUFFER"
|
||||
zle kill-whole-line
|
||||
local cmd="$(NAVI_USE_FZF_ALL_INPUTS=true $_navi_path/navi --print <> /dev/tty)"
|
||||
local cmd="$(NAVI_USE_FZF_ALL_INPUTS=true "${_navi_path}/navi" --print <> /dev/tty)"
|
||||
zle -U "${buff}${cmd}"
|
||||
# zle accept-line
|
||||
}
|
||||
|
||||
zle -N _call_navi
|
||||
|
||||
bindkey '\eg' _call_navi
|
||||
bindkey '^g' _call_navi
|
||||
|
|
|
@ -98,6 +98,7 @@ handler::widget() {
|
|||
|
||||
case "$SH" in
|
||||
zsh) widget="${SCRIPT_DIR}/navi.plugin.zsh" ;;
|
||||
bash) widget="${SCRIPT_DIR}/navi.plugin.bash" ;;
|
||||
*) echoerr "Invalid shell: $SH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in a new issue