lotabout / skim

Fuzzy Finder in rust!
MIT License
5.1k stars 183 forks source link

[Feature request] Add shell key bindings for fish #497

Closed victorz closed 1 year ago

victorz commented 1 year ago

I am in the process of switching to fish shell and would love to see those good ole shell key bindings to access the history and quickly switch directory like we can in bash and zsh (my previous shell).

Does this need to be done by this project or can I somehow generate key bindings for fish using the existing binds (bash/zsh)?

Thanks for your time and a really awesome piece of software that I use for a lot of stuff, professionally and privately. :smiley:

victorz commented 1 year ago

I'll note that fzf has key bindings for fish now:

https://github.com/junegunn/fzf/blob/master/shell/key-bindings.fish

victorz commented 1 year ago

I was able to throw something quickly together for private use:

function skistory --wraps 'history search' --description 'Quickly search history'
  history search $argv | sk | read -l result
  and commandline -- $result
end

bind \cr skistory
Delapouite commented 1 year ago

The fish key-bindings bundled with Fzf itself are quite minimal.

For a more complete usage : https://github.com/PatrickF1/fzf.fish

victorz commented 1 year ago

The fish key-bindings bundled with Fzf itself are quite minimal.

For a more complete usage : https://github.com/PatrickF1/fzf.fish

That's a really good resource, but I'm only really asking that we provide the same functionality/key bindings for fish as we do for bash and zsh. :+1: That minimal set is very functional and goes a long way IMO. Would be awesome!

That being said, I completed my own set of these functions that I will be using. Feel free to have a look here: https://gist.github.com/victorz/ff3e0ebd45a6a70276ca4e117c1e9cbf

I hope someone can benefit from it!

victorz commented 1 year ago

Welp, seems like this was added already within the last few releases, so this can be closed!

Simply add this, or similar, to your fish configuration:

  # setup skim
  if command -q sk
    skim_key_bindings
  end
znd4 commented 11 months ago

@victorz , sorry for a dumb question, but is there some way you're "automagically" getting that function? or did you just "vendor" it into your $__fish_config/conf.d dir?

victorz commented 11 months ago

@victorz , sorry for a dumb question, but is there some way you're "automagically" getting that function? or did you just "vendor" it into your $__fish_config/conf.d dir?

@znd4, no dumb questions!

Pretty much, yes! That's how it's done. You just run skim_key_bindings in your $XDG_CONFIG_HOME/fish/config.fish or wherever you wish to put it, so that it runs on every fish instance you start. :slightly_smiling_face: