diff --git a/conf.d/puffer_fish_key_bindings.fish b/conf.d/puffer_fish_key_bindings.fish new file mode 100644 index 0000000..58d4d3d --- /dev/null +++ b/conf.d/puffer_fish_key_bindings.fish @@ -0,0 +1,25 @@ +status is-interactive || exit + +function _puffer_fish_key_bindings --on-variable fish_key_bindings + set -l modes + if test "$fish_key_bindings" = fish_default_key_bindings + set modes default insert + else + set modes insert default + end + + bind --mode $modes[1] . _puffer_fish_expand_dots + bind --mode $modes[1] ! _puffer_fish_expand_bang + bind --mode $modes[1] '$' _puffer_fish_expand_lastarg + bind --mode $modes[2] --erase . ! '$' +end + +_puffer_fish_key_bindings + +set -l uninstall_event puffer_fish_key_bindings_uninstall + +function _$uninstall_event --on-event $uninstall_event + bind -e . + bind -e ! + bind -e '$' +end diff --git a/fish_plugins b/fish_plugins index 916da68..65600db 100644 --- a/fish_plugins +++ b/fish_plugins @@ -3,3 +3,4 @@ patrickf1/fzf.fish meaningful-ooo/sponge jorgebucaran/autopair.fish catppuccin/fish +nickeb96/puffer-fish diff --git a/fish_variables b/fish_variables index 2158fea..675459f 100644 --- a/fish_variables +++ b/fish_variables @@ -5,8 +5,9 @@ SETUVAR _fisher_catppuccin_2F_fish_files:\x7e/\x2econfig/fish/themes/Catppuccin\ SETUVAR _fisher_jorgebucaran_2F_autopair_2E_fish_files:\x7e/\x2econfig/fish/functions/_autopair_backspace\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_left\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_right\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_insert_same\x2efish\x1e\x7e/\x2econfig/fish/functions/_autopair_tab\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/autopair\x2efish SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish SETUVAR _fisher_meaningful_2D_ooo_2F_sponge_files:\x7e/\x2econfig/fish/functions/_sponge_clear_state\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_exit\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_postexec\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_preexec\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_on_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/_sponge_remove_from_history\x2efish\x1e\x7e/\x2econfig/fish/functions/sponge_filter_failed\x2efish\x1e\x7e/\x2econfig/fish/functions/sponge_filter_matched\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/sponge\x2efish +SETUVAR _fisher_nickeb96_2F_puffer_2D_fish_files:\x7e/\x2econfig/fish/functions/_puffer_fish_expand_bang\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_dots\x2efish\x1e\x7e/\x2econfig/fish/functions/_puffer_fish_expand_lastarg\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/puffer_fish_key_bindings\x2efish 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:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1emeaningful\x2dooo/sponge\x1ejorgebucaran/autopair\x2efish\x1ecatppuccin/fish +SETUVAR _fisher_plugins:jorgebucaran/fisher\x1epatrickf1/fzf\x2efish\x1emeaningful\x2dooo/sponge\x1ejorgebucaran/autopair\x2efish\x1ecatppuccin/fish\x1enickeb96/puffer\x2dfish SETUVAR _fisher_upgraded_to_4_4:\x1d SETUVAR fish_color_autosuggestion:6c7086 SETUVAR fish_color_cancel:f38ba8 diff --git a/functions/_puffer_fish_expand_bang.fish b/functions/_puffer_fish_expand_bang.fish new file mode 100644 index 0000000..abe0bcb --- /dev/null +++ b/functions/_puffer_fish_expand_bang.fish @@ -0,0 +1,10 @@ +function _puffer_fish_expand_bang + switch (commandline -t) + case '!' + commandline -t $history[1] + commandline -f repaint + case '*' + commandline -i '!' + end +end + diff --git a/functions/_puffer_fish_expand_dots.fish b/functions/_puffer_fish_expand_dots.fish new file mode 100644 index 0000000..3c240b8 --- /dev/null +++ b/functions/_puffer_fish_expand_dots.fish @@ -0,0 +1,16 @@ +function _puffer_fish_expand_dots -d 'expand ... to ../.. etc' + set -l cmd (commandline --cut-at-cursor) + set -l split (string split ' ' $cmd) + switch $split[-1] + case './*'; commandline --insert '.' + case '*..' + # Only expand if the string consists of dots and slashes. + # We don't want to expand strings like `bazel build target/...`. + if string match --quiet --regex '^[/.]*$' $split[-1] + commandline --insert '/..' + else + commandline --insert '.' + end + case '*'; commandline --insert '.' + end +end diff --git a/functions/_puffer_fish_expand_lastarg.fish b/functions/_puffer_fish_expand_lastarg.fish new file mode 100644 index 0000000..a61b892 --- /dev/null +++ b/functions/_puffer_fish_expand_lastarg.fish @@ -0,0 +1,9 @@ +function _puffer_fish_expand_lastarg + switch (commandline -t) + case '!' + commandline -t "" + commandline -f history-token-search-backward + case '*' + commandline -i '$' + end +end diff --git a/functions/tools.fish b/functions/tools.fish index 72ecb28..aa76f7c 100644 --- a/functions/tools.fish +++ b/functions/tools.fish @@ -6,6 +6,7 @@ function tools set_color blue echo "Tools" + toolprint red "music (ncmpcpp)" "MPD client" toolprint red "backup" "Run borg backup" toolprint red "ouch" "Archive manager" toolprint red "mood" "Mood tracker"