🗑️ remove(fish): a lot of unnecesary files

this can be downloaded with fisher and the plugins file
This commit is contained in:
Sergio Laín 2024-08-09 14:27:09 +02:00
parent 7ce2fa14bc
commit 34b31ebcb5
No known key found for this signature in database
GPG key ID: 8429B2EE312F8150
46 changed files with 0 additions and 1686 deletions

View file

@ -1,33 +0,0 @@
complete -c bob -n "__fish_use_subcommand" -s h -l help -d 'Print help'
complete -c bob -n "__fish_use_subcommand" -s V -l version -d 'Print version'
complete -c bob -n "__fish_use_subcommand" -f -a "use" -d 'Switch to the specified version, by default will auto-invoke install command if the version is not installed already'
complete -c bob -n "__fish_use_subcommand" -f -a "install" -d 'Install the specified version, can also be used to update out-of-date nightly version'
complete -c bob -n "__fish_use_subcommand" -f -a "sync" -d 'If Config::version_sync_file_location is set, the version in that file will be parsed and installed'
complete -c bob -n "__fish_use_subcommand" -f -a "uninstall" -d 'Uninstall the specified version'
complete -c bob -n "__fish_use_subcommand" -f -a "rollback" -d 'Rollback to an existing nightly rollback'
complete -c bob -n "__fish_use_subcommand" -f -a "erase" -d 'Erase any change bob ever made, including neovim installation, neovim version downloads and registry changes'
complete -c bob -n "__fish_use_subcommand" -f -a "list" -d 'List all installed and used versions'
complete -c bob -n "__fish_use_subcommand" -f -a "complete" -d 'Generate shell completion'
complete -c bob -n "__fish_use_subcommand" -f -a "update" -d 'Update existing version'
complete -c bob -n "__fish_use_subcommand" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'
complete -c bob -n "__fish_seen_subcommand_from use" -s n -l no-install -d 'Whether not to auto-invoke install command'
complete -c bob -n "__fish_seen_subcommand_from use" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from install" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from sync" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from uninstall" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from rollback" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from erase" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from list" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from complete" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from update" -s a -l all -d 'Apply the update to all versions'
complete -c bob -n "__fish_seen_subcommand_from update" -s h -l help -d 'Print help'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "use" -d 'Switch to the specified version, by default will auto-invoke install command if the version is not installed already'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "install" -d 'Install the specified version, can also be used to update out-of-date nightly version'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "sync" -d 'If Config::version_sync_file_location is set, the version in that file will be parsed and installed'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "uninstall" -d 'Uninstall the specified version'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "rollback" -d 'Rollback to an existing nightly rollback'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "erase" -d 'Erase any change bob ever made, including neovim installation, neovim version downloads and registry changes'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "list" -d 'List all installed and used versions'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "complete" -d 'Generate shell completion'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "update" -d 'Update existing version'
complete -c bob -n "__fish_seen_subcommand_from help; and not __fish_seen_subcommand_from use; and not __fish_seen_subcommand_from install; and not __fish_seen_subcommand_from sync; and not __fish_seen_subcommand_from uninstall; and not __fish_seen_subcommand_from rollback; and not __fish_seen_subcommand_from erase; and not __fish_seen_subcommand_from list; and not __fish_seen_subcommand_from complete; and not __fish_seen_subcommand_from update; and not __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)'

View file

@ -1,9 +0,0 @@
complete fzf_configure_bindings --no-files
complete fzf_configure_bindings --long help --short h --description "Print help" --condition "not __fish_seen_argument --help -h"
complete fzf_configure_bindings --long directory --description "Change the key binding for Search Directory" --condition "not __fish_seen_argument --directory"
complete fzf_configure_bindings --long git_log --description "Change the key binding for Search Git Log" --condition "not __fish_seen_argument --git_log"
complete fzf_configure_bindings --long git_status --description "Change the key binding for Search Git Status" --condition "not __fish_seen_argument --git_status"
complete fzf_configure_bindings --long history --description "Change the key binding for Search History" --condition "not __fish_seen_argument --history"
complete fzf_configure_bindings --long processes --description "Change the key binding for Search Processes" --condition "not __fish_seen_argument --processes"
complete fzf_configure_bindings --long variables --description "Change the key binding for Search Variables" --condition "not __fish_seen_argument --variables"
complete fzf_configure_bindings --long completions --description "Change the key binding for searching completions" --condition "not __fish_seen_argument --completions"

View file

@ -1 +0,0 @@
gtrash completion fish | source

View file

