home-config/fish/conf.d/fzf.fish
ffa13af669afa60f3e5c5a269e7fbc35f5a11080
· 1.3 KB · 28 lines
raw
| 1 | # fzf.fish is only meant to be used in interactive mode. If not in interactive mode and not in CI, skip the config to speed up shell startup |
| 2 | if not status is-interactive && test "$CI" != true |
| 3 | exit |
| 4 | end |
| 5 | |
| 6 | # Because of scoping rules, to capture the shell variables exactly as they are, we must read |
| 7 | # them before even executing _fzf_search_variables. We use psub to store the |
| 8 | # variables' info in temporary files and pass in the filenames as arguments. |
| 9 | # This variable is global so that it can be referenced by fzf_configure_bindings and in tests |
| 10 | set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)' |
| 11 | |
| 12 | |
| 13 | # Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings |
| 14 | fzf_configure_bindings |
| 15 | |
| 16 | # Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased |
| 17 | function _fzf_uninstall --on-event fzf_uninstall |
| 18 | _fzf_uninstall_bindings |
| 19 | |
| 20 | set --erase _fzf_search_vars_command |
| 21 | functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings |
| 22 | complete --erase fzf_configure_bindings |
| 23 | |
| 24 | set_color cyan |
| 25 | echo "fzf.fish uninstalled." |
| 26 | echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings." |
| 27 | set_color normal |
| 28 | end |