Skip to content

Commit

Permalink
feat(fish): enable fzf
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienElet committed Jan 7, 2025
1 parent 5b58986 commit a433077
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ extra: \
################################################################################
terminal: \
~/.config \
bat \
bottom \
broot \
eza \
Expand All @@ -46,6 +47,10 @@ terminal: \
~/.config:
mkdir $@

bat: brew ${BREW_BIN}/bat
${BREW_BIN}/bat:
brew install bat

bottom: brew ${BREW_BIN}/btm
${BREW_BIN}/btm:
brew install bottom
Expand All @@ -64,7 +69,8 @@ ${BREW_BIN}/fd:

fish: brew ${BREW_BIN}/fish ~/.config/fish
${BREW_BIN}/fish:
brew install fish
brew install fish fisher
fisher install PatrickF1/fzf.fish

~/.config/fish:
ln -s ~/.dotfiles/fish $@
Expand Down Expand Up @@ -308,10 +314,6 @@ bash-language-server: node ${NPM_BIN}/bash-language-server
${NPM_BIN}/bash-language-server:
@npm -g install bash-language-server

bat: brew ${BREW_BIN}/bat
${BREW_BIN}/bat:
brew install bat

comby: brew ${BREW_BIN}/comby
${BREW_BIN}/comby:
brew install comby
Expand Down
28 changes: 28 additions & 0 deletions fish/conf.d/fzf.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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
if not status is-interactive && test "$CI" != true
exit
end

# Because of scoping rules, to capture the shell variables exactly as they are, we must read
# them before even executing _fzf_search_variables. We use psub to store the
# variables' info in temporary files and pass in the filenames as arguments.
# This variable is global so that it can be referenced by fzf_configure_bindings and in tests
set --global _fzf_search_vars_command '_fzf_search_variables (set --show | psub) (set --names | psub)'


# Install the default bindings, which are mnemonic and minimally conflict with fish's preset bindings
fzf_configure_bindings

# Doesn't erase autoloaded _fzf_* functions because they are not easily accessible once key bindings are erased
function _fzf_uninstall --on-event fzf_uninstall
_fzf_uninstall_bindings

set --erase _fzf_search_vars_command
functions --erase _fzf_uninstall _fzf_migration_message _fzf_uninstall_bindings fzf_configure_bindings
complete --erase fzf_configure_bindings

set_color cyan
echo "fzf.fish uninstalled."
echo "You may need to manually remove fzf_configure_bindings from your config.fish if you were using custom key bindings."
set_color normal
end
3 changes: 3 additions & 0 deletions fish/fish_variables
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# VERSION: 3.0
SETUVAR --export EDITOR:vim
SETUVAR __fish_initialized:3400
SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish
SETUVAR _fisher_plugins:patrickf1/fzf\x2efish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_autosuggestion:brblack
SETUVAR fish_color_cancel:\x2dr
SETUVAR fish_color_command:blue
Expand Down

0 comments on commit a433077

Please sign in to comment.