@ -1,140 +0,0 @@
for mode in default insert
bind --mode $mode " " __abbr_tips_bind_space
bind --mode $mode \n __abbr_tips_bind_newline
bind --mode $mode \r __abbr_tips_bind_newline
end
set -g __abbr_tips_used 0
# Trim simple/double quotes from args
function trim_value
echo "$argv" | string trim --left --right --chars '"\'' | string join ' '
end
function __abbr_tips_install --on-event abbr_tips_install
# Regexes used to find abbreviation inside command
# Only the first matching group will be tested as an abbr
set -Ux ABBR_TIPS_REGEXES
set -a ABBR_TIPS_REGEXES '(^(\w+\s+)+(-{1,2})\w+)(\s\S+)'
set -a ABBR_TIPS_REGEXES '(^(\s?(\w-?)+){3}).*'
set -a ABBR_TIPS_REGEXES '(^(\s?(\w-?)+){2}).*'
set -a ABBR_TIPS_REGEXES '(^(\s?(\w-?)+){1}).*'
set -Ux ABBR_TIPS_PROMPT "\n💡 \e[1m{{ .abbr }}\e[0m => {{ .cmd }}"
set -gx ABBR_TIPS_AUTO_UPDATE background
__abbr_tips_init
end
function __abbr_tips --on-event fish_postexec -d "Abbreviation reminder for the current command"
set -l command (string split ' ' -- "$argv")
set -l cmd (string replace -r -a '\\s+' ' ' -- "$argv" )
# Update abbreviations lists when adding/removing abbreviations
if test "$command[1]" = abbr
# Parse args as abbr options
argparse --name abbr --ignore-unknown a/add e/erase g/global U/universal -- $command
if set -q _flag_a
and not contains -- "$argv[2]" $__ABBR_TIPS_KEYS
set -a __ABBR_TIPS_KEYS "$argv[2]"
set -a __ABBR_TIPS_VALUES (trim_value "$argv[3..-1]")
else if set -q _flag_e
and set -l abb (contains -i -- "$argv[2]" $__ABBR_TIPS_KEYS)
set -e __ABBR_TIPS_KEYS[$abb]
set -e __ABBR_TIPS_VALUES[$abb]
end
else if test "$command[1]" = alias
# Update abbreviations list when adding aliases
set -l alias_key
set -l alias_value
# Parse args as `alias` options
argparse --name alias --ignore-unknown s/save -- $command
if string match -q '*=*' -- "$argv[2]"
set command_split (string split '=' -- $argv[2])
set alias_key "a__$command_split[1]"
set alias_value $command_split[2..-1]
else
set alias_key "a__$argv[2]"
set alias_value $argv[3..-1]
end
set alias_value (trim_value "$alias_value")
if set -l abb (contains -i -- "$argv[3..-1]" $__ABBR_TIPS_KEYS)
set __ABBR_TIPS_KEYS[$abb] $alias_key
set __ABBR_TIPS_VALUES[$abb] $alias_value
else
set -a __ABBR_TIPS_KEYS $alias_key
set -a __ABBR_TIPS_VALUES $alias_value
end
else if test "$command[1]" = functions
# Parse args as `functions` options
argparse --name functions e/erase -- $command
# Update abbreviations list when removing aliases
if set -q _flag_e
and set -l abb (contains -i -- a__{$argv[2]} $__ABBR_TIPS_KEYS)
set -e __ABBR_TIPS_KEYS[$abb]
set -e __ABBR_TIPS_VALUES[$abb]
end
end
# Exit in the following cases :
# - abbreviation has been used
# - command is already an abbreviation
# - command not found
# - or it's a function (alias)
if test $__abbr_tips_used = 1
set -g __abbr_tips_used 0
return
else if abbr -q "$cmd"
or not type -q "$command[1]"
return
else if string match -q -- "alias $cmd *" (alias)
return
else if test (type -t "$command[1]") = function
and count $ABBR_TIPS_ALIAS_WHITELIST >/dev/null
and not contains "$command[1]" $ABBR_TIPS_ALIAS_WHITELIST
return
end
set -l abb
if not set abb (contains -i -- "$cmd" $__ABBR_TIPS_VALUES)
for r in $ABBR_TIPS_REGEXES
if set abb (contains -i -- (string replace -r -a -- "$r" '$1' "$cmd") $__ABBR_TIPS_VALUES)
break
end
end
end
if test -n "$abb"
if string match -q "a__*" -- "$__ABBR_TIPS_KEYS[$abb]"
set -l alias (string sub -s 4 -- "$__ABBR_TIPS_KEYS[$abb]")
if functions -q "$alias"
echo -e (string replace -a '{{ .cmd }}' -- "$__ABBR_TIPS_VALUES[$abb]" \
(string replace -a '{{ .abbr }}' -- "$alias" "$ABBR_TIPS_PROMPT"))
else
set -e __ABBR_TIPS_KEYS[$abb]
set -e __ABBR_TIPS_VALUES[$abb]
end
else
echo -e (string replace -a '{{ .cmd }}' -- "$__ABBR_TIPS_VALUES[$abb]" \
(string replace -a '{{ .abbr }}' -- "$__ABBR_TIPS_KEYS[$abb]" "$ABBR_TIPS_PROMPT"))
end
end
return
end
function __abbr_tips_update --on-event abbr_tips_update
__abbr_tips_clean
__abbr_tips_install
end
function __abbr_tips_uninstall --on-event abbr_tips_uninstall
__abbr_tips_clean
functions --erase __abbr_tips_init
end

View file

@ -1,39 +0,0 @@
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

View file

@ -1,334 +0,0 @@
# 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.19.3
function __done_run_powershell_script
set -l powershell_exe (command --search "powershell.exe")
if test $status -ne 0
and command --search wslvar
set -l 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 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")
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 "$__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 $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 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
echo "$message" | terminal-notifier -title "$title" -sender "$__done_initial_window_id" -sound default
else
echo "$message" | terminal-notifier -title "$title" -sender "$__done_initial_window_id"
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

View file

@ -1,7 +0,0 @@
if test -z "$SSH_ENV"
set -xg SSH_ENV $HOME/.ssh/environment
end
if not __ssh_agent_is_started
__ssh_agent_start
end

View file

@ -1,28 +0,0 @@
# 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

View file

@ -1,45 +0,0 @@
# Catppuccin color palette
# --> special
set -l foreground cad3f5
set -l selection 363a4f
# --> palette
set -l teal 8bd5ca
set -l flamingo f0c6c6
set -l mauve c6a0f6
set -l pink f5bde6
set -l red ed8796
set -l peach f5a97f
set -l green a6da95
set -l yellow eed49f
set -l blue 8aadf4
set -l gray 6e738d
# Syntax Highlighting
set -g fish_color_normal $foreground
set -g fish_color_command $blue
set -g fish_color_param $flamingo
set -g fish_color_keyword $red
set -g fish_color_quote $green
set -g fish_color_redirection $pink
set -g fish_color_end $peach
set -g fish_color_error $red
set -g fish_color_gray $gray
set -g fish_color_selection --background=$selection
set -g fish_color_search_match --background=$selection
set -g fish_color_operator $pink
set -g fish_color_escape $flamingo
set -g fish_color_autosuggestion $gray
set -g fish_color_cancel $red
# Prompt
set -g fish_color_cwd $yellow
set -g fish_color_user $teal
set -g fish_color_host $blue
# Completion Pager
set -g fish_pager_color_progress $gray
set -g fish_pager_color_prefix $pink
set -g fish_pager_color_completion $foreground
set -g fish_pager_color_description $gray

View file

@ -1,38 +0,0 @@
# default key sequence:
set -q sudope_sequence
or switch $FISH_VERSION
case '2.0' '2.0.*' '2.1' '2.1.*' '2.2' '2.2.*'
# use Ctrl+s for fish 2.2 and earlier, as Esc is not usable as a meta key.
set sudope_sequence \cs
case '*'
# use Esc+Esc for fish 2.3+
set sudope_sequence \e\e
end
function __sudope_bind -a sequence # modifiers..
set -l modifiers $argv[2..-1]
set -l current_binding (bind $modifiers $sequence 2>/dev/null | cut -d' ' -f2-)
if test -n "$current_binding"
echo "sudope: The sequence `$sequence` is already bound to: `$current_binding` (`$modifiers`)"
else
bind $modifiers -- $sequence sudope
end
end
# if sudope is already bound to some sequence, leave it
if bind | string match -rq '[[:space:]]sudope$'
exit
end
set -l -- bind_modifiers '--mode' "$fish_bind_mode"
switch $FISH_VERSION
case '2.*'
# no change
case '*'
# in 3.x, fish added a default binding for a more naive version of sudope,
# and we want to use ours. so we'll use the 3.x+ `--user` flag to override the preset.
set -- bind_modifiers $bind_modifiers '--user'
end
__sudope_bind $sudope_sequence $bind_modifiers

