diff options
| author | 2026-02-28 12:09:29 +0000 | |
|---|---|---|
| committer | 2026-02-28 13:42:01 +0000 | |
| commit | 31c1914864eeca307670b6608acaa65f4eba45f5 (patch) | |
| tree | 4ee8bf2ccca7327f22e2ec1eaa95d35dbd7fe9b7 /fish/conf.d | |
| parent | d3bf30e201b256608bf718b7ee6208ef73eed2b1 (diff) | |
grande limpeza e atualização do fish
Diffstat (limited to 'fish/conf.d')
| -rw-r--r-- | fish/conf.d/autopair.fish | 39 | ||||
| -rw-r--r-- | fish/conf.d/done.fish | 349 | ||||
| -rw-r--r-- | fish/conf.d/env.fish | 2 | ||||
| -rw-r--r-- | fish/conf.d/fish_frozen_key_bindings.fish | 14 | ||||
| -rw-r--r-- | fish/conf.d/fish_frozen_theme.fish | 47 | ||||
| -rw-r--r-- | fish/conf.d/fzf.fish | 28 | ||||
| -rw-r--r-- | fish/conf.d/hydro.fish | 138 | ||||
| -rw-r--r-- | fish/conf.d/kitty.fish | 5 |
8 files changed, 622 insertions, 0 deletions
diff --git a/fish/conf.d/autopair.fish b/fish/conf.d/autopair.fish new file mode 100644 index 0000000..abb4bf3 --- /dev/null +++ b/fish/conf.d/autopair.fish @@ -0,0 +1,39 @@ +status is-interactive || exit + +set --global autopair_left "(" "[" "{" '"' "'" +set --global autopair_right ")" "]" "}" '"' "'" +set --global autopair_pairs "()" "[]" "{}" '""' "''" + +function _autopair_fish_key_bindings --on-variable fish_key_bindings + set --query fish_key_bindings[1] || return + + test $fish_key_bindings = fish_default_key_bindings && + set --local mode default insert || + set --local mode insert default + + bind --mode $mode[-1] --erase \177 \b \t + + bind --mode $mode[1] \177 _autopair_backspace # macOS ⌫ + bind --mode $mode[1] \b _autopair_backspace + bind --mode $mode[1] \t _autopair_tab + + printf "%s\n" $autopair_pairs | while read --local left right --delimiter "" + bind --mode $mode[-1] --erase $left $right + if test $left = $right + bind --mode $mode[1] $left "_autopair_insert_same \\$left" + else + bind --mode $mode[1] $left "_autopair_insert_left \\$left \\$right" + bind --mode $mode[1] $right "_autopair_insert_right \\$right" + end + end +end + +_autopair_fish_key_bindings + +function _autopair_uninstall --on-event autopair_uninstall + string collect ( + bind --all | string replace --filter --regex -- "_autopair.*" --erase + set --names | string replace --filter --regex -- "^autopair" "set --erase autopair" + ) | source + functions --erase (functions --all | string match "_autopair_*") +end diff --git a/fish/conf.d/done.fish b/fish/conf.d/done.fish new file mode 100644 index 0000000..8160f06 --- /dev/null +++ b/fish/conf.d/done.fish @@ -0,0 +1,349 @@ +# MIT License + +# Copyright (c) 2016 Francisco Lourenço & Daniel Wehner + +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: + +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +if not status is-interactive + exit +end + +set -g __done_version 1.21.1 + +function __done_run_powershell_script + set -f powershell_exe (command --search "powershell.exe") + + if test "$status" -ne 0 + and command --search wslvar + + set -f powershell_exe (wslpath (wslvar windir)/System32/WindowsPowerShell/v1.0/powershell.exe) + end + + if string length --quiet "$powershell_exe" + and test -x "$powershell_exe" + + set cmd (string escape $argv) + + eval "$powershell_exe -Command $cmd" + end +end + +function __done_windows_notification -a title -a message + if test "$__done_notify_sound" -eq 1 + set soundopt "<audio silent=\"false\" src=\"ms-winsoundevent:Notification.Default\" />" + else + set soundopt "<audio silent=\"true\" />" + end + + __done_run_powershell_script " +[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null +[Windows.UI.Notifications.ToastNotification, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null + +\$toast_xml_source = @\" + <toast> + $soundopt + <visual> + <binding template=\"ToastText02\"> + <text id=\"1\">$title</text> + <text id=\"2\">$message</text> + </binding> + </visual> + </toast> +\"@ + +\$toast_xml = New-Object Windows.Data.Xml.Dom.XmlDocument +\$toast_xml.loadXml(\$toast_xml_source) + +\$toast = New-Object Windows.UI.Notifications.ToastNotification \$toast_xml + +[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier(\"fish\").Show(\$toast) +" +end + +function __done_get_focused_window_id + if type -q lsappinfo + lsappinfo info -only bundleID (lsappinfo front | string replace 'ASN:0x0-' '0x') | cut -d '"' -f4 + else if test -n "$SWAYSOCK" + and type -q jq + swaymsg --type get_tree | jq '.. | objects | select(.focused == true) | .id' + else if test -n "$HYPRLAND_INSTANCE_SIGNATURE" + hyprctl activewindow | awk 'NR==1 {print $2}' + else if test -n "$NIRI_SOCKET" + and type -q jq + niri msg --json focused-window | jq ".id" + else if begin + test "$XDG_SESSION_DESKTOP" = gnome; and type -q gdbus + end + gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'global.display.focus_window.get_id()' + else if type -q xprop + and test -n "$DISPLAY" + # Test that the X server at $DISPLAY is running + and xprop -grammar >/dev/null 2>&1 + xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2 + else if uname -a | string match --quiet --ignore-case --regex microsoft + __done_run_powershell_script ' +Add-Type @" + using System; + using System.Runtime.InteropServices; + public class WindowsCompat { + [DllImport("user32.dll")] + public static extern IntPtr GetForegroundWindow(); + } +"@ +[WindowsCompat]::GetForegroundWindow() +' + else if set -q __done_allow_nongraphical + echo 12345 # dummy value + end +end + +function __done_is_tmux_window_active + set -q fish_pid; or set -l fish_pid %self + + # find the outermost process within tmux + # ppid != "tmux" -> pid = ppid + # ppid == "tmux" -> break + set tmux_fish_pid $fish_pid + while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim) + # remove leading hyphen so that basename does not treat it as an argument (e.g. -fish), and return only + # the actual command and not its arguments so that basename finds the correct command name. + # (e.g. '/usr/bin/tmux' from command '/usr/bin/tmux new-session -c /some/start/dir') + and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid | string replace -r '^-' '' | string split ' ')[1]) + set tmux_fish_pid $tmux_fish_ppid + end + + # tmux session attached and window is active -> no notification + # all other combinations -> send notification + tmux list-panes -a -F "#{session_attached} #{window_active} #{pane_pid}" | string match -q "1 1 $tmux_fish_pid" +end + +function __done_is_screen_window_active + string match --quiet --regex "$STY\s+\(Attached" (screen -ls) +end + +function __done_is_process_window_focused + # Return false if the window is not focused + + if set -q __done_allow_nongraphical + return 1 + end + + if set -q __done_kitty_remote_control + kitty @ --password="$__done_kitty_remote_control_password" ls | jq -e ".[].tabs[] | select(any(.windows[]; .is_self)) | .is_focused" >/dev/null + return $status + end + + set __done_focused_window_id (__done_get_focused_window_id) + if test "$__done_sway_ignore_visible" -eq 1 + and test -n "$SWAYSOCK" + string match --quiet --regex "^true" (swaymsg -t get_tree | jq ".. | objects | select(.id == "$__done_initial_window_id") | .visible" 2>/dev/null) + return $status + else if test -n "$HYPRLAND_INSTANCE_SIGNATURE" + and test "$__done_initial_window_id" = (hyprctl activewindow | awk 'NR==1 {print $2}') + return $status + else if test -n "$NIRI_SOCKET" + and test "$__done_initial_window_id" = (niri msg --json focused-window | jq ".id") + return $status + else if test "$__done_initial_window_id" != "$__done_focused_window_id" + return 1 + end + # If inside a tmux session, check if the tmux window is focused + if type -q tmux + and test -n "$TMUX" + __done_is_tmux_window_active + return $status + end + + # If inside a screen session, check if the screen window is focused + if type -q screen + and test -n "$STY" + __done_is_screen_window_active + return $status + end + + return 0 +end + +function __done_humanize_duration -a milliseconds + set -l seconds (math --scale=0 "$milliseconds/1000" % 60) + set -l minutes (math --scale=0 "$milliseconds/60000" % 60) + set -l hours (math --scale=0 "$milliseconds/3600000") + + if test "$hours" -gt 0 + printf '%s' $hours'h ' + end + if test "$minutes" -gt 0 + printf '%s' $minutes'm ' + end + if test "$seconds" -gt 0 + printf '%s' $seconds's' + end +end + +# verify that the system has graphical capabilities before initializing +if test -z "$SSH_CLIENT" # not over ssh + and count (__done_get_focused_window_id) >/dev/null # is able to get window id + set __done_enabled +end + +if set -q __done_allow_nongraphical + and set -q __done_notification_command + set __done_enabled +end + +if set -q __done_enabled + set -g __done_initial_window_id '' + set -q __done_min_cmd_duration; or set -g __done_min_cmd_duration 5000 + set -q __done_exclude; or set -g __done_exclude '^git (?!push|pull|fetch)' + set -q __done_notify_sound; or set -g __done_notify_sound 0 + set -q __done_sway_ignore_visible; or set -g __done_sway_ignore_visible 0 + set -q __done_tmux_pane_format; or set -g __done_tmux_pane_format '[#{window_index}]' + set -q __done_notification_duration; or set -g __done_notification_duration 3000 + + function __done_started --on-event fish_preexec + set __done_initial_window_id (__done_get_focused_window_id) + end + + function __done_ended --on-event fish_postexec + set -l exit_status $status + + # backwards compatibility for fish < v3.0 + set -q cmd_duration; or set -l cmd_duration $CMD_DURATION + + if test -n "$cmd_duration" + and test "$cmd_duration" -gt "$__done_min_cmd_duration" # longer than notify_duration + and not __done_is_process_window_focused # process pane or window not focused + + # don't notify if command matches exclude list + for pattern in $__done_exclude + if string match -qr -- $pattern $argv[1] + return + end + end + + # Store duration of last command + set -l humanized_duration (__done_humanize_duration "$cmd_duration") + + set -l title "Done in $humanized_duration" + set -l wd (string replace --regex "^$HOME" "~" (pwd)) + set -l message "$wd/ $argv[1]" + set -l sender $__done_initial_window_id + + if test "$exit_status" -ne 0 + set title "Failed ($exit_status) after $humanized_duration" + end + + if test -n "$TMUX_PANE" + set message (tmux lsw -F"$__done_tmux_pane_format" -f '#{==:#{pane_id},'$TMUX_PANE'}')" $message" + end + + if set -q __done_notification_command + eval $__done_notification_command + if test "$__done_notify_sound" -eq 1 + echo -e "\a" # bell sound + end + + else if set -q KITTY_WINDOW_ID + printf "\x1b]99;i=done:d=0;$title\x1b\\" + printf "\x1b]99;i=done:d=1:p=body;$message\x1b\\" + + else if test "$TERM_PROGRAM" = ghostty; or test "$TERM_PROGRAM" = WezTerm + printf "\x1b]777;notify;%s;%s\x1b\\" "$title" "$message" + + else if test "$TERM_PROGRAM" = iTerm.app + printf "\x1b]9;%s: %s\x1b\\" "$title" "$message" + + else if type -q terminal-notifier # https://github.com/julienXX/terminal-notifier + if test "$__done_notify_sound" -eq 1 + # pipe message into terminal-notifier to avoid escaping issues (https://github.com/julienXX/terminal-notifier/issues/134). fixes #140 + # not using the -sender option because it hangs for some apps (https://github.com/julienXX/terminal-notifier/issues/301) + echo "$message" | terminal-notifier -title "$title" -sound default + else + echo "$message" | terminal-notifier -title "$title" + end + + else if type -q osascript # AppleScript + # escape double quotes that might exist in the message and break osascript. fixes #133 + set -l message (string replace --all '"' '\"' "$message") + set -l title (string replace --all '"' '\"' "$title") + + if test "$__done_notify_sound" -eq 1 + osascript -e "display notification \"$message\" with title \"$title\" sound name \"Glass\"" + else + osascript -e "display notification \"$message\" with title \"$title\"" + end + + else if type -q notify-send # Linux notify-send + # set urgency to normal + set -l urgency normal + + # use user-defined urgency if set + if set -q __done_notification_urgency_level + set urgency "$__done_notification_urgency_level" + end + # override user-defined urgency level if non-zero exitstatus + if test "$exit_status" -ne 0 + set urgency critical + if set -q __done_notification_urgency_level_failure + set urgency "$__done_notification_urgency_level_failure" + end + end + + notify-send --hint=int:transient:1 --urgency=$urgency --icon=utilities-terminal --app-name=fish --expire-time=$__done_notification_duration "$title" "$message" + + if test "$__done_notify_sound" -eq 1 + echo -e "\a" # bell sound + end + + else if type -q notify-desktop # Linux notify-desktop + set -l urgency + if test "$exit_status" -ne 0 + set urgency "--urgency=critical" + end + notify-desktop $urgency --icon=utilities-terminal --app-name=fish "$title" "$message" + if test "$__done_notify_sound" -eq 1 + echo -e "\a" # bell sound + end + + else if uname -a | string match --quiet --ignore-case --regex microsoft + __done_windows_notification "$title" "$message" + + else # anything else + echo -e "\a" # bell sound + end + + end + end +end + +function __done_uninstall -e done_uninstall + # Erase all __done_* functions + functions -e __done_ended + functions -e __done_started + functions -e __done_get_focused_window_id + functions -e __done_is_tmux_window_active + functions -e __done_is_screen_window_active + functions -e __done_is_process_window_focused + functions -e __done_windows_notification + functions -e __done_run_powershell_script + functions -e __done_humanize_duration + + # Erase __done variables + set -e __done_version +end diff --git a/fish/conf.d/env.fish b/fish/conf.d/env.fish new file mode 100644 index 0000000..5d33027 --- /dev/null +++ b/fish/conf.d/env.fish @@ -0,0 +1,2 @@ +set EDITOR nvim +set VISUAL nvim diff --git a/fish/conf.d/fish_frozen_key_bindings.fish b/fish/conf.d/fish_frozen_key_bindings.fish new file mode 100644 index 0000000..495aee9 --- /dev/null +++ b/fish/conf.d/fish_frozen_key_bindings.fish @@ -0,0 +1,14 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# the 'fish_key_bindings' variable from its old default scope (universal) +# to its new default scope (global). We recommend you delete this file +# and configure key bindings in ~/.config/fish/config.fish if needed. + +# set --global fish_key_bindings fish_default_key_bindings + +# Prior to version 4.3, fish shipped an event handler that runs +# `set --universal fish_key_bindings fish_default_key_bindings` +# whenever the fish_key_bindings variable is erased. +# This means that as long as any fish < 4.3 is still running on this system, +# we cannot complete the migration. +# As a workaround, erase the universal variable at every shell startup. +set --erase --universal fish_key_bindings diff --git a/fish/conf.d/fish_frozen_theme.fish b/fish/conf.d/fish_frozen_theme.fish new file mode 100644 index 0000000..354d401 --- /dev/null +++ b/fish/conf.d/fish_frozen_theme.fish @@ -0,0 +1,47 @@ +# This file was created by fish when upgrading to version 4.3, to migrate +# theme variables from universal to global scope. +# Don't edit this file, as it will be written by the web-config tool (`fish_config`). +# To customize your theme, delete this file and see +# help interactive#syntax-highlighting +# or +# man fish-interactive | less +/^SYNTAX.HIGHLIGHTING +# for appropriate commands to add to ~/.config/fish/config.fish instead. +# See also the release notes for fish 4.3.0 (run `help relnotes`). + +set --global fish_color_autosuggestion brblack +set --global fish_color_cancel --reverse +set --global fish_color_command blue +set --global fish_color_comment red +set --global fish_color_cwd green +set --global fish_color_cwd_root red +set --global fish_color_end green +set --global fish_color_error brred +set --global fish_color_escape brcyan +set --global fish_color_history_current --bold +set --global fish_color_host normal +set --global fish_color_host_remote +set --global fish_color_keyword +set --global fish_color_normal normal +set --global fish_color_operator brcyan +set --global fish_color_option +set --global fish_color_param cyan +set --global fish_color_quote yellow +set --global fish_color_redirection cyan --bold +set --global fish_color_search_match white --background=brblack +set --global fish_color_selection white --bold --background=brblack +set --global fish_color_status red +set --global fish_color_user brgreen +set --global fish_color_valid_path --underline +set --global fish_pager_color_background +set --global fish_pager_color_completion normal +set --global fish_pager_color_description yellow --italics +set --global fish_pager_color_prefix normal --bold --underline +set --global fish_pager_color_progress brwhite --background=cyan +set --global fish_pager_color_secondary_background +set --global fish_pager_color_secondary_completion +set --global fish_pager_color_secondary_description +set --global fish_pager_color_secondary_prefix +set --global fish_pager_color_selected_background --reverse +set --global fish_pager_color_selected_completion +set --global fish_pager_color_selected_description +set --global fish_pager_color_selected_prefix diff --git a/fish/conf.d/fzf.fish b/fish/conf.d/fzf.fish new file mode 100644 index 0000000..8156c11 --- /dev/null +++ b/fish/conf.d/fzf.fish @@ -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 diff --git a/fish/conf.d/hydro.fish b/fish/conf.d/hydro.fish new file mode 100644 index 0000000..fad292e --- /dev/null +++ b/fish/conf.d/hydro.fish @@ -0,0 +1,138 @@ +status is-interactive || exit + +set --global _hydro_git _hydro_git_$fish_pid + +function $_hydro_git --on-variable $_hydro_git + commandline --function repaint +end + +function _hydro_pwd --on-variable PWD --on-variable hydro_ignored_git_paths --on-variable fish_prompt_pwd_dir_length + set --local git_root (command git --no-optional-locks rev-parse --show-toplevel 2>/dev/null) + set --local git_base (string replace --all --regex -- "^.*/" "" "$git_root") + set --local path_sep / + + test "$fish_prompt_pwd_dir_length" = 0 && set path_sep + + if set --query git_root[1] && ! contains -- $git_root $hydro_ignored_git_paths + set --erase _hydro_skip_git_prompt + else + set --global _hydro_skip_git_prompt + end + + set --global _hydro_pwd ( + string replace --ignore-case -- ~ \~ $PWD | + string replace -- "/$git_base/" /:/ | + string replace --regex --all -- "(\.?[^/]{"( + string replace --regex --all -- '^$' 1 "$fish_prompt_pwd_dir_length" + )"})[^/]*/" "\$1$path_sep" | + string replace -- : "$git_base" | + string replace --regex -- '([^/]+)$' "\x1b[1m\$1\x1b[22m" | + string replace --regex --all -- '(?!^/$)/|^$' "\x1b[2m/\x1b[22m" + ) +end + +function _hydro_postexec --on-event fish_postexec + set --local last_status $pipestatus + set --global _hydro_status "$_hydro_newline$_hydro_color_prompt$hydro_symbol_prompt" + + for code in $last_status + if test $code -ne 0 + set --global _hydro_status "$_hydro_color_error| "(echo $last_status)" $_hydro_newline$_hydro_color_prompt$_hydro_color_error$hydro_symbol_prompt" + break + end + end + + test "$CMD_DURATION" -lt $hydro_cmd_duration_threshold && set _hydro_cmd_duration && return + + set --local secs (math --scale=1 $CMD_DURATION/1000 % 60) + set --local mins (math --scale=0 $CMD_DURATION/60000 % 60) + set --local hours (math --scale=0 $CMD_DURATION/3600000) + + set --local out + + test $hours -gt 0 && set --local --append out $hours"h" + test $mins -gt 0 && set --local --append out $mins"m" + test $secs -gt 0 && set --local --append out $secs"s" + + set --global _hydro_cmd_duration "$out " +end + +function _hydro_prompt --on-event fish_prompt + set --query _hydro_status || set --global _hydro_status "$_hydro_newline$_hydro_color_prompt$hydro_symbol_prompt" + set --query _hydro_pwd || _hydro_pwd + + command kill $_hydro_last_pid 2>/dev/null + + set --query _hydro_skip_git_prompt && set $_hydro_git && return + + fish --private --command " + set branch ( + command git branch --show-current 2>/dev/null || + command git describe --tags --exact-match HEAD 2>/dev/null || + command git rev-parse --short HEAD 2>/dev/null | + string replace --regex -- '(.+)' '@\$1' + ) + + test -z \"\$$_hydro_git\" && set --universal $_hydro_git \"\$branch \" + + command git diff-index --quiet HEAD 2>/dev/null + test \$status -eq 1 || + count (command git ls-files --others --exclude-standard (command git rev-parse --show-toplevel)) >/dev/null && set info \"$hydro_symbol_git_dirty\" + + for fetch in $hydro_fetch false + command git rev-list --count --left-right @{upstream}...@ 2>/dev/null | + read behind ahead + + switch \"\$behind \$ahead\" + case \" \" \"0 0\" + case \"0 *\" + set upstream \" $hydro_symbol_git_ahead\$ahead\" + case \"* 0\" + set upstream \" $hydro_symbol_git_behind\$behind\" + case \* + set upstream \" $hydro_symbol_git_ahead\$ahead $hydro_symbol_git_behind\$behind\" + end + + set --universal $_hydro_git \"\$branch\$info\$upstream \" + + test \$fetch = true && command git fetch --no-tags 2>/dev/null + end + " & + + set --global _hydro_last_pid $last_pid +end + +function _hydro_fish_exit --on-event fish_exit + set --erase $_hydro_git +end + +function _hydro_uninstall --on-event hydro_uninstall + set --names | + string replace --filter --regex -- "^(_?hydro_)" "set --erase \$1" | + source + functions --erase (functions --all | string match --entire --regex "^_?hydro_") +end + +set --global hydro_color_normal (set_color normal) + +for color in hydro_color_{pwd,git,error,prompt,duration,start} + function $color --on-variable $color --inherit-variable color + set --query $color && set --global _$color (set_color $$color) + end && $color +end + +function hydro_multiline --on-variable hydro_multiline + if test "$hydro_multiline" = true + set --global _hydro_newline "\n" + else + set --global _hydro_newline "" + end +end && hydro_multiline + +set --query hydro_color_error || set --global hydro_color_error $fish_color_error +set --query hydro_symbol_prompt || set --global hydro_symbol_prompt ❱ +set --query hydro_symbol_git_dirty || set --global hydro_symbol_git_dirty • +set --query hydro_symbol_git_ahead || set --global hydro_symbol_git_ahead ↑ +set --query hydro_symbol_git_behind || set --global hydro_symbol_git_behind ↓ +set --query hydro_multiline || set --global hydro_multiline false +set --query hydro_cmd_duration_threshold || set --global hydro_cmd_duration_threshold 1000 diff --git a/fish/conf.d/kitty.fish b/fish/conf.d/kitty.fish new file mode 100644 index 0000000..e40236f --- /dev/null +++ b/fish/conf.d/kitty.fish @@ -0,0 +1,5 @@ +if set -q KITTY_INSTALLATION_DIR + set --global KITTY_SHELL_INTEGRATION enabled + source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish" + set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d" +end |
