lotabout / skim

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

Custom skim action from library #537

Open AlexanderMGrindel opened 1 year ago

AlexanderMGrindel commented 1 year ago

I'm trying to bind a few custom keys from a skim selector. I'm new to the skim library crate, and relatively new to Rust in general. I found how to bind internal actions in skim, with something like:

let options = SkimOptionsBuilder::default()
    .height(Some("50%"))
    .multi(false)
    .bind(vec!["alt-a:accept"])
    .build()
    .unwrap();

That works fine. However, I want to bind keys to functions external to skim. Given the function other_skim_action(), I'd like to be able to

    .bind(vec!["alt-a:other_skim_action"])

or something similar. If there's a way to pass arguments that would be even better, but if not just being able to call a function would be sufficient. Does skim's library provide a way to accomplish this? Thanks!!