View file

@ -1,25 +0,0 @@
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

View file

@ -1,10 +0,0 @@
function __abbr_tips_bind_newline
if test $__abbr_tips_used != 1
if abbr -q -- (string trim -- (commandline))
set -g __abbr_tips_used 1
else
set -g __abbr_tips_used 0
end
end
commandline -f execute
end

View file

@ -1,11 +0,0 @@
function __abbr_tips_bind_space
commandline -i " "
if test $__abbr_tips_used != 1
if abbr -q -- (string trim -- (commandline))
set -g __abbr_tips_used 1
else
set -g __abbr_tips_used 0
end
end
commandline -f expand-abbr
end

View file

@ -1,16 +0,0 @@
function __abbr_tips_clean -d "Clean plugin variables and functions"
bind --erase \n
bind --erase \r
bind --erase " "
set --erase __abbr_tips_used
set --erase __abbr_tips_run_once
set --erase __ABBR_TIPS_VALUES
set --erase __ABBR_TIPS_KEYS
set --erase ABBR_TIPS_PROMPT
set --erase ABBR_TIPS_AUTO_UPDATE
set --erase ABBR_TIPS_ALIAS_WHITELIST
set --erase ABBR_TIPS_REGEXES
functions --erase __abbr_tips_bind_newline
functions --erase __abbr_tips_bind_space
functions --erase __abbr_tips
end

View file

@ -1,24 +0,0 @@
function __abbr_tips_init -d "Initialize abbreviations variables for fish-abbr-tips"
set -e __ABBR_TIPS_KEYS
set -e __ABBR_TIPS_VALUES
set -Ux __ABBR_TIPS_KEYS
set -Ux __ABBR_TIPS_VALUES
set -l i 1
set -l abb (string replace -r '.*-- ' '' -- (abbr -s))
while test $i -le (count $abb)
set -l current_abb (string split -m1 -- ' ' "$abb[$i]")
set -a __ABBR_TIPS_KEYS "$current_abb[1]"
set -a __ABBR_TIPS_VALUES (string trim -c '\'' -- "$current_abb[2]")
set i (math $i + 1)
end
set -l i 1
set -l abb (string replace -r '.*-- ' '' -- (alias -s))
while test $i -le (count $abb)
set -l current_abb (string split -m2 -- ' ' "$abb[$i]")
set -a __ABBR_TIPS_KEYS "a__$current_abb[2]"
set -a __ABBR_TIPS_VALUES (string trim -c '\'' -- "$current_abb[3]")
set i (math $i + 1)
end
end

View file

@ -1,14 +0,0 @@
function __ssh_agent_is_started -d "check if ssh agent is already started"
if begin; test -f $SSH_ENV; and test -z "$SSH_AGENT_PID"; end
source $SSH_ENV > /dev/null
end
if begin; test -z "$SSH_AGENT_PID"; and test -z "$SSH_CONNECTION"; end
return 1
end
ssh-add -l > /dev/null 2>&1
if test $status -eq 2
return 1
end
end

View file

@ -1,5 +0,0 @@
function __ssh_agent_start -d "start a new ssh agent"
ssh-agent -c | sed 's/^echo/#echo/' > $SSH_ENV
chmod 600 $SSH_ENV
source $SSH_ENV > /dev/null
end

View file

@ -1,9 +0,0 @@
function _autopair_backspace
set --local index (commandline --cursor)
set --local buffer (commandline)
test $index -ge 1 &&
contains -- (string sub --start=$index --length=2 -- "$buffer") $autopair_pairs &&
commandline --function delete-char
commandline --function backward-delete-char
end

View file

@ -1,13 +0,0 @@
function _autopair_insert_left --argument-names left right
set --local buffer (commandline)
set --local before (commandline --cut-at-cursor)
commandline --insert -- $left
switch "$buffer"
case "$before"{," "\*,$autopair_right\*}
set --local index (commandline --cursor)
commandline --insert -- $right
commandline --cursor $index
end
end

View file

@ -1,11 +0,0 @@
function _autopair_insert_right --argument-names key
set --local buffer (commandline)
set --local before (commandline --cut-at-cursor)
switch "$buffer"
case "$before$key"\*
commandline --cursor (math (commandline --cursor) + 1)
case \*
commandline --insert -- $key
end
end

View file

@ -1,20 +0,0 @@
function _autopair_insert_same --argument-names key
set --local buffer (commandline)
set --local index (commandline --cursor)
set --local next (string sub --start=(math $index + 1) --length=1 -- "$buffer")
if test (math (count (string match --all --regex -- "$key" "$buffer")) % 2) = 0
test $key = $next && commandline --cursor (math $index + 1) && return
commandline --insert -- $key
if test $index -lt 1 ||
contains -- (string sub --start=$index --length=1 -- "$buffer") "" " " $autopair_left &&
contains -- $next "" " " $autopair_right
commandline --insert -- $key
commandline --cursor (math $index + 1)
end
else
commandline --insert -- $key
end
end

View file

@ -1,7 +0,0 @@
function _autopair_tab
commandline --paging-mode && down-or-search && return
string match --quiet --regex -- '\$[^\s]*"$' (commandline --current-token) &&
commandline --function end-of-line --function backward-delete-char
commandline --function complete
end

View file

