flocon/dot_config/fish/functions/_fzf_wrapper.fish
Anthony Rodriguez dc7ee4d021 Add .config/fish/functions/_fzf_configure_bindings_help.fish
Add .config/fish/functions/_fzf_extract_var_info.fish
Add .config/fish/functions/_fzf_preview_changed_file.fish
Add .config/fish/functions/_fzf_preview_file.fish
Add .config/fish/functions/_fzf_report_diff_type.fish
Add .config/fish/functions/_fzf_report_file_type.fish
Add .config/fish/functions/_fzf_search_directory.fish
Add .config/fish/functions/_fzf_search_git_log.fish
Add .config/fish/functions/_fzf_search_git_status.fish
Add .config/fish/functions/_fzf_search_history.fish
Add .config/fish/functions/_fzf_search_processes.fish
Add .config/fish/functions/_fzf_search_variables.fish
Add .config/fish/functions/_fzf_wrapper.fish
Add .config/fish/functions/_nvm_index_update.fish
Add .config/fish/functions/_nvm_list.fish
Add .config/fish/functions/_nvm_version_activate.fish
Add .config/fish/functions/_nvm_version_deactivate.fish
Add .config/fish/functions/fish_greeting.fish
Add .config/fish/functions/fish_mode_prompt.fish
Add .config/fish/functions/fish_title.fish
Add .config/fish/functions/fzf_configure_bindings.fish
Add .config/fish/functions/nvm.fish
2024-06-07 11:48:47 +02:00

21 lines
1.3 KiB
Fish

function _fzf_wrapper --description "Prepares some environment variables before executing fzf."
# Make sure fzf uses fish to execute preview commands, some of which
# are autoloaded fish functions so don't exist in other shells.
# Use --function so that it doesn't clobber SHELL outside this function.
set -f --export SHELL (command --search fish)
# If neither FZF_DEFAULT_OPTS nor FZF_DEFAULT_OPTS_FILE are set, then set some sane defaults.
# See https://github.com/junegunn/fzf#environment-variables
set --query FZF_DEFAULT_OPTS FZF_DEFAULT_OPTS_FILE
if test $status -eq 2
# cycle allows jumping between the first and last results, making scrolling faster
# layout=reverse lists results top to bottom, mimicking the familiar layouts of git log, history, and env
# border shows where the fzf window begins and ends
# height=90% leaves space to see the current command and some scrollback, maintaining context of work
# preview-window=wrap wraps long lines in the preview window, making reading easier
# marker=* makes the multi-select marker more distinguishable from the pointer (since both default to >)
set --export FZF_DEFAULT_OPTS '--cycle --layout=reverse --border --height=90% --preview-window=wrap --marker="*"'
end
fzf $argv
end