fzf icon indicating copy to clipboard operation
fzf copied to clipboard

Toggle between search modes

Open akharrou opened this issue 3 years ago • 1 comments

  • [x] I have read through the manual page (man fzf)
  • [x] I have the latest version of fzf
  • [x] I have searched through the existing issues

Info

  • OS
    • [ ] Linux
    • [x] Mac OS X
    • [ ] Windows
    • [ ] Etc.
  • Shell
    • [x] bash
    • [x] zsh
    • [ ] fish

Feature request

Wouldn't the greatest search command of all time be able to dynamically choose/toggle through search modes, via bindings ?

  • Posix Basic Regular Expressions
  • Posix Extended Regular Expressions
  • Perl Compatible Regular Expressions
  • Glob Expressions
  • Literal Expressions

akharrou avatar Oct 20 '21 11:10 akharrou

if this was a search command, sure but fzf is a filter that derives its input from search commands. Even fzf run just as $fzf still derives its input from FZF_DEFAULT_COMMAND and does not handle searching. However, This can be achieved with the

--bind:F1:"reload(command that searches using posix regex {+f})"
--bind:F2:"reload(command that uses posix extneded{+f})"
--bind:F3:"reload(pearl compatible regex {+f})"
--bind:F4:"reload(glob expression {+f})"
--bind:F5:"reload(literal expression {+f})"

you could have them all on one such as

declare -a list
list=( "poxix regular command" "posix extended command" "pearl regex" "glob expression" "literal expression" )
--bind:F1:"reload(select choice in "${list[@]}"; 
do
case $choice in
            posix regular command)
                                     command using posix regular against {+f}
                             ;;
            posix extended command)
                                     command using posix extended against {+f}
                            ;;
            perl regex)
                                    command using perl regex against {+f}
                           ;;
            glob expression)
                                   command using glob expression agasint {+f}
                        ;;
            literal expression)
                                  command using literal expression against {+f}
                          ;;
esac
done

rayiik avatar Nov 29 '21 20:11 rayiik