@ -1,43 +0,0 @@
function _fzf_configure_bindings_help --description "Prints the help message for fzf_configure_bindings."
echo "\
USAGE:
fzf_configure_bindings [--COMMAND=[KEY_SEQUENCE]...]
DESCRIPTION
fzf_configure_bindings installs key bindings for fzf.fish's commands and erases any bindings it
previously installed. It installs bindings for both default and insert modes. fzf.fish executes
it without options on fish startup to install the out-of-the-box key bindings.
By default, commands are bound to a mnemonic key sequence, shown below. Each command's binding
can be configured using a namesake corresponding option:
COMMAND | DEFAULT KEY SEQUENCE | CORRESPONDING OPTION
Search Directory | Ctrl+Alt+F (F for file) | --directory
Search Git Log | Ctrl+Alt+L (L for log) | --git_log
Search Git Status | Ctrl+Alt+S (S for status) | --git_status
Search History | Ctrl+R (R for reverse) | --history
Search Processes | Ctrl+Alt+P (P for process) | --processes
Search Variables | Ctrl+V (V for variable) | --variables
Override a command's binding by specifying its corresponding option with the desired key
sequence. Disable a command's binding by specifying its corresponding option with no value.
Because fzf_configure_bindings erases bindings it previously installed, it can be cleanly
executed multiple times. Once the desired fzf_configure_bindings command has been found, add it
to your config.fish in order to persist the customized bindings.
In terms of validation, fzf_configure_bindings fails if passed unknown options. It expects an
equals sign between an option's name and value. However, it does not validate key sequences.
Pass -h or --help to print this help message and exit.
EXAMPLES
Default bindings but bind Search Directory to Ctrl+F and Search Variables to Ctrl+Alt+V
\$ fzf_configure_bindings --directory=\cf --variables=\e\cv
Default bindings but disable Search History
\$ fzf_configure_bindings --history=
An agglomeration of different options
\$ fzf_configure_bindings --git_status=\cg --history=\ch --variables= --processes=
SEE Also
To learn more about fish key bindings, see bind(1) and fish_key_reader(1).
"
end

View file

@ -1,15 +0,0 @@
# helper function for _fzf_search_variables
function _fzf_extract_var_info --argument-names variable_name set_show_output --description "Extract and reformat lines pertaining to \$variable_name from \$set_show_output."
# Extract only the lines about the variable, all of which begin with either
# $variable_name: ...or... $variable_name[
string match --regex "^\\\$$variable_name(?::|\[).*" <$set_show_output |
# Strip the variable name prefix, including ": " for scope info lines
string replace --regex "^\\\$$variable_name(?:: )?" '' |
# Distill the lines of values, replacing...
# [1]: |value|
# ...with...
# [1] value
string replace --regex ": \|(.*)\|" ' $1'
end

View file

@ -1,49 +0,0 @@
# helper for _fzf_search_git_status
# arg should be a line from git status --short, e.g.
# MM functions/_fzf_preview_changed_file.fish
# D README.md
# R LICENSE -> "New License"
function _fzf_preview_changed_file --argument-names path_status --description "Show the git diff of the given file."
# remove quotes because they'll be interpreted literally by git diff
# no need to requote when referencing $path because fish does not perform word splitting
# https://fishshell.com/docs/current/fish_for_bash_users.html
set -f path (string unescape (string sub --start 4 $path_status))
# first letter of short format shows index, second letter shows working tree
# https://git-scm.com/docs/git-status/2.35.0#_short_format
set -f index_status (string sub --length 1 $path_status)
set -f working_tree_status (string sub --start 2 --length 1 $path_status)
set -f diff_opts --color=always
if test $index_status = '?'
_fzf_report_diff_type Untracked
_fzf_preview_file $path
else if contains {$index_status}$working_tree_status DD AU UD UA DU AA UU
# Unmerged statuses taken directly from git status help's short format table
# Unmerged statuses are mutually exclusive with other statuses, so if we see
# these, then safe to assume the path is unmerged
_fzf_report_diff_type Unmerged
git diff $diff_opts -- $path
else
if test $index_status != ' '
_fzf_report_diff_type Staged
# renames are only detected in the index, never working tree, so only need to test for it here
# https://stackoverflow.com/questions/73954214
if test $index_status = R
# diff the post-rename path with the original path, otherwise the diff will show the entire file as being added
set -f orig_and_new_path (string split --max 1 -- ' -> ' $path)
git diff --staged $diff_opts -- $orig_and_new_path[1] $orig_and_new_path[2]
# path currently has the form of "original -> current", so we need to correct it before it's used below
set path $orig_and_new_path[2]
else
git diff --staged $diff_opts -- $path
end
end
if test $working_tree_status != ' '
_fzf_report_diff_type Unstaged
git diff $diff_opts -- $path
end
end
end

View file

@ -1,43 +0,0 @@
# helper function for _fzf_search_directory and _fzf_search_git_status
function _fzf_preview_file --description "Print a preview for the given file based on its file type."
# because there's no way to guarantee that _fzf_search_directory passes the path to _fzf_preview_file
# as one argument, we collect all the arguments into one single variable and treat that as the path
set -f file_path $argv
if test -L "$file_path" # symlink
# notify user and recurse on the target of the symlink, which can be any of these file types
set -l target_path (realpath "$file_path")
set_color yellow
echo "'$file_path' is a symlink to '$target_path'."
set_color normal
_fzf_preview_file "$target_path"
else if test -f "$file_path" # regular file
if set --query fzf_preview_file_cmd
# need to escape quotes to make sure eval receives file_path as a single arg
eval "$fzf_preview_file_cmd '$file_path'"
else
bat --style=numbers --color=always "$file_path"
end
else if test -d "$file_path" # directory
if set --query fzf_preview_dir_cmd
# see above
eval "$fzf_preview_dir_cmd '$file_path'"
else
# -A list hidden files as well, except for . and ..
# -F helps classify files by appending symbols after the file name
command ls -A -F "$file_path"
end
else if test -c "$file_path"
_fzf_report_file_type "$file_path" "character device file"
else if test -b "$file_path"
_fzf_report_file_type "$file_path" "block device file"
else if test -S "$file_path"
_fzf_report_file_type "$file_path" socket
else if test -p "$file_path"
_fzf_report_file_type "$file_path" "named pipe"
else
echo "$file_path doesn't exist." >&2
end
end

View file

@ -1,18 +0,0 @@
# helper for _fzf_preview_changed_file
# prints out something like
# ╭────────╮
# │ Staged │
# ╰────────╯
function _fzf_report_diff_type --argument-names diff_type --description "Print a distinct colored header meant to preface a git patch."
# number of "-" to draw is the length of the string to box + 2 for padding
set -f repeat_count (math 2 + (string length $diff_type))
set -f line (string repeat --count $repeat_count)
set -f top_border$line
set -f btm_border$line
set_color yellow
echo $top_border
echo "$diff_type"
echo $btm_border
set_color normal
end

View file

@ -1,6 +0,0 @@
# helper function for _fzf_preview_file
function _fzf_report_file_type --argument-names file_path file_type --description "Explain the file type for a file."
set_color red
echo "Cannot preview '$file_path': it is a $file_type."
set_color normal
end

View file

