-
Notifications
You must be signed in to change notification settings - Fork 491
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
navi fish plugin with ability to edit commandline #123
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
function navi-widget -d 'Call navi' | ||
set -q NAVI_USE_FZF_ALL_INPUTS; or set -l NAVI_USE_FZF_ALL_INPUTS "true" | ||
begin | ||
navi --print | while read -l r; set result $result $r; end | ||
|
||
if [ -n "$result" ] | ||
echo $result | ||
|
||
# Remove last token from commandline. | ||
commandline -t "" | ||
function navi_key_bindings | ||
function navi-widget -d "Show cheat sheet" | ||
set -q FZF_TMUX_HEIGHT; or set FZF_TMUX_HEIGHT 40% | ||
begin | ||
set -lx FZF_DEFAULT_OPTS "--height $FZF_TMUX_HEIGHT $FZF_DEFAULT_OPTS --tiebreak=index --bind=ctrl-r:toggle-sort $FZF_CTRL_R_OPTS +m" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ✂️ (Actually, is this necessary? Why not let the user decide the defaults given his/her There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not necessary. I basically left it from the fzf script without thinking deeply if it's necessary. Personally I never used the shortcut to toggle the shorting mode. In the fzf case the idea was probably that you can have different options for different applications of fzf. Now the FZF_TMUX_HEIGHT variable doesn't seem to have an effect anyway. I'm also not sure if navi should support this or not. |
||
stty sane | ||
env NAVI_USE_FZF_ALL_INPUTS=true navi --print query (commandline) | perl -pe 'chomp if eof' | read -lz result | ||
and commandline -- $result | ||
end | ||
commandline -f repaint | ||
end | ||
|
||
# commandline -f repaint | ||
end | ||
|
||
bind \cg navi-widget | ||
|
||
if bind -M insert > /dev/null 2>&1 | ||
bind -M insert \cg navi-widget | ||
bind \cg navi-widget | ||
if bind -M insert > /dev/null 2>&1 | ||
bind -M insert \cg navi-widget | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you wrapping everything inside this fn?
I tried running
source $NAVI_HOME/navi.plugin.fish
and it didn't seem to work. Removing this line and the last one makes it work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adapted the script from the fzf fish script. The bindings are enabled by a line in ~/.config/fish/functions/fish_user_key_bindings.fish
Otherwise they are always enabled. Not a big deal though, you can also delete the file if you want it disabled.