gazorby / fish-abbreviation-tips

💡 Help you remembering your abbreviations
MIT License
299 stars 7 forks source link

print abbr list #7

Closed matthiasdebernardini closed 3 years ago

matthiasdebernardini commented 4 years ago

Is your feature request related to a problem? Please describe. I know I have set an abbreviation but id like to print the list of abbr before I attempt to type a long command

Describe the solution you'd like something like fzf to print my abbrs so that I can search through them I added a feature request to fzf.fish plugin but it was deemed too difficult to support so maybe this project would like to help?

Describe alternatives you've considered I currently have an abbr named gabb (get abbr) that gets replaced by this bat .config/fish/conf.d/abbreviations.fish | rg abbr | fzf

so print my abbreviations, grep for abbr and pipe to fzf

Additional context We dont have to use bat or ripgrep the normal version work just fine as well

gazorby commented 4 years ago

Hi @matthiasdebernardini

Similarly, I wrote a function some time ago that fuzzy find the abbreviation using fzf, and past it to the commandline. It only use fish builtins, except for fzf :

function fabbr --description 'Find abbreviation and paste it to commandline'
    set -l ab (string replace ' ' \t\t (string replace -r '.*-- ' '' (abbr -s)) | fzf -1 -0) \
        && commandline (string match -r '\\w+' "$ab") || return 1
end

This could be a nice addition, but as it rely on fzf, we should warn the user in case it's not installed.