@ -1,189 +0,0 @@
# External limitations:
# - fish-shell/fish-shell#9577: folders ending in '=' break fish's internal path completion
# (It thinks that it has to complete from / because `a_folder=/` looks like an argument to fish.
# - fish cannot give reliable context information on completions. Knowing whether a completion
# is a file or argument can only be determined via a heuristic.
# - Completion is slow. Not because this script is slow but because fish's `complete` command
# can take several seconds even for just 100 entries. Just run `time complete --escape --do-complete l`
# to see for yourself.
set --global _fzf_search_completions_min_description_offset 14
function _fzf_search_completions --description "Shell completion using fzf"
# Produce a list of completions from which to choose
# and do nothing if there is nothing to select from
set -l cmd (commandline --cut-at-cursor --tokenize) (commandline --current-token)
set -l completions (complete --escape --do-complete "$cmd")
test (count $completions) -eq 0; and return
set -l results
set -l first_completion (string split --fields 1 --max 1 --right \t -- $completions[1])
# A prefix that will be prepended before each selected completion
set -l each_prefix ""
# Only skip fzf if there is a single completion and it starts with the expected completion prefix.
# Otherwise, the completion originates from a match in the description which the user might
# want to review first (e.g. man ima<TAB> might match `feh`, an image viewer)
if test (count $completions) -eq 1; and test (string sub -l (string length -- (commandline -ct)) -- $first_completion) = (commandline -ct)
# If there is only one option then we don't need fzf
set results $first_completion
else
# Preprocess the whole list and extract the actual completion any the corresponding description (if any)
# From here on, make sure to use -- (argument list end) and zero termination everywhere to prevent introducing
# new edge-cases where characters are interpreted wrongly
set -l actual_completions
set -l descriptions
for i in (seq (count $completions))
# split on \t from the right, at most one time and use the first (left) field.
# This is the actual completion
set --append actual_completions (string split --fields 1 --max 1 --right \t -- $completions[$i])
# The other field is the description, if it exists (otherwise set empty).
set --append descriptions (string split --fields 2 --max 1 --right \t -- $completions[$i] ; or echo "")
end
# Find the common prefix of all completions. Yes this seems to be a hard
# thing to do in fish if it should be fast. No external process may be
# spawned as this is too slow. So fish internals it is :/
set -l common_prefix $completions[1]
set -l common_prefix_length (string length -- $common_prefix)
for comp in $actual_completions[2..]
if test (string sub -l $common_prefix_length -- $comp) != $common_prefix
set -l new_common_prefix_length 0
set -l try_common_prefix_length (math min $common_prefix_length,(string length -- $comp))
# Binary search for new common prefix
set -l step $try_common_prefix_length
while test $step != 0
set step (math --scale 0 $step / 2)
# Adjust range to the left or right depending on whether the current new prefix matches
set -l xs (string sub -l $try_common_prefix_length -- $comp $common_prefix)
set -l op (test $xs[1] = $xs[2]; and printf "+"; and set new_common_prefix_length $try_common_prefix_length; or printf "-")
set try_common_prefix_length (math --scale 0 $try_common_prefix_length $op (math max 1,$step))
end
set common_prefix_length $new_common_prefix_length
set common_prefix (string sub -l $new_common_prefix_length -- $common_prefix)
# Stop if there is no common prefix
test $common_prefix_length = 0; and break
end
end
# If the common prefix includes a / we are completing a file path.
# Strip the prefix until the last / completely and later re-add it on the replaced token
set -l path_prefix (string match --regex --groups-only -- '^(.*/)[^/]*$' $common_prefix)
if test $status = 0
set -l path_prefix_length (string length -- $path_prefix)
set -l new_start (math 1 + $path_prefix_length)
for i in (seq (count $completions))
set completions[$i] (string sub -s $new_start -- $completions[$i])
set actual_completions[$i] (string sub -s $new_start -- $actual_completions[$i])
end
# We have a path-like prefix and will therefore strip this common prefix from all
# completions to un-clutter the menu.
set each_prefix (string sub -l $path_prefix_length -- $common_prefix)
set common_prefix_length (math $common_prefix_length - $path_prefix_length)
set common_prefix (string sub -s $new_start -- $common_prefix)
end
# Detect whether descriptions are present and the length of each completion.
set -l has_descriptions false
set -l longest_completion $_fzf_search_completions_min_description_offset
for i in (seq (count $completions))
if string match --quiet -- "*"\t"*" $completions[$i]
set has_descriptions true
# Here we additionally remember the longest completion to align the descriptions in fzf later
set longest_completion (math max $longest_completion,(string length -- $actual_completions[$i]))
set completions[$i] $actual_completions[$i]\t(set_color -i yellow)$descriptions[$i](set_color normal)
end
end
# FIXME Would technically work, but not sure it's worth the effort to match the descriptions
# after filtering.
# Remove tokens from the completion list that are already present on the current commandline.
#set -l all_tokens (commandline -o)
#set -l current_token_index (math 1 + (count (commandline -co)))
#set --erase all_tokens[$current_token_index]
#set -l remaining (comm --zero-terminated -23 (string join0 -- $actual_completions | psub) (string join0 -- $all_tokens | sort | psub) | string split0)
# TODO pressing / in a completion should add the completion and immediately start a new completion
test $has_descriptions = true; and set -l fzf_complete_description_opts \
--tabstop=(math 2 + $longest_completion)
set -l fzf_output (
string join0 -- $completions \
| _fzf_wrapper \
--read0 \
--print0 \
--ansi \
--multi \
--bind=tab:down,btab:up,change:top,ctrl-space:toggle \
--tiebreak=begin \
--query=$common_prefix \
--print-query \
$fzf_complete_description_opts \
$fzf_complete_opts \
| string split0)
switch $pipestatus[2]
case 0
# If something was selected, discard the current query
set results $fzf_output[2..-1]
case 1
# User accepted without selecting anything, thus we will
# use just the current query
set results $fzf_output[1]
case '*'
# Fzf failed, do nothing.
commandline -f repaint
return
end
# Strip anything after last \t (the descriptions)
for i in (seq (count $results))
set results[$i] (string split --fields 1 --max 1 --right \t -- $results[$i])
end
end
set -l prefix ""
set -l suffix " "
# By default we want to append a space to completed options.
# While this is always true when competing multiple things, there
# are some cases in which we don't want to add a space:
if test (count $results) -eq 1
# When a completion ends in a / we usually want to keep adding to that completion.
# This may be because it is a directory (or link to a directory), or just
# an option that takes a category/name tuple like `emerge app-shells/fish`.
# Also, completions like ~something are directories.
#
# In a similar manner, completions ending in = are usually part of an argument
# that expects a parameter (like --color= or dd if=). The same logic applies here.
set -l first_char (string sub -l 1 -- $results[1])
set -l last_char (string sub -s -1 -- $results[1])
if test $last_char = =; or test $last_char = /
set suffix ""
else if string match --regex --quiet -- '^~[^/]*$' $results[1]
set suffix /
end
end
if not contains -- -- (commandline -co)
# If a path is being completed and it starts with --, we add -- to terminate argument interpreting.
# Technically not always correct (the program may not accept --), but the alternative is worse
# and this will make the user notice it.
for r in $results
test - = (string sub -l 1 -- $r); and test -e $r; and set prefix "-- "; and break
end
end
# If each_prefix is set, we need to apply it to each result
# before replacing the token
if test -n $each_prefix
set -l new_tokens
for r in $results
set -a new_tokens $each_prefix$r
end
commandline -t -- "$prefix$new_tokens$suffix"
else
commandline -t -- "$prefix$results$suffix"
end
commandline -f repaint
end

View file

@ -1,48 +0,0 @@
function _fzf_search_directory --description "Search the current directory. Replace the current token with the selected file paths."
# Directly use fd binary to avoid output buffering delay caused by a fd alias, if any.
# Debian-based distros install fd as fdfind and the fd package is something else, so
# check for fdfind first. Fall back to "fd" for a clear error message.
set -f fd_cmd (command -v fdfind || command -v fd || echo "fd")
set -f --append fd_cmd --color=always $fzf_fd_opts
# $fzf_dir_opts is the deprecated version of $fzf_directory_opts
set -f fzf_arguments --multi --ansi $fzf_directory_opts
set -f token (commandline --current-token)
# expand any variables or leading tilde (~) in the token
set -f expanded_token (eval echo -- $token)
# unescape token because it's already quoted so backslashes will mess up the path
set -f unescaped_exp_token (string unescape -- $expanded_token)
# If the current token is a directory and has a trailing slash,
# then use it as fd's base directory.
if string match --quiet -- "*/" $unescaped_exp_token && test -d "$unescaped_exp_token"
set --append fd_cmd --base-directory=$unescaped_exp_token
# use the directory name as fzf's prompt to indicate the search is limited to that directory
set --prepend fzf_arguments --prompt="All >" --header 'CTRL-A: All / CTRL-D: Directories / CTRL-F: Files' \
--bind 'ctrl-a:change-prompt(All> )+reload(fd)' \
--bind 'ctrl-d:change-prompt(Directories> )+reload(fd -t d)' \
--bind 'ctrl-f:change-prompt(Files> )+reload(fd -t f)' --preview="_fzf_preview_file $expanded_token{}"
set -f file_paths_selected $unescaped_exp_token($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
else
set --prepend fzf_arguments --prompt="All >" --header 'CTRL-A: All / CTRL-D: Directories / CTRL-F: Files' \
--bind 'ctrl-a:change-prompt(All> )+reload(fd)' \
--bind 'ctrl-d:change-prompt(Directories> )+reload(fd -t d)' \
--bind 'ctrl-f:change-prompt(Files> )+reload(fd -t f)' --query="$unescaped_exp_token" --preview='_fzf_preview_file {}'
set -f file_paths_selected ($fd_cmd 2>/dev/null | _fzf_wrapper $fzf_arguments)
end
# if test $status -eq 0
# commandline --current-token --replace -- (string escape -- $file_paths_selected | string join ' ')
# end
if test $status -eq 0
if test -d $file_paths_selected
cd $file_paths_selected
_fzf_search_directory
else
$EDITOR $file_paths_selected
end
end
commandline --function repaint
end

View file

@ -1,36 +0,0 @@
function _fzf_search_git_log --description "Search the output of git log and preview commits. Replace the current token with the selected commit hash."
if not git rev-parse --git-dir >/dev/null 2>&1
echo '_fzf_search_git_log: Not in a git repository.' >&2
else
if not set --query fzf_git_log_format
# %h gives you the abbreviated commit hash, which is useful for saving screen space, but we will have to expand it later below
set -f fzf_git_log_format '%C(bold blue)%h%C(reset) - %C(cyan)%ad%C(reset) %C(yellow)%d%C(reset) %C(normal)%s%C(reset) %C(dim normal)[%an]%C(reset)'
end
set -f preview_cmd 'git show --color=always --stat --patch {1}'
if set --query fzf_diff_highlighter
set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
end
set -f selected_log_lines (
git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \
_fzf_wrapper --ansi \
--multi \
--scheme=history \
--prompt="Git Log> " \
--preview=$preview_cmd \
--query=(commandline --current-token) \
$fzf_git_log_opts
)
if test $status -eq 0
for line in $selected_log_lines
set -f abbreviated_commit_hash (string split --field 1 " " $line)
set -f full_commit_hash (git rev-parse $abbreviated_commit_hash)
set -f --append commit_hashes $full_commit_hash
end
commandline --current-token --replace (string join ' ' $commit_hashes)
end
end
commandline --function repaint
end

View file

@ -1,41 +0,0 @@
function _fzf_search_git_status --description "Search the output of git status. Replace the current token with the selected file paths."
if not git rev-parse --git-dir >/dev/null 2>&1
echo '_fzf_search_git_status: Not in a git repository.' >&2
else
set -f preview_cmd '_fzf_preview_changed_file {}'
if set --query fzf_diff_highlighter
set preview_cmd "$preview_cmd | $fzf_diff_highlighter"
end
set -f selected_paths (
# Pass configuration color.status=always to force status to use colors even though output is sent to a pipe
git -c color.status=always status --short |
_fzf_wrapper --ansi \
--multi \
--prompt="Git Status> " \
--query=(commandline --current-token) \
--preview=$preview_cmd \
--nth="2.." \
$fzf_git_status_opts
)
if test $status -eq 0
# git status --short automatically escapes the paths of most files for us so not going to bother trying to handle
# the few edges cases of weird file names that should be extremely rare (e.g. "this;needs;escaping")
set -f cleaned_paths
for path in $selected_paths
if test (string sub --length 1 $path) = R
# path has been renamed and looks like "R LICENSE -> LICENSE.md"
# extract the path to use from after the arrow
set --append cleaned_paths (string split -- "-> " $path)[-1]
else
set --append cleaned_paths (string sub --start=4 $path)
end
end
commandline --current-token --replace -- (string join ' ' $cleaned_paths)
end
end
commandline --function repaint
end

View file

@ -1,39 +0,0 @@
function _fzf_search_history --description "Search command history. Replace the command line with the selected command."
# history merge incorporates history changes from other fish sessions
# it errors out if called in private mode
if test -z "$fish_private_mode"
builtin history merge
end
if not set --query fzf_history_time_format
# Reference https://devhints.io/strftime to understand strftime format symbols
set -f fzf_history_time_format "%m-%d %H:%M:%S"
end
# Delinate time from command in history entries using the vertical box drawing char (U+2502).
# Then, to get raw command from history entries, delete everything up to it. The ? on regex is
# necessary to make regex non-greedy so it won't match into commands containing the char.
set -f time_prefix_regex '^.*? │ '
# Delinate commands throughout pipeline using null rather than newlines because commands can be multi-line
set -f commands_selected (
builtin history --null --show-time="$fzf_history_time_format" |
_fzf_wrapper --read0 \
--print0 \
--multi \
--scheme=history \
--prompt="History> " \
--query=(commandline) \
--preview="string replace --regex '$time_prefix_regex' '' -- {} | fish_indent --ansi" \
--preview-window="bottom:3:wrap" \
$fzf_history_opts |
string split0 |
# remove timestamps from commands selected
string replace --regex $time_prefix_regex ''
)
if test $status -eq 0
commandline --replace -- $commands_selected
end
commandline --function repaint
end

View file

@ -1,32 +0,0 @@
function _fzf_search_processes --description "Search all running processes. Replace the current token with the pid of the selected process."
# Directly use ps command because it is often aliased to a different command entirely
# or with options that dirty the search results and preview output
set -f ps_cmd (command -v ps || echo "ps")
# use all caps to be consistent with ps default format
# snake_case because ps doesn't seem to allow spaces in the field names
set -f ps_preview_fmt (string join ',' 'pid' 'ppid=PARENT' 'user' '%cpu' 'rss=RSS_IN_KB' 'start=START_TIME' 'command')
set -f processes_selected (
$ps_cmd -A -opid,command | \
_fzf_wrapper --multi \
--prompt="Processes> " \
--query (commandline --current-token) \
--ansi \
# first line outputted by ps is a header, so we need to mark it as so
--header-lines=1 \
# ps uses exit code 1 if the process was not found, in which case show an message explaining so
--preview="$ps_cmd -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \
--preview-window="bottom:4:wrap" \
$fzf_processes_opts
)
if test $status -eq 0
for process in $processes_selected
set -f --append pids_selected (string split --no-empty --field=1 -- " " $process)
end
# string join to replace the newlines outputted by string split with spaces
commandline --current-token --replace -- (string join ' ' $pids_selected)
end
commandline --function repaint
end

View file

@ -1,47 +0,0 @@
# This function expects the following two arguments:
# argument 1 = output of (set --show | psub), i.e. a file with the scope info and values of all variables
# argument 2 = output of (set --names | psub), i.e. a file with all variable names
function _fzf_search_variables --argument-names set_show_output set_names_output --description "Search and preview shell variables. Replace the current token with the selected variable."
if test -z "$set_names_output"
printf '%s\n' '_fzf_search_variables requires 2 arguments.' >&2
commandline --function repaint
return 22 # 22 means invalid argument in POSIX
end
# Exclude the history variable from being piped into fzf because
# 1. it's not included in $set_names_output
# 2. it tends to be a very large value => increases computation time
# 3._fzf_search_history is a much better way to examine history anyway
set -f all_variable_names (string match --invert history <$set_names_output)
set -f current_token (commandline --current-token)
# Use the current token to pre-populate fzf's query. If the current token begins
# with a $, remove it from the query so that it will better match the variable names
set -f cleaned_curr_token (string replace -- '$' '' $current_token)
set -f variable_names_selected (
printf '%s\n' $all_variable_names |
_fzf_wrapper --preview "_fzf_extract_var_info {} $set_show_output" \
--prompt="Variables> " \
--preview-window="wrap" \
--multi \
--query=$cleaned_curr_token \
$fzf_variables_opts
)
if test $status -eq 0
# If the current token begins with a $, do not overwrite the $ when
# replacing the current token with the selected variable.
# Uses brace expansion to prepend $ to each variable name.
commandline --current-token --replace (
if string match --quiet -- '$*' $current_token
string join " " \${$variable_names_selected}
else
string join " " $variable_names_selected
end
)
end
commandline --function repaint
end

View file

@ -1,21 +0,0 @@
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

View file

@ -1,10 +0,0 @@
function _puffer_fish_expand_bang
switch (commandline -t)
case '!'
commandline -t $history[1]
commandline -f repaint
case '*'
commandline -i '!'
end
end

View file

@ -1,9 +0,0 @@
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 '*..'; commandline --insert '/..'
case '*'; commandline --insert '.'
end
end

View file

@ -1,9 +0,0 @@
function _puffer_fish_expand_lastarg
switch (commandline -t)
case '!'
commandline -t ""
commandline -f history-token-search-backward
case '*'
commandline -i '$'
end
end

View file

@ -1,9 +0,0 @@
function fuck -d "Correct your previous console command"
set -l fucked_up_command $history[1]
env TF_SHELL=fish TF_ALIAS=fuck PYTHONIOENCODING=utf-8 thefuck $fucked_up_command THEFUCK_ARGUMENT_PLACEHOLDER $argv | read -l unfucked_command
if [ "$unfucked_command" != "" ]
eval $unfucked_command
builtin history delete --exact --case-sensitive -- $fucked_up_command
builtin history merge
end
end

View file

@ -1,48 +0,0 @@
# Always installs bindings for insert and default mode for simplicity and b/c it has almost no side-effect
# https://gitter.im/fish-shell/fish-shell?at=60a55915ee77a74d685fa6b1
function fzf_configure_bindings --description "Installs the default key bindings for fzf.fish with user overrides passed as options."
# no need to install bindings if not in interactive mode or running tests
status is-interactive || test "$CI" = true; or return
set -f options_spec h/help 'directory=?' 'git_log=?' 'git_status=?' 'history=?' 'processes=?' 'variables=?' 'completions=?'
argparse --max-args=0 --ignore-unknown $options_spec -- $argv 2>/dev/null
if test $status -ne 0
echo "Invalid option or a positional argument was provided." >&2
_fzf_configure_bindings_help
return 22
else if set --query _flag_help
_fzf_configure_bindings_help
return
else
# Initialize with default key sequences and then override or disable them based on flags
# index 1 = directory, 2 = git_log, 3 = git_status, 4 = history, 5 = processes, 6 = variables
set -f key_sequences \e\cf \e\cl \e\cs \cr \e\cp \cv \t # \c = control, \e = escape
set --query _flag_directory && set key_sequences[1] "$_flag_directory"
set --query _flag_git_log && set key_sequences[2] "$_flag_git_log"
set --query _flag_git_status && set key_sequences[3] "$_flag_git_status"
set --query _flag_history && set key_sequences[4] "$_flag_history"
set --query _flag_processes && set key_sequences[5] "$_flag_processes"
set --query _flag_variables && set key_sequences[6] "$_flag_variables"
set --query _flag_completions && set key_sequences[7] "$_flag_completions"
# If fzf bindings already exists, uninstall it first for a clean slate
if functions --query _fzf_uninstall_bindings
_fzf_uninstall_bindings
end
for mode in default insert
test -n $key_sequences[1] && bind --mode $mode $key_sequences[1] _fzf_search_directory
test -n $key_sequences[2] && bind --mode $mode $key_sequences[2] _fzf_search_git_log
test -n $key_sequences[3] && bind --mode $mode $key_sequences[3] _fzf_search_git_status
test -n $key_sequences[4] && bind --mode $mode $key_sequences[4] _fzf_search_history
test -n $key_sequences[5] && bind --mode $mode $key_sequences[5] _fzf_search_processes
test -n $key_sequences[6] && bind --mode $mode $key_sequences[6] "$_fzf_search_vars_command"
test -n $key_sequences[7] && bind --mode $mode $key_sequences[7] _fzf_search_completions
end
function _fzf_uninstall_bindings --inherit-variable key_sequences
bind --erase -- $key_sequences
bind --erase --mode insert -- $key_sequences
end
end
end

View file

@ -1,15 +0,0 @@
function switch_kitty_tab
set kitty_info (kitty @ -- ls)
set -l tabs (echo $kitty_info | jq -r '.[0].tabs[].title')
set -l tab_ids (echo $kitty_info | jq -r '.[0].tabs[].id')
if test -n "$tabs"
set -l selected_tab (printf "%s\n" $tabs | fzf)
if test -n "$selected_tab"
kitty @ focus-tab --match "title:^$selected_tab"
end
else
echo "No se encontraron pestañas de Kitty"
end
end

View file

@ -1,30 +0,0 @@
# name: 'Catppuccin Frappé'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 303446
fish_color_normal c6d0f5
fish_color_command 8caaee
fish_color_param eebebe
fish_color_keyword e78284
fish_color_quote a6d189
fish_color_redirection f4b8e4
fish_color_end ef9f76
fish_color_comment 838ba7
fish_color_error e78284
fish_color_gray 737994
fish_color_selection --background=414559
fish_color_search_match --background=414559
fish_color_option a6d189
fish_color_operator f4b8e4
fish_color_escape ea999c
fish_color_autosuggestion 737994
fish_color_cancel e78284
fish_color_cwd e5c890
fish_color_user 81c8be
fish_color_host 8caaee
fish_color_host_remote a6d189
fish_color_status e78284
fish_pager_color_progress 737994
fish_pager_color_prefix f4b8e4
fish_pager_color_completion c6d0f5
fish_pager_color_description 737994

View file

@ -1,30 +0,0 @@
# name: 'Catppuccin Latte'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: eff1f5
fish_color_normal 4c4f69
fish_color_command 1e66f5
fish_color_param dd7878
fish_color_keyword d20f39
fish_color_quote 40a02b
fish_color_redirection ea76cb
fish_color_end fe640b
fish_color_comment 8c8fa1
fish_color_error d20f39
fish_color_gray 9ca0b0
fish_color_selection --background=ccd0da
fish_color_search_match --background=ccd0da
fish_color_option 40a02b
fish_color_operator ea76cb
fish_color_escape e64553
fish_color_autosuggestion 9ca0b0
fish_color_cancel d20f39
fish_color_cwd df8e1d
fish_color_user 179299
fish_color_host 1e66f5
fish_color_host_remote 40a02b
fish_color_status d20f39
fish_pager_color_progress 9ca0b0
fish_pager_color_prefix ea76cb
fish_pager_color_completion 4c4f69
fish_pager_color_description 9ca0b0

View file

@ -1,30 +0,0 @@
# name: 'Catppuccin Macchiato'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 24273a
fish_color_normal cad3f5
fish_color_command 8aadf4
fish_color_param f0c6c6
fish_color_keyword ed8796
fish_color_quote a6da95
fish_color_redirection f5bde6
fish_color_end f5a97f
fish_color_comment 8087a2
fish_color_error ed8796
fish_color_gray 6e738d
fish_color_selection --background=363a4f
fish_color_search_match --background=363a4f
fish_color_option a6da95
fish_color_operator f5bde6
fish_color_escape ee99a0
fish_color_autosuggestion 6e738d
fish_color_cancel ed8796
fish_color_cwd eed49f
fish_color_user 8bd5ca
fish_color_host 8aadf4
fish_color_host_remote a6da95
fish_color_status ed8796
fish_pager_color_progress 6e738d
fish_pager_color_prefix f5bde6
fish_pager_color_completion cad3f5
fish_pager_color_description 6e738d

View file

@ -1,30 +0,0 @@
# name: 'Catppuccin Mocha'
# url: 'https://github.com/catppuccin/fish'
# preferred_background: 1e1e2e
fish_color_normal cdd6f4
fish_color_command 89b4fa
fish_color_param f2cdcd
fish_color_keyword f38ba8
fish_color_quote a6e3a1
fish_color_redirection f5c2e7
fish_color_end fab387
fish_color_comment 7f849c
fish_color_error f38ba8
fish_color_gray 6c7086
fish_color_selection --background=313244
fish_color_search_match --background=313244
fish_color_option a6e3a1
fish_color_operator f5c2e7
fish_color_escape eba0ac
fish_color_autosuggestion 6c7086
fish_color_cancel f38ba8
fish_color_cwd f9e2af
fish_color_user 94e2d5
fish_color_host 89b4fa
fish_color_host_remote a6e3a1
fish_color_status f38ba8
fish_pager_color_progress 6c7086
fish_pager_color_prefix f5c2e7
fish_pager_color_completion cdd6f4
fish_pager_color_description 6c7086