AutoYADM commit: 2025-03-28 18:45:08
This commit is contained in:
parent
393973db39
commit
4606237776
78 changed files with 2856 additions and 1 deletions
40
.config/fish/conf.d/.gitnow
Normal file
40
.config/fish/conf.d/.gitnow
Normal file
|
@ -0,0 +1,40 @@
|
|||
[ options ]
|
||||
|
||||
# Read text from system clipboard or from the standard input
|
||||
# only when using Gitflow keybindings
|
||||
clipboard = false
|
||||
|
||||
[ keybindings ]
|
||||
|
||||
# Alt + S
|
||||
state = \es
|
||||
|
||||
# Alt + E
|
||||
stage = \ee
|
||||
|
||||
# Ctrl + E
|
||||
unstage = \ce
|
||||
|
||||
# Alt + M
|
||||
show = \em
|
||||
|
||||
# Alt + C
|
||||
commit-all = \ec
|
||||
|
||||
# Alt + D
|
||||
pull = \ed
|
||||
|
||||
# Alt + P
|
||||
push = \ep
|
||||
|
||||
# Alt + U
|
||||
upstream = \eu
|
||||
|
||||
# Alt + L
|
||||
logs = \el
|
||||
|
||||
# Alt + F
|
||||
feature = \ef
|
||||
|
||||
# Alt + H
|
||||
hotfix = \eh
|
201
.config/fish/conf.d/__async_prompt.fish
Normal file
201
.config/fish/conf.d/__async_prompt.fish
Normal file
|
@ -0,0 +1,201 @@
|
|||
status is-interactive
|
||||
or exit 0
|
||||
|
||||
set -g __async_prompt_tmpdir (command mktemp -d)
|
||||
|
||||
# Setup after the user defined prompt functions are loaded.
|
||||
function __async_prompt_setup_on_startup --on-event fish_prompt
|
||||
functions -e (status current-function)
|
||||
if test "$async_prompt_enable" = 0
|
||||
return 0
|
||||
end
|
||||
|
||||
for func in (__async_prompt_config_functions)
|
||||
function $func -V func
|
||||
test -e $__async_prompt_tmpdir'/'$fish_pid'_'$func
|
||||
and cat $__async_prompt_tmpdir'/'$fish_pid'_'$func
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_keep_last_pipestatus
|
||||
set -g __async_prompt_last_pipestatus $pipestatus
|
||||
end
|
||||
|
||||
not set -q async_prompt_on_variable
|
||||
and set async_prompt_on_variable fish_bind_mode
|
||||
function __async_prompt_fire --on-event fish_prompt (for var in $async_prompt_on_variable; printf '%s\n' --on-variable $var; end)
|
||||
for func in (__async_prompt_config_functions)
|
||||
set -l tmpfile $__async_prompt_tmpdir'/'$fish_pid'_'$func
|
||||
|
||||
if functions -q $func'_loading_indicator' && test -e $tmpfile
|
||||
read -zl last_prompt <$tmpfile
|
||||
eval (string escape -- $func'_loading_indicator' "$last_prompt") >$tmpfile
|
||||
end
|
||||
|
||||
__async_prompt_config_inherit_variables | __async_prompt_spawn \
|
||||
$func' | read -z prompt
|
||||
echo -n $prompt >'$tmpfile
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_spawn -a cmd
|
||||
set -l envs
|
||||
begin
|
||||
while read line
|
||||
switch "$line"
|
||||
case fish_bind_mode
|
||||
echo fish_bind_mode $fish_bind_mode
|
||||
case FISH_VERSION PWD _ history 'fish_*' hostname version status_generation
|
||||
case status pipestatus
|
||||
echo pipestatus $__async_prompt_last_pipestatus
|
||||
case SHLVL
|
||||
set envs $envs SHLVL=$SHLVL
|
||||
case '*'
|
||||
echo $line (string escape -- $$line)
|
||||
end
|
||||
end
|
||||
end | read -lz vars
|
||||
echo $vars | env $envs fish -c '
|
||||
function __async_prompt_signal
|
||||
kill -s "'(__async_prompt_config_internal_signal)'" '$fish_pid' 2>/dev/null
|
||||
end
|
||||
while read -a line
|
||||
test -z "$line"
|
||||
and continue
|
||||
|
||||
if test "$line[1]" = pipestatus
|
||||
set -f _pipestatus $line[2..]
|
||||
else
|
||||
eval set "$line"
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_set_status
|
||||
return $argv
|
||||
end
|
||||
if set -q _pipestatus
|
||||
switch (count $_pipestatus)
|
||||
case 1
|
||||
__async_prompt_set_status $_pipestatus[1]
|
||||
case 2
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2]
|
||||
case 3
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3]
|
||||
case 4
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3] \
|
||||
| __async_prompt_set_status $_pipestatus[4]
|
||||
case 5
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3] \
|
||||
| __async_prompt_set_status $_pipestatus[4] \
|
||||
| __async_prompt_set_status $_pipestatus[5]
|
||||
case 6
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3] \
|
||||
| __async_prompt_set_status $_pipestatus[4] \
|
||||
| __async_prompt_set_status $_pipestatus[5] \
|
||||
| __async_prompt_set_status $_pipestatus[6]
|
||||
case 7
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3] \
|
||||
| __async_prompt_set_status $_pipestatus[4] \
|
||||
| __async_prompt_set_status $_pipestatus[5] \
|
||||
| __async_prompt_set_status $_pipestatus[6] \
|
||||
| __async_prompt_set_status $_pipestatus[7]
|
||||
case 8
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3] \
|
||||
| __async_prompt_set_status $_pipestatus[4] \
|
||||
| __async_prompt_set_status $_pipestatus[5] \
|
||||
| __async_prompt_set_status $_pipestatus[6] \
|
||||
| __async_prompt_set_status $_pipestatus[7] \
|
||||
| __async_prompt_set_status $_pipestatus[8]
|
||||
default
|
||||
__async_prompt_set_status $_pipestatus[1] \
|
||||
| __async_prompt_set_status $_pipestatus[2] \
|
||||
| __async_prompt_set_status $_pipestatus[3] \
|
||||
| __async_prompt_set_status $_pipestatus[4] \
|
||||
| __async_prompt_set_status $_pipestatus[5] \
|
||||
| __async_prompt_set_status $_pipestatus[6] \
|
||||
| __async_prompt_set_status $_pipestatus[7] \
|
||||
| __async_prompt_set_status $_pipestatus[8] \
|
||||
| __async_prompt_set_status $_pipestatus[-1]
|
||||
end
|
||||
else
|
||||
true
|
||||
end
|
||||
'$cmd'
|
||||
__async_prompt_signal' &
|
||||
if test (__async_prompt_config_disown) = 1
|
||||
disown
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_config_inherit_variables
|
||||
if set -q async_prompt_inherit_variables
|
||||
if test "$async_prompt_inherit_variables" = all
|
||||
set -ng
|
||||
else
|
||||
for item in $async_prompt_inherit_variables
|
||||
echo $item
|
||||
end
|
||||
end
|
||||
else
|
||||
echo CMD_DURATION
|
||||
echo fish_bind_mode
|
||||
echo pipestatus
|
||||
echo SHLVL
|
||||
echo status
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_config_functions
|
||||
set -l funcs (
|
||||
if set -q async_prompt_functions
|
||||
string join \n $async_prompt_functions
|
||||
else
|
||||
echo fish_prompt
|
||||
echo fish_right_prompt
|
||||
end
|
||||
)
|
||||
for func in $funcs
|
||||
functions -q "$func"
|
||||
or continue
|
||||
|
||||
echo $func
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_config_internal_signal
|
||||
if test -z "$async_prompt_signal_number"
|
||||
echo SIGUSR1
|
||||
else
|
||||
echo "$async_prompt_signal_number"
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_config_disown
|
||||
if test -z "$async_prompt_disown"
|
||||
echo 1
|
||||
else
|
||||
echo "$async_prompt_disown"
|
||||
end
|
||||
end
|
||||
|
||||
function __async_prompt_repaint_prompt --on-signal (__async_prompt_config_internal_signal)
|
||||
commandline -f repaint >/dev/null 2>/dev/null
|
||||
end
|
||||
|
||||
function __async_prompt_tmpdir_cleanup --on-event fish_exit
|
||||
rm -rf "$__async_prompt_tmpdir"
|
||||
end
|
39
.config/fish/conf.d/autopair.fish
Normal file
39
.config/fish/conf.d/autopair.fish
Normal file
|
@ -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
|
334
.config/fish/conf.d/done.fish
Normal file
334
.config/fish/conf.d/done.fish
Normal file
|
@ -0,0 +1,334 @@
|
|||
# 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
|
28
.config/fish/conf.d/fzf.fish
Normal file
28
.config/fish/conf.d/fzf.fish
Normal file
|
@ -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
|
713
.config/fish/conf.d/gitnow.fish
Normal file
713
.config/fish/conf.d/gitnow.fish
Normal file
|
@ -0,0 +1,713 @@
|
|||
# GitNow — Speed up your Git workflow. 🐠
|
||||
# https://github.com/joseluisq/gitnow
|
||||
|
||||
set -g gitnow_version 2.12.0
|
||||
|
||||
# Default global variables
|
||||
set -q GITNOW_CONFIG_FILE; or set -g GITNOW_CONFIG_FILE ~/.gitnow
|
||||
set -g gitnow_commands 'all' 'assume' 'bitbucket' 'bugfix' 'commit' 'commit-all' 'feature' 'github' 'gitnow' 'hotfix' 'logs' 'merge' 'move' 'pull' 'push' 'release' 'show' 'stage' 'state' 'tag' 'unstage' 'untracked' 'upstream'
|
||||
|
||||
if set -q __fish_config_dir
|
||||
set -g fish_config "$__fish_config_dir"
|
||||
else
|
||||
set -q XDG_CONFIG_HOME
|
||||
and set -g fish_config "$XDG_CONFIG_HOME/fish"
|
||||
or set -g fish_config "~/.config/fish"
|
||||
end
|
||||
|
||||
set -q fish_snippets; or set -g fish_snippets "$fish_config/conf.d"
|
||||
|
||||
__gitnow_load_config
|
||||
|
||||
# Other specific global variables
|
||||
set -g g_current_branch
|
||||
|
||||
function __gitnow_install -e gitnow_install
|
||||
echo (gitnow -v)" is installed and ready to use!"
|
||||
echo "Just run the `gitnow` command if you want explore the API."
|
||||
end
|
||||
|
||||
function __gitnow_uninstall -e gitnow_uninstall
|
||||
echo "GitNow was uninstalled successfully."
|
||||
end
|
||||
|
||||
function gitnow -d "Gitnow: Speed up your Git workflow. 🐠" -a xversion
|
||||
if [ "$xversion" = "-v" ]; or [ "$xversion" = "--version" ]
|
||||
echo "GitNow version $gitnow_version"
|
||||
else
|
||||
__gitnow_manual | command less -r
|
||||
end
|
||||
end
|
||||
|
||||
function state -d "Gitnow: Show the working tree status in compact way"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "state"
|
||||
return
|
||||
end
|
||||
|
||||
command git status -sb
|
||||
end
|
||||
|
||||
function stage -d "Gitnow: Stage files in current working directory" -w 'git add'
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "stage"
|
||||
return
|
||||
end
|
||||
|
||||
set -l len (count $argv)
|
||||
set -l opts .
|
||||
|
||||
if test $len -gt 0
|
||||
set opts $argv
|
||||
end
|
||||
|
||||
command git add $opts
|
||||
end
|
||||
|
||||
function unstage -d "Gitnow: Unstage files in current working directory" -w 'git reset'
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "unstage"
|
||||
return
|
||||
end
|
||||
|
||||
set -l len (count $argv)
|
||||
set -l opts .
|
||||
|
||||
if test $len -gt 0
|
||||
set opts $argv
|
||||
end
|
||||
|
||||
command git reset $opts
|
||||
end
|
||||
|
||||
function show -d "Gitnow: Show commit detail objects" -w 'git show'
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "show"
|
||||
return
|
||||
end
|
||||
|
||||
set -l len (count $argv)
|
||||
|
||||
if test $len -gt 0
|
||||
command git show $argv
|
||||
else
|
||||
command git show --compact-summary --patch HEAD
|
||||
end
|
||||
end
|
||||
|
||||
function untracked -d "Gitnow: Check for untracked files and directories on current working directory"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "untracked"
|
||||
return
|
||||
end
|
||||
|
||||
command git clean --dry-run -d
|
||||
|
||||
end
|
||||
|
||||
function commit -d "Gitnow: Commit changes to the repository" -w 'git commit'
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "commit"
|
||||
return
|
||||
end
|
||||
|
||||
set -l len (count $argv)
|
||||
|
||||
if test $len -gt 0
|
||||
command git commit $argv
|
||||
else
|
||||
command git commit
|
||||
end
|
||||
end
|
||||
|
||||
function commit-all -d "Gitnow: Add and commit all changes to the repository"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "commit-all"
|
||||
return
|
||||
end
|
||||
|
||||
stage
|
||||
commit .
|
||||
end
|
||||
|
||||
function pull -d "Gitnow: Pull changes from remote server but stashing uncommitted changes" -w 'git pull'
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "pull"
|
||||
return
|
||||
end
|
||||
|
||||
set -l len (count $argv)
|
||||
set -l xorigin (__gitnow_current_remote)
|
||||
set -l xbranch (__gitnow_current_branch_name)
|
||||
set -l xcmd ""
|
||||
|
||||
echo "⚡️ Pulling changes..."
|
||||
|
||||
set -l xdefaults --rebase --autostash --tags
|
||||
|
||||
if test $len -gt 2
|
||||
set xcmd $argv
|
||||
|
||||
echo "Mode: Manual"
|
||||
echo "Default flags: $xdefaults"
|
||||
echo
|
||||
else
|
||||
echo "Mode: Auto"
|
||||
echo "Default flags: $xdefaults"
|
||||
|
||||
if test $len -eq 1
|
||||
set xbranch $argv[1]
|
||||
end
|
||||
|
||||
if test $len -eq 2
|
||||
set xorigin $argv[1]
|
||||
set xbranch $argv[2]
|
||||
end
|
||||
|
||||
set xcmd $xorigin $xbranch
|
||||
set -l xremote_url (command git config --get "remote.$xorigin.url")
|
||||
|
||||
echo "Remote URL: $xorigin ($xremote_url)"
|
||||
echo "Remote branch: $xbranch"
|
||||
echo
|
||||
end
|
||||
|
||||
command git pull $xcmd $xdefaults
|
||||
end
|
||||
|
||||
# Git push with --set-upstream
|
||||
# Shortcut inspired from https://github.com/jamiew/git-friendly
|
||||
function push -d "Gitnow: Push commit changes to remote repository" -w 'git push'
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "push"
|
||||
return
|
||||
end
|
||||
|
||||
set -l opts $argv
|
||||
set -l xorigin (__gitnow_current_remote)
|
||||
set -l xbranch (__gitnow_current_branch_name)
|
||||
|
||||
|
||||
if test (count $opts) -eq 0
|
||||
set opts $xorigin $xbranch
|
||||
set -l xremote_url (command git config --get "remote.$xorigin.url")
|
||||
|
||||
echo "🚀 Pushing changes..."
|
||||
echo "Mode: Auto"
|
||||
echo "Remote URL: $xorigin ($xremote_url)"
|
||||
echo "Remote branch: $xbranch"
|
||||
else
|
||||
set -l v_mode "auto"
|
||||
|
||||
for v in $argv
|
||||
switch $v
|
||||
case -t --tags
|
||||
set opts $xorigin $xbranch --follow-tags
|
||||
set -l xremote_url (command git config --get "remote.$xorigin.url")
|
||||
|
||||
echo "🚀 Pushing changes..."
|
||||
echo "Mode: Auto (incl. tags)"
|
||||
echo "Remote URL: $xorigin ($xremote_url)"
|
||||
echo "Remote branch: $xbranch"
|
||||
case -h --help
|
||||
echo "NAME"
|
||||
echo " Gitnow: push - Push current branch to default origin"
|
||||
echo "OPTIONS:"
|
||||
echo " -t --tags (auto mode) include annotated tags that relate to the commits"
|
||||
echo " -h --help Show information about the options for this command"
|
||||
return
|
||||
case -\*
|
||||
case '*'
|
||||
set -l v_mode "manual"
|
||||
echo "Mode: Manual"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
echo
|
||||
|
||||
command git push --set-upstream $opts
|
||||
end
|
||||
|
||||
function upstream -d "Gitnow: Commit all changes and push them to remote server"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "upstream"
|
||||
return
|
||||
end
|
||||
|
||||
commit-all
|
||||
push
|
||||
end
|
||||
|
||||
function feature -d "GitNow: Creates a new Gitflow feature branch from current branch" -a xbranch
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "feature"
|
||||
return
|
||||
end
|
||||
|
||||
__gitnow_gitflow_branch "feature" $xbranch
|
||||
end
|
||||
|
||||
function hotfix -d "GitNow: Creates a new Gitflow hotfix branch from current branch" -a xbranch
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "hotfix"
|
||||
return
|
||||
end
|
||||
|
||||
__gitnow_gitflow_branch "hotfix" $xbranch
|
||||
end
|
||||
|
||||
function bugfix -d "GitNow: Creates a new Gitflow bugfix branch from current branch" -a xbranch
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "bugfix"
|
||||
return
|
||||
end
|
||||
|
||||
__gitnow_gitflow_branch "bugfix" $xbranch
|
||||
end
|
||||
|
||||
function release -d "GitNow: Creates a new Gitflow release branch from current branch" -a xbranch
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "release"
|
||||
return
|
||||
end
|
||||
|
||||
__gitnow_gitflow_branch "release" $xbranch
|
||||
end
|
||||
|
||||
function merge -d "GitNow: Merges given branch into the active one"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "merge"
|
||||
return
|
||||
end
|
||||
|
||||
set -l len (count $argv)
|
||||
if test $len -eq 0
|
||||
echo "Merge: No argument given, needs one parameter"
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_abort
|
||||
set -l v_continue
|
||||
set -l v_branch
|
||||
|
||||
for v in $argv
|
||||
switch $v
|
||||
case -a --abort
|
||||
set v_abort $v
|
||||
case -c --continue
|
||||
set v_continue $v
|
||||
case -h --help
|
||||
echo "NAME"
|
||||
echo " Gitnow: merge - Merge given branch into the active one"
|
||||
echo "EXAMPLES"
|
||||
echo " merge <branch to merge>"
|
||||
echo "OPTIONS:"
|
||||
echo " -a --abort Abort a conflicted merge"
|
||||
echo " -c --continue Continue a conflicted merge"
|
||||
echo " -h --help Show information about the options for this command"
|
||||
return
|
||||
case -\*
|
||||
case '*'
|
||||
set v_branch $v
|
||||
end
|
||||
end
|
||||
|
||||
# abort
|
||||
if test "$v_abort";
|
||||
echo "Abort the current merge"
|
||||
command git merge --abort
|
||||
return
|
||||
end
|
||||
|
||||
# continue
|
||||
if test "$v_continue";
|
||||
echo "Continue the current merge"
|
||||
command git merge --continue
|
||||
return
|
||||
end
|
||||
|
||||
# No branch defined
|
||||
if not test -n "$v_branch"
|
||||
echo "Provide a valid branch name to merge."
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_found (__gitnow_check_if_branch_exist $v_branch)
|
||||
|
||||
# Branch was not found
|
||||
if test $v_found -eq 0;
|
||||
echo "Local branch `$v_branch` was not found. Not possible to merge."
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
# Detect merging current branch
|
||||
if [ "$v_branch" = (__gitnow_current_branch_name) ]
|
||||
echo "Branch `$v_branch` is the same as current branch. Nothing to do."
|
||||
return
|
||||
end
|
||||
|
||||
command git merge $v_branch
|
||||
end
|
||||
|
||||
function move -d "GitNow: Switch from current branch to another but stashing uncommitted changes" -a args
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "move"
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_upstream
|
||||
set -l v_no_apply_stash
|
||||
set -l v_branch
|
||||
set -l v_prev
|
||||
|
||||
for v in $argv
|
||||
switch $v
|
||||
case -u --upstream
|
||||
set v_upstream $v
|
||||
case -n --no-apply-stash
|
||||
set v_no_apply_stash $v
|
||||
case -nu -un
|
||||
set v_upstream "-u"
|
||||
set v_no_apply_stash "-n"
|
||||
case -p --prev
|
||||
set v_prev "true"
|
||||
case -h --help
|
||||
echo "NAME"
|
||||
echo " Gitnow: move - Switch from current branch to another but stashing uncommitted changes"
|
||||
echo "EXAMPLES"
|
||||
echo " move <branch to switch to>"
|
||||
echo " move -"
|
||||
echo "OPTIONS:"
|
||||
echo " -n --no-apply-stash Switch to a local branch but without applying current stash"
|
||||
echo " -u --upstream Fetch a remote branch and switch to it applying current stash. It can be combined with --no-apply-stash"
|
||||
echo " -p --prev Switch to a previous branch if different than the current one (equivalent to \"move -\"). It uses `--no-apply-stash` option by default."
|
||||
echo " -h --help Show information about the options for this command"
|
||||
return
|
||||
case -\*
|
||||
case '*'
|
||||
set v_branch $v
|
||||
end
|
||||
end
|
||||
|
||||
# Move to prev branch either via the --prev option or the "-" shorthand char
|
||||
if begin test -n "$v_prev"; or [ "$args" = "-" ]; end
|
||||
if begin test -z "$g_current_branch"; or [ "$g_current_branch" = (__gitnow_current_branch_name) ]; end
|
||||
echo "Previous branch not found or the same as current one. Nothing to do."
|
||||
echo "Tip: Previous branch switching only works via the `move` command."
|
||||
return
|
||||
end
|
||||
|
||||
echo "Previous branch found, switching to `$g_current_branch` (using `--no-apply-stash` option)."
|
||||
move -n $g_current_branch
|
||||
return
|
||||
end
|
||||
|
||||
# No branch defined
|
||||
if not test -n "$v_branch"
|
||||
echo "Provide a valid branch name to switch to."
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_fetched 0
|
||||
|
||||
# Fetch branch from remote
|
||||
if test -n "$v_upstream"
|
||||
set -l v_remote (__gitnow_current_remote)
|
||||
command git fetch $v_remote $v_branch:refs/remotes/$v_remote/$v_branch
|
||||
command git checkout --track $v_remote/$v_branch
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_found (__gitnow_check_if_branch_exist $v_branch)
|
||||
|
||||
# Branch was not found
|
||||
if begin test $v_found -eq 0; and test $v_fetched -eq 0; end
|
||||
echo "Branch `$v_branch` was not found locally. No possible to switch."
|
||||
echo "Tip: Use -u (--upstream) flag to fetch a remote branch."
|
||||
return
|
||||
end
|
||||
|
||||
# Prevent same branch switching
|
||||
if [ "$v_branch" = (__gitnow_current_branch_name) ]
|
||||
echo "Branch `$v_branch` is the same as current branch. Nothing to do."
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_uncommited (__gitnow_has_uncommited_changes)
|
||||
|
||||
# Stash changes before checkout for uncommited changes only
|
||||
if test $v_uncommited
|
||||
command git stash
|
||||
end
|
||||
|
||||
set g_current_branch (__gitnow_current_branch_name)
|
||||
command git checkout $v_branch
|
||||
|
||||
# --no-apply-stash
|
||||
if test -n "$v_no_apply_stash"
|
||||
echo "Changes were stashed but not applied by default. Use `git stash pop` to apply them."
|
||||
end
|
||||
|
||||
if begin test $v_uncommited; and not test -n "$v_no_apply_stash"; end
|
||||
command git stash pop
|
||||
echo "Stashed changes were applied."
|
||||
end
|
||||
end
|
||||
|
||||
function logs -d "Gitnow: Shows logs in a fancy way"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "logs"
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_max_commits "80"
|
||||
set -l v_args
|
||||
|
||||
for v in $argv
|
||||
switch $v
|
||||
case -h --help
|
||||
echo "NAME"
|
||||
echo " Gitnow: logs - Show logs in a fancy way (first $v_max_commits commits by default)"
|
||||
echo "EXAMPLES"
|
||||
echo " logs [git log options]"
|
||||
echo "EXTRA OPTIONS:"
|
||||
echo " -h, --help Show information about the options for this command"
|
||||
return
|
||||
case -\*
|
||||
case '*'
|
||||
set v_args $argv
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if test -n "$v_args"
|
||||
set v_max_commits
|
||||
else
|
||||
set v_max_commits "-$v_max_commits"
|
||||
end
|
||||
|
||||
LC_ALL=C command git log $v_max_commits $v_args --color --graph \
|
||||
--pretty=format:"%C(red)%h%C(reset)%C(yellow)%d%Creset %s %C(green italic)(%cr)%C(reset) %C(blue)%an%C(reset) %C(white dim)%GK %C(reset)" --abbrev-commit \
|
||||
| command less -R
|
||||
end
|
||||
|
||||
function tag -d "Gitnow: Tag commits following Semver"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "tag"
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_major
|
||||
set -l v_minor
|
||||
set -l v_patch
|
||||
set -l v_premajor
|
||||
set -l v_preminor
|
||||
set -l v_prepatch
|
||||
|
||||
set -l opts
|
||||
|
||||
# NOTE: this function only gets the latest *Semver release version* but no suffixed ones or others
|
||||
set -l v_latest (__gitnow_get_latest_semver_release_tag)
|
||||
|
||||
for v in $argv
|
||||
switch $v
|
||||
case -x --major
|
||||
set v_major $v
|
||||
case -y --minor
|
||||
set v_minor $v
|
||||
case -z --patch
|
||||
set v_patch $v
|
||||
case -a --annotate
|
||||
set opts $opts $v
|
||||
|
||||
# TODO: pre-release versions are not supported yet
|
||||
# case -a --premajor
|
||||
# set v_premajor $v
|
||||
# case -b --preminor
|
||||
# set v_preminor $v
|
||||
# case -c --prepatch
|
||||
# set v_prepatch $v
|
||||
|
||||
case -l --latest
|
||||
if not test -n "$v_latest"
|
||||
echo "There is no any tag created yet."
|
||||
else
|
||||
echo $v_latest
|
||||
end
|
||||
|
||||
return
|
||||
case -h --help
|
||||
echo "NAME"
|
||||
echo " Gitnow: tag - List or tag commits following The Semantic Versioning 2.0.0 (Semver) [1]"
|
||||
echo " [1] https://semver.org/"
|
||||
echo "EXAMPLES"
|
||||
echo " List tags: tag"
|
||||
echo " Custom tag: tag <my tag name>"
|
||||
echo " Semver tag: tag --major"
|
||||
echo "OPTIONS:"
|
||||
echo " Without options all tags are listed in a lexicographic order and tag names are treated as versions"
|
||||
echo " -x --major Tag auto-incrementing a major version number"
|
||||
echo " -y --minor Tag auto-incrementing a minor version number"
|
||||
echo " -z --patch Tag auto-incrementing a patch version number"
|
||||
echo " -l --latest Show only the latest Semver release tag version (no suffixed ones or others)"
|
||||
echo " -a --annotate Create as annotated tag"
|
||||
echo " -h --help Show information about the options for this command"
|
||||
|
||||
# TODO: pre-release versions are not supported yet
|
||||
# echo " -a --premajor Tag auto-incrementing a premajor version number"
|
||||
# echo " -b --preminor Tag auto-incrementing a preminor version number"
|
||||
# echo " -c --prepatch Tag auto-incrementing a prepatch version number"
|
||||
|
||||
return
|
||||
case -\*
|
||||
case '*'
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# List all tags in a lexicographic order and treating tag names as versions
|
||||
if test -z "$argv"
|
||||
__gitnow_get_tags_ordered
|
||||
return
|
||||
end
|
||||
|
||||
# Major version tags
|
||||
if test -n "$v_major"
|
||||
if not test -n "$v_latest"
|
||||
command git tag $opts v1.0.0
|
||||
echo "First major tag \"v1.0.0\" was created."
|
||||
return
|
||||
else
|
||||
set -l vstr (__gitnow_get_valid_semver_release_value $v_latest)
|
||||
|
||||
# Validate Semver format before to proceed
|
||||
if not test -n "$vstr"
|
||||
echo "The latest tag \"$v_latest\" has no a valid Semver format."
|
||||
return
|
||||
end
|
||||
|
||||
set -l x (echo $vstr | LC_ALL=C command awk -F '.' '{print $1}')
|
||||
set -l prefix (echo $v_latest | LC_ALL=C command awk -F "$vstr" '{print $1}')
|
||||
set x (__gitnow_increment_number $x)
|
||||
set -l xyz "$prefix$x.0.0"
|
||||
|
||||
command git tag $opts $xyz
|
||||
echo "Major tag \"$xyz\" was created."
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# Minor version tags
|
||||
if test -n "$v_minor"
|
||||
if not test -n "$v_latest"
|
||||
command git tag $opts v0.1.0
|
||||
echo "First minor tag \"v0.1.0\" was created."
|
||||
return
|
||||
else
|
||||
set -l vstr (__gitnow_get_valid_semver_release_value $v_latest)
|
||||
|
||||
# Validate Semver format before to proceed
|
||||
if not test -n "$vstr"
|
||||
echo "The latest tag \"$v_latest\" has no a valid Semver format."
|
||||
return
|
||||
end
|
||||
|
||||
set -l x (echo $vstr | LC_ALL=C command awk -F '.' '{print $1}')
|
||||
set -l y (echo $vstr | LC_ALL=C command awk -F '.' '{print $2}')
|
||||
set -l prefix (echo $v_latest | LC_ALL=C command awk -F "$vstr" '{print $1}')
|
||||
set y (__gitnow_increment_number $y)
|
||||
set -l xyz "$prefix$x.$y.0"
|
||||
|
||||
command git tag $opts $xyz
|
||||
echo "Minor tag \"$xyz\" was created."
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# Patch version tags
|
||||
if test -n "$v_patch"
|
||||
if not test -n "$v_latest"
|
||||
command git tag $opts v0.0.1
|
||||
echo "First patch tag \"v0.1.0\" was created."
|
||||
return
|
||||
else
|
||||
set -l vstr (__gitnow_get_valid_semver_release_value $v_latest)
|
||||
|
||||
# Validate Semver format before to proceed
|
||||
if not test -n "$vstr"
|
||||
echo "The latest tag \"$v_latest\" has no a valid Semver format."
|
||||
return
|
||||
end
|
||||
|
||||
set -l x (echo $vstr | LC_ALL=C command awk -F '.' '{print $1}')
|
||||
set -l y (echo $vstr | LC_ALL=C command awk -F '.' '{print $2}')
|
||||
set -l z (echo $vstr | LC_ALL=C command awk -F '.' '{print $3}')
|
||||
set -l s (echo $z | LC_ALL=C command awk -F '-' '{print $1}')
|
||||
|
||||
if __gitnow_is_number $s
|
||||
set -l prefix (echo $v_latest | LC_ALL=C command awk -F "$vstr" '{print $1}')
|
||||
set s (__gitnow_increment_number $s)
|
||||
set -l xyz "$prefix$x.$y.$s"
|
||||
|
||||
command git tag $opts $xyz
|
||||
echo "Patch tag \"$xyz\" was created."
|
||||
else
|
||||
echo "No patch version found."
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
# TODO: pre-release versions are not supported yet
|
||||
# TODO: Premajor version tags
|
||||
# TODO: Preminor version tags
|
||||
# TODO: Prepatch version tags
|
||||
end
|
||||
|
||||
function assume -d "Gitnow: Ignore files temporarily"
|
||||
if not __gitnow_is_git_repository
|
||||
__gitnow_msg_not_valid_repository "assume"
|
||||
return
|
||||
end
|
||||
|
||||
set -l v_assume_unchanged "--assume-unchanged"
|
||||
set -l v_files
|
||||
|
||||
for v in $argv
|
||||
switch $v
|
||||
case -n --no-assume
|
||||
set v_assume_unchanged "--no-assume-unchanged"
|
||||
case -h --help
|
||||
echo "NAME"
|
||||
echo " Gitnow: assume - Ignores changes in certain files temporarily"
|
||||
echo "OPTIONS:"
|
||||
echo " -n --no-assume No assume unchanged files to be ignored (revert option)"
|
||||
echo " -h --help Show information about the options for this command"
|
||||
return
|
||||
case -\*
|
||||
case '*'
|
||||
set v_files $v_files $v
|
||||
end
|
||||
end
|
||||
|
||||
if test (count $v_files) -lt 1
|
||||
echo "Provide files in order to ignore them temporarily. E.g `assume Cargo.lock`"
|
||||
return
|
||||
end
|
||||
|
||||
command git update-index $v_assume_unchanged $v_files
|
||||
end
|
||||
|
||||
function github -d "Gitnow: Clone a GitHub repository using SSH"
|
||||
set -l repo (__gitnow_clone_params $argv)
|
||||
__gitnow_clone_repo $repo "github"
|
||||
end
|
||||
|
||||
function bitbucket -d "Gitnow: Clone a Bitbucket Cloud repository using SSH"
|
||||
set -l repo (__gitnow_clone_params $argv)
|
||||
__gitnow_clone_repo $repo "bitbucket"
|
||||
end
|
25
.config/fish/conf.d/puffer_fish_key_bindings.fish
Normal file
25
.config/fish/conf.d/puffer_fish_key_bindings.fish
Normal file
|
@ -0,0 +1,25 @@
|
|||
status is-interactive || exit
|
||||
|
||||
function _puffer_fish_key_bindings --on-variable fish_key_bindings
|
||||
set -l modes
|
||||
if test "$fish_key_bindings" = fish_default_key_bindings
|
||||
set modes default insert
|
||||
else
|
||||
set modes insert default
|
||||
end
|
||||
|
||||
bind --mode $modes[1] . _puffer_fish_expand_dots
|
||||
bind --mode $modes[1] ! _puffer_fish_expand_bang
|
||||
bind --mode $modes[1] '$' _puffer_fish_expand_lastarg
|
||||
bind --mode $modes[2] --erase . ! '$'
|
||||
end
|
||||
|
||||
_puffer_fish_key_bindings
|
||||
|
||||
set -l uninstall_event puffer_fish_key_bindings_uninstall
|
||||
|
||||
function _$uninstall_event --on-event $uninstall_event
|
||||
bind -e .
|
||||
bind -e !
|
||||
bind -e '$'
|
||||
end
|
52
.config/fish/conf.d/sponge.fish
Normal file
52
.config/fish/conf.d/sponge.fish
Normal file
|
@ -0,0 +1,52 @@
|
|||
# Sponge version
|
||||
set --global sponge_version 1.1.0
|
||||
|
||||
# Allow to repeat previous command by default
|
||||
if not set --query --universal sponge_delay
|
||||
set --universal sponge_delay 2
|
||||
end
|
||||
|
||||
# Purge entries both after `sponge_delay` entries and on exit by default
|
||||
if not set --query --universal sponge_purge_only_on_exit
|
||||
set --universal sponge_purge_only_on_exit false
|
||||
end
|
||||
|
||||
# Add default filters
|
||||
if not set --query --universal sponge_filters
|
||||
set --universal sponge_filters sponge_filter_failed sponge_filter_matched
|
||||
end
|
||||
|
||||
# Don't filter out commands that already have been in the history by default
|
||||
if not set --query --universal sponge_allow_previously_successful
|
||||
set --universal sponge_allow_previously_successful true
|
||||
end
|
||||
|
||||
# Consider `0` the only successful exit code by default
|
||||
if not set --query --universal sponge_successful_exit_codes
|
||||
set --universal sponge_successful_exit_codes 0
|
||||
end
|
||||
|
||||
# No active regex patterns by default
|
||||
if not set --query --universal sponge_regex_patterns
|
||||
set --universal sponge_regex_patterns
|
||||
end
|
||||
|
||||
# Attach event handlers
|
||||
functions --query \
|
||||
_sponge_on_prompt \
|
||||
_sponge_on_preexec \
|
||||
_sponge_on_postexec \
|
||||
_sponge_on_exit
|
||||
|
||||
# Initialize empty state for the first run
|
||||
function _sponge_install --on-event sponge_install
|
||||
set --global _sponge_current_command ''
|
||||
set --global _sponge_current_command_exit_code 0
|
||||
set --global _sponge_current_command_previously_in_history false
|
||||
end
|
||||
|
||||
# Clean up variables
|
||||
function _sponge_uninstall --on-event sponge_uninstall
|
||||
_sponge_clear_state
|
||||
set --erase sponge_version
|
||||
end
|
4
.config/fish/conf.d/virtualfish-loader.fish
Normal file
4
.config/fish/conf.d/virtualfish-loader.fish
Normal file
|
@ -0,0 +1,4 @@
|
|||
set -g VIRTUALFISH_VERSION 2.5.9
|
||||
set -g VIRTUALFISH_PYTHON_EXEC /home/fic/.local/share/uv/tools/virtualfish/bin/python
|
||||
source /home/fic/.local/share/uv/tools/virtualfish/lib/python3.11/site-packages/virtualfish/virtual.fish
|
||||
emit virtualfish_did_setup_plugins
|
Loading…
Add table
Add a link
Reference in a new issue