-
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
Conversation
Thanks for opening this pull request! |
Related: #37 |
|
||
# Remove last token from commandline. | ||
commandline -t "" | ||
function navi_key_bindings |
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
function fish_user_key_bindings
fzf_key_bindings
navi_key_bindings
end
Otherwise they are always enabled. Not a big deal though, you can also delete the file if you want it disabled.
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 comment
The 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 .fishrc
?)
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.
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.
Cool! I'll try to merge this on Monday. Thanks! |
Congrats on merging your first pull request! |
here's my version of the fish plugin. I adapted it from the fzf plugin which allows to go through the command line history (ctrl-r). the fzf_tmux_height variables don't seem to have an effect.
there's also an issue where if you cancel navi (ctrl-c), you still have some invisible ^C / ctrl-c character left in the commandline. So your next command will not work unless you press ctrl-c again. This should probably be fixed somehow.
I had a problem where the line where I call navi would show prompts when run from the shell, but not in the function. I searched around the fish shell issues and running "stty sane" was suggested as a solution.