fish, zsh and other minor changes

This commit is contained in:
Sergio Laín 2023-07-16 18:24:42 +02:00
parent 1f7aa84297
commit e92172c27e
94 changed files with 3648 additions and 198 deletions

View file

@ -2,12 +2,12 @@
"settings": {
"tabs": [
{
"name": "#general",
"url": "/channels/674984102860161025/674985827121758208",
"name": "#arte-picasso",
"url": "/channels/674984102860161025/1007802241035538452",
"selected": true,
"currentStatus": "none",
"iconUrl": "https://cdn.discordapp.com/icons/674984102860161025/a4c5c84a118b923dfe68dccd886d1d87.webp?size=40",
"channelId": "674985827121758208"
"iconUrl": "https://cdn.discordapp.com/icons/674984102860161025/a4c5c84a118b923dfe68dccd886d1d87.webp?size=44",
"channelId": "1007802241035538452"
},
{
"name": "#feedback-and-suggestions",
@ -26,12 +26,11 @@
"channelId": "635625917623828520"
},
{
"name": "@spider300",
"url": "/channels/@me/347377928914337792",
"name": "Friends",
"url": "/channels/@me",
"selected": false,
"currentStatus": "online",
"iconUrl": "https://cdn.discordapp.com/avatars/346980245028601857/fa3802f0571349385c58a99e46c4ff07.webp?size=40",
"channelId": "347377928914337792"
"currentStatus": "none",
"iconUrl": "https://cdn.discordapp.com/embed/avatars/0.png"
}
],
"favs": [],

View file

@ -1,7 +1,7 @@
{
"all": {
"cachedState": {
"date": "2023-07-05T15:12:21.028Z",
"date": "2023-07-16T11:23:39.345Z",
"value": true
},
"general": {

View file

@ -55,6 +55,39 @@
"enabled": true,
"label": "~/.config"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.oh-my-zsh",
"path": "/home/matt/.oh-my-zsh",
"scheme": "file"
},
"enabled": true,
"label": "~/.oh-my-zsh"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.oh-my-zsh/themes",
"path": "/home/matt/.oh-my-zsh/themes",
"scheme": "file"
},
"enabled": true,
"label": "~/.oh-my-zsh/themes"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.config/lazygit",
"path": "/home/matt/.config/lazygit",
"scheme": "file"
},
"enabled": true,
"label": "~/.config/lazygit"
},
{
"id": "openRecentFolder",
"uri": {
@ -70,12 +103,12 @@
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.config/BetterDiscord/plugins",
"path": "/home/matt/.config/BetterDiscord/plugins",
"external": "file:///usr/share/sddm/themes/sugar-candy",
"path": "/usr/share/sddm/themes/sugar-candy",
"scheme": "file"
},
"enabled": true,
"label": "~/.config/BetterDiscord/plugins"
"label": "/usr/share/sddm/themes/sugar-candy"
},
{
"id": "openRecentFolder",
@ -88,6 +121,17 @@
"enabled": true,
"label": "~/Repos/Personal/StartPage"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.config/BetterDiscord/plugins",
"path": "/home/matt/.config/BetterDiscord/plugins",
"scheme": "file"
},
"enabled": true,
"label": "~/.config/BetterDiscord/plugins"
},
{
"id": "openRecentFolder",
"uri": {
@ -110,50 +154,6 @@
"enabled": true,
"label": "/usr/lib/librewolf/browser"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.local/share/yadm/repo.git",
"path": "/home/matt/.local/share/yadm/repo.git",
"scheme": "file"
},
"enabled": true,
"label": "~/.local/share/yadm/repo.git"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt",
"path": "/home/matt",
"scheme": "file"
},
"enabled": true,
"label": "/home/matt"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.config/rofi",
"path": "/home/matt/.config/rofi",
"scheme": "file"
},
"enabled": true,
"label": "~/.config/rofi"
},
{
"id": "openRecentFolder",
"uri": {
"$mid": 1,
"external": "file:///home/matt/Repos/Clase/2%C2%BADAM/PSP",
"path": "/home/matt/Repos/Clase/2ºDAM/PSP",
"scheme": "file"
},
"enabled": true,
"label": "~/Repos/Clase/2ºDAM/PSP"
},
{
"id": "vscode.menubar.separator"
},
@ -161,12 +161,23 @@
"id": "openRecentFile",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.vscode/extensions/github.copilot-1.96.255/dist/extension.js",
"path": "/home/matt/.vscode/extensions/github.copilot-1.96.255/dist/extension.js",
"external": "file:///home/matt/.config/fish/functions/fish_prompt.fish",
"path": "/home/matt/.config/fish/functions/fish_prompt.fish",
"scheme": "file"
},
"enabled": true,
"label": "~/.vscode/extensions/github.copilot-1.96.255/dist/extension.js"
"label": "~/.config/fish/functions/fish_prompt.fish"
},
{
"id": "openRecentFile",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.zshrc",
"path": "/home/matt/.zshrc",
"scheme": "file"
},
"enabled": true,
"label": "~/.zshrc"
},
{
"id": "openRecentFile",
@ -179,6 +190,17 @@
"enabled": true,
"label": "/opt/vscodium-bin/resources/app/product.json"
},
{
"id": "openRecentFile",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.vscode/extensions/github.copilot-1.96.255/dist/extension.js",
"path": "/home/matt/.vscode/extensions/github.copilot-1.96.255/dist/extension.js",
"scheme": "file"
},
"enabled": true,
"label": "~/.vscode/extensions/github.copilot-1.96.255/dist/extension.js"
},
{
"id": "openRecentFile",
"uri": {
@ -234,17 +256,6 @@
"enabled": true,
"label": "~/.config/kitty/kitty.conf"
},
{
"id": "openRecentFile",
"uri": {
"$mid": 1,
"external": "file:///home/matt/.zshrc",
"path": "/home/matt/.zshrc",
"scheme": "file"
},
"enabled": true,
"label": "~/.zshrc"
},
{
"id": "openRecentFile",
"uri": {
@ -256,17 +267,6 @@
"enabled": true,
"label": "/docs/Documentos/Repos/Non-Personal/Community Dotfiles/.zshrc"
},
{
"id": "openRecentFile",
"uri": {
"$mid": 1,
"external": "file:///home/matt/%25F",
"path": "/home/matt/%F",
"scheme": "file"
},
"enabled": true,
"label": "~/%F"
},
{
"id": "vscode.menubar.separator"
},
@ -681,8 +681,7 @@
},
{
"id": "workbench.action.toggleSidebarVisibility",
"label": "&&Primary Side Bar",
"checked": true
"label": "&&Primary Side Bar"
},
{
"id": "workbench.action.toggleAuxiliaryBar",
@ -1794,7 +1793,7 @@
"editorPartMinWidth": 220,
"titleBarHeight": 0,
"activityBarWidth": 48,
"sideBarWidth": 295,
"sideBarWidth": 0,
"statusBarHeight": 0,
"windowBorder": false
}
@ -1805,10 +1804,10 @@
"backupPath": "/home/matt/.config/VSCodium/Backups/375730732710406c4b825f9cde716ece",
"uiState": {
"mode": 1,
"x": 0,
"y": 0,
"width": 2516,
"height": 976
"x": 21,
"y": 1109,
"width": 2404,
"height": 934
}
},
"openedWindows": []
@ -1823,10 +1822,7 @@
"folderUri": "file:///home/matt/.config/awesome"
},
{
"folderUri": "file:///home/matt/.config/BetterDiscord/plugins"
},
{
"folderUri": "file:///home/matt/.librewolf/jj4t427t.default-release/chrome"
"folderUri": "file:///home/matt/.oh-my-zsh"
},
{
"folderUri": "file:///home/matt/.config"
@ -1882,9 +1878,13 @@
"file:///home/matt/.local/share/yadm/repo.git": "__default__profile__",
"file:///usr/lib/librewolf/browser": "6378edb4",
"file:///home/matt/.config/pipewire": "__default__profile__",
"file:///home/matt/Repos/Personal/StartPage": "__default__profile__",
"file:///home/matt/.config/BetterDiscord/plugins": "__default__profile__",
"file:///home/matt/Repos/Personal/StartPage": "__default__profile__",
"file:///usr/share/sddm/themes/sugar-candy": "__default__profile__",
"file:///home/matt/.librewolf/jj4t427t.default-release/chrome": "__default__profile__",
"file:///home/matt/.config/lazygit": "__default__profile__",
"file:///home/matt/.oh-my-zsh/themes": "__default__profile__",
"file:///home/matt/.oh-my-zsh": "__default__profile__",
"file:///home/matt/.config": "__default__profile__"
},
"emptyWindows": {}

View file

@ -134,7 +134,7 @@
"debug.allowBreakpointsEverywhere": true,
"terminal.integrated.cursorBlinking": true,
"terminal.integrated.cursorStyle": "line",
"terminal.integrated.defaultProfile.linux": "zsh",
"terminal.integrated.defaultProfile.linux": "fish",
"terminal.integrated.fontFamily": "'JetBrains Mono Light', 'monospace', monospace",
"terminal.integrated.gpuAcceleration": "on",
"terminal.integrated.shellIntegration.suggestEnabled": true,
@ -250,10 +250,10 @@
"editor.defaultFormatter": "stylelint.vscode-stylelint"
},
"codeium.enableConfig": {
"*": false
"*": true
},
"search.followSymlinks": false,
"workbench.statusBar.visible": false,
"workbench.editor.showTabs": false,
"editor.minimap.enabled": false
"workbench.statusBar.visible": false,
"editor.minimap.enabled": false,
}

View file

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

View file

@ -0,0 +1 @@
__to_update_bookmark_completions

View file

@ -0,0 +1,186 @@
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)
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
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)
set -l __async_prompt_last_pipestatus $pipestatus
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_last_pipestatus=$__async_prompt_last_pipestatus __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
sleep 0.3
__async_prompt_signal
sleep 0.3
__async_prompt_signal' &
disown
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_repaint_prompt --on-signal (__async_prompt_config_internal_signal)
commandline -f repaint >/dev/null 2>/dev/null
end

View 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

View file

@ -0,0 +1,300 @@
# 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.16.5
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) | cut -d '"' -f4
else if test -n "$SWAYSOCK"
and type -q jq
swaymsg --type get_tree | jq '.. | objects | select(.focused == true) | .id'
else if begin
test "$XDG_SESSION_DESKTOP" = gnome; and type -q gdbus
end
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'global.display.focus_window.get_id()'
else if type -q xprop
and test -n "$DISPLAY"
# Test that the X server at $DISPLAY is running
and xprop -grammar >/dev/null 2>&1
xprop -root 32x '\t$0' _NET_ACTIVE_WINDOW | cut -f 2
else if uname -a | string match --quiet --ignore-case --regex microsoft
__done_run_powershell_script '
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class WindowsCompat {
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
}
"@
[WindowsCompat]::GetForegroundWindow()
'
else if set -q __done_allow_nongraphical
echo 12345 # dummy value
end
end
function __done_is_tmux_window_active
set -q fish_pid; or set -l fish_pid %self
# find the outermost process within tmux
# ppid != "tmux" -> pid = ppid
# ppid == "tmux" -> break
set tmux_fish_pid $fish_pid
while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim)
and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid))
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
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 "$__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
function __done_started --on-event fish_preexec
set __done_initial_window_id (__done_get_focused_window_id)
end
function __done_ended --on-event fish_prompt
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
and not string match -qr $__done_exclude $history[1] # don't notify on git commands which might wait external editor
# 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/ $history[1]"
set -l sender $__done_initial_window_id
if test $exit_status -ne 0
set title "Failed ($exit_status) after $humanized_duration"
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 type -q terminal-notifier # https://github.com/julienXX/terminal-notifier
if test "$__done_notify_sound" -eq 1
terminal-notifier -message "$message" -title "$title" -sender "$__done_initial_window_id" -sound default
else
terminal-notifier -message "$message" -title "$title" -sender "$__done_initial_window_id"
end
else if type -q osascript # AppleScript
osascript -e "display notification \"$message\" with title \"$title\""
if test "$__done_notify_sound" -eq 1
echo -e "\a" # bell sound
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 "$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

@ -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

View file

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

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

@ -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

View file

@ -0,0 +1,3 @@
if test -z "$TO_DIR"
set -U TO_DIR ~/.tofish
end

25
.config/fish/config.fish Normal file
View file

@ -0,0 +1,25 @@
if status is-interactive
# Commands to run in interactive sessions can go here
neofetch
end
alias code='vscodium'
alias ls='exa --long --header -a --icons'
alias tree='exa --long --header -a --icons --tree'
alias bruh='genact -s 4'
alias matrix='unimatrix'
alias q='exit'
alias install='sudo pacman -S '
alias uninstall='sudo pacman -R '
alias yayinstall='yay -S '
alias yayuninstall='yay -R '
alias update='sudo pacman -Syu'
alias yayupdate='yay -Syu'
alias search='pacseek'
alias gpt='tgpt'
alias clock='tty-clock -sbc'
alias l='xplr'
alias sysproc='sysz'
alias cat='bat'
alias dots='yadm enter lazygit'
alias audiorestart='systemctl --user restart wireplumber pipewire pipewire-pulse'

View file

@ -0,0 +1,5 @@
patrickf1/fzf.fish
franciscolourenco/done
acomagu/fish-async-prompt
matchai/spacefish
joehillen/to-fish

View file

@ -0,0 +1,53 @@
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR --export FZF_DEFAULT_OPTS:\x2d\x2dcolor\x3dbg\x2b\x3a\x23363a4f\x2cbg\x3a\x2324273a\x2cspinner\x3a\x23f4dbd6\x2chl\x3a\x23ed8796\x20\x2d\x2dcolor\x3dfg\x3a\x23cad3f5\x2cheader\x3a\x23ed8796\x2cinfo\x3a\x23c6a0f6\x2cpointer\x3a\x23f4dbd6\x20\x2d\x2dcolor\x3dmarker\x3a\x23f4dbd6\x2cfg\x2b\x3a\x23cad3f5\x2cprompt\x3a\x23c6a0f6\x2chl\x2b\x3a\x23ed8796
SETUVAR TO_DIR:/home/matt/\x2etofish
SETUVAR __fish_initialized:3400
SETUVAR _fisher_acomagu_2F_fish_2D_async_2D_prompt_files:\x7e/\x2econfig/fish/conf\x2ed/__async_prompt\x2efish
SETUVAR _fisher_franciscolourenco_2F_done_files:\x7e/\x2econfig/fish/conf\x2ed/done\x2efish
SETUVAR _fisher_joehillen_2F_to_2D_fish_files:\x7e/\x2econfig/fish/functions/to\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/to\x2efish\x1e\x7e/\x2econfig/fish/completions/to\x2efish
SETUVAR _fisher_matchai_2F_spacefish_files:\x7e/\x2econfig/fish/functions/__sf_lib_section\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_aws\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_battery\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_char\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_conda\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_dir\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_docker\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_dotnet\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_elixir\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_exec_time\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_exit_code\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_git\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_git_branch\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_golang\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_haskell\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_host\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_jobs\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_julia\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_kubecontext\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_line_sep\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_node\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_package\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_php\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_pyenv\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_ruby\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_rust\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_time\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_user\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_venv\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_section_vi_mode\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_util_git_branch\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_util_human_time\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_util_set_default\x2efish\x1e\x7e/\x2econfig/fish/functions/__sf_util_truncate_dir\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_mode_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_prompt\x2efish\x1e\x7e/\x2econfig/fish/functions/fish_right_prompt\x2efish
SETUVAR _fisher_patrickf1_2F_fzf_2E_fish_files:\x7e/\x2econfig/fish/functions/_fzf_configure_bindings_help\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_extract_var_info\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_changed_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_preview_file\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_diff_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_report_file_type\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_directory\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_log\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_git_status\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_history\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_processes\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_search_variables\x2efish\x1e\x7e/\x2econfig/fish/functions/_fzf_wrapper\x2efish\x1e\x7e/\x2econfig/fish/functions/fzf_configure_bindings\x2efish\x1e\x7e/\x2econfig/fish/conf\x2ed/fzf\x2efish\x1e\x7e/\x2econfig/fish/completions/fzf_configure_bindings\x2efish
SETUVAR _fisher_plugins:patrickf1/fzf\x2efish\x1efranciscolourenco/done\x1eacomagu/fish\x2dasync\x2dprompt\x1ematchai/spacefish\x1ejoehillen/to\x2dfish
SETUVAR _fisher_upgraded_to_4_4:\x1d
SETUVAR fish_color_autosuggestion:6e738d
SETUVAR fish_color_cancel:ed8796
SETUVAR fish_color_command:8aadf4
SETUVAR fish_color_comment:8087a2
SETUVAR fish_color_cwd:eed49f
SETUVAR fish_color_cwd_root:red
SETUVAR fish_color_end:f5a97f
SETUVAR fish_color_error:ed8796
SETUVAR fish_color_escape:ee99a0
SETUVAR fish_color_gray:6e738d
SETUVAR fish_color_history_current:\x2d\x2dbold
SETUVAR fish_color_host:8aadf4
SETUVAR fish_color_host_remote:a6da95
SETUVAR fish_color_keyword:ed8796
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
SETUVAR fish_color_normal:cad3f5
SETUVAR fish_color_operator:f5bde6
SETUVAR fish_color_option:\x1d
SETUVAR fish_color_param:f0c6c6
SETUVAR fish_color_quote:a6da95
SETUVAR fish_color_redirection:f5bde6
SETUVAR fish_color_search_match:\x2d\x2dbackground\x3d363a4f
SETUVAR fish_color_selection:\x2d\x2dbackground\x3d363a4f
SETUVAR fish_color_status:ed8796
SETUVAR fish_color_user:8bd5ca
SETUVAR fish_color_valid_path:\x2d\x2dunderline
SETUVAR fish_greeting:
SETUVAR fish_key_bindings:fish_default_key_bindings
SETUVAR fish_pager_color_background:\x1d
SETUVAR fish_pager_color_completion:cad3f5
SETUVAR fish_pager_color_description:6e738d
SETUVAR fish_pager_color_prefix:f5bde6
SETUVAR fish_pager_color_progress:6e738d
SETUVAR fish_pager_color_secondary_background:\x1d
SETUVAR fish_pager_color_secondary_completion:\x1d
SETUVAR fish_pager_color_secondary_description:\x1d
SETUVAR fish_pager_color_secondary_prefix:\x1d
SETUVAR fish_pager_color_selected_background:\x1d
SETUVAR fish_pager_color_selected_completion:\x1d
SETUVAR fish_pager_color_selected_description:\x1d
SETUVAR fish_pager_color_selected_prefix:\x1d

View file

@ -0,0 +1,28 @@
function __sf_lib_section -a color prefix content suffix
# If there are only 2 args, they are $content and $prefix
if test (count $argv) -eq 2
set content $argv[2]
set prefix
end
if test "$sf_prompt_opened" = "true" -a "$SPACEFISH_PROMPT_PREFIXES_SHOW" = "true"
# Echo prefixes in bold white
set_color --bold
echo -e -n -s $prefix
set_color normal
end
# Set the prompt as having been opened
set -g sf_prompt_opened true
set_color --bold $color
echo -e -n $content
set_color normal
if test "$SPACEFISH_PROMPT_SUFFIXES_SHOW" = "true"
# Echo suffixes in bold white
set_color --bold
echo -e -n -s $suffix
set_color normal
end
end

View file

@ -0,0 +1,48 @@
#
# Amazon Web Services (AWS)
#
# The AWS Command Line Interface (CLI) is a unified tool to manage AWS services.
# Link: https://aws.amazon.com/cli/
function __sf_section_aws -d "Display the selected aws profile"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_AWS_SHOW true
__sf_util_set_default SPACEFISH_AWS_PREFIX "using "
__sf_util_set_default SPACEFISH_AWS_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_AWS_SYMBOL "☁️ "
__sf_util_set_default SPACEFISH_AWS_COLOR ff8700
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show the selected AWS-cli profile
[ $SPACEFISH_AWS_SHOW = false ]; and return
# Ensure the aws command is available
type -q aws; or return
set -l PROFILE_NAME
# if aws-vault is in use, override profile with that
if test -n "$AWS_VAULT"
set PROFILE_NAME "$AWS_VAULT"
else
set PROFILE_NAME "$AWS_PROFILE"
end
# Early return if there's no named profile, or it's set to default
if test -z "$PROFILE_NAME" \
-o "$PROFILE_NAME" = "default"
return
end
__sf_lib_section \
$SPACEFISH_AWS_COLOR \
$SPACEFISH_AWS_PREFIX \
"$SPACEFISH_AWS_SYMBOL""$PROFILE_NAME" \
$SPACEFISH_AWS_SUFFIX
end

View file

@ -0,0 +1,114 @@
#
# Battery
#
function __sf_section_battery -d "Displays battery symbol and charge"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# | SPACEFISH_BATTERY_SHOW | below threshold | above threshold | fully charged |
# |------------------------+-----------------+-----------------+---------------|
# | false | hidden | hidden | hidden |
# | always | shown | shown | shown |
# | true | shown | hidden | hidden |
# | charged | shown | hidden | shown |
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_BATTERY_SHOW true
__sf_util_set_default SPACEFISH_BATTERY_PREFIX ""
__sf_util_set_default SPACEFISH_BATTERY_SUFFIX " "
__sf_util_set_default SPACEFISH_BATTERY_SYMBOL_CHARGING ⇡
__sf_util_set_default SPACEFISH_BATTERY_SYMBOL_DISCHARGING ⇣
__sf_util_set_default SPACEFISH_BATTERY_SYMBOL_FULL •
__sf_util_set_default SPACEFISH_BATTERY_THRESHOLD 10
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show section only if any of the following is true
# - SPACEFISH_BATTERY_SHOW = "always"
# - SPACEFISH_BATTERY_SHOW = "true" and
# - battery percentage is below the given limit (default: 10%)
# - SPACEFISH_BATTERY_SHOW = "charged" and
# - Battery is fully charged
# Check that user wants to show battery levels
[ $SPACEFISH_BATTERY_SHOW = false ]; and return
set -l battery_data
set -l battery_percent
set -l battery_status
set -l battery_color
set -l battery_symbol
# Darwin and macOS machines
if type -q pmset
set battery_data (pmset -g batt | grep "InternalBattery")
# Return if no internal battery
if test -z (echo $battery_data)
return
end
set battery_percent (echo $battery_data | grep -oE "[0-9]{1,3}%")
# spaceship has echo $battery_data | awk -F '; *' 'NR==2 { print $2 }', but NR==2 did not return anything.
set battery_status (echo $battery_data | awk -F '; *' '{ print $2 }')
# Linux machines
else if type -q upower
set -l battery (upower -e | grep battery | head -1)
[ -z $battery ]; and return
set -l IFS # Clear IFS to allow for multi-line variables
set battery_data (upower -i $battery)
set battery_percent (echo $battery_data | grep percentage | awk '{print $2}')
set battery_status (echo $battery_data | grep state | awk '{print $2}')
# Windows machines.
else if type -q acpi
set -l battery_data (acpi -b 2>/dev/null | head -1)
# Return if no battery
[ -z $battery_data ]; and return
set battery_percent ( echo $battery_data | awk '{print $4}' )
set battery_status ( echo $battery_data | awk '{print tolower($3)}' )
else
return
end
# Remove trailing % and symbols for comparison
set battery_percent (echo $battery_percent | string trim --chars=%[,;])
if test "$battery_percent" -eq 100 -o -n (echo (string match -r "(charged|full)" $battery_status))
set battery_color green
else if test "$battery_percent" -lt "$SPACEFISH_BATTERY_THRESHOLD"
set battery_color red
else
set battery_color yellow
end
# Battery indicator based on current status of battery
if test "$battery_status" = "charging"
set battery_symbol $SPACEFISH_BATTERY_SYMBOL_CHARGING
else if test -n (echo (string match -r "^[dD]ischarg.*" $battery_status))
set battery_symbol $SPACEFISH_BATTERY_SYMBOL_DISCHARGING
else
set battery_symbol $SPACEFISH_BATTERY_SYMBOL_FULL
end
if test "$SPACEFISH_BATTERY_SHOW" = "always" \
-o "$battery_percent" -lt "$SPACEFISH_BATTERY_THRESHOLD" \
-o "$SPACEFISH_BATTERY_SHOW" = "charged" \
-a -n (echo (string match -r "(charged|full)" $battery_status))
__sf_lib_section \
$battery_color \
$SPACEFISH_BATTERY_PREFIX \
"$battery_symbol$battery_percent%" \
$SPACEFISH_BATTERY_SUFFIX
end
end

View file

@ -0,0 +1,35 @@
#
# Prompt character
#
function __sf_section_char -d "Display the prompt character"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_CHAR_PREFIX ""
__sf_util_set_default SPACEFISH_CHAR_SUFFIX " "
__sf_util_set_default SPACEFISH_CHAR_SYMBOL ➜
__sf_util_set_default SPACEFISH_CHAR_COLOR_SUCCESS green
__sf_util_set_default SPACEFISH_CHAR_COLOR_FAILURE red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Color $SPACEFISH_CHAR_SYMBOL red if previous command failed and
# color it in green if the command succeeded.
set -l color
if test $sf_exit_code -eq 0
set color $SPACEFISH_CHAR_COLOR_SUCCESS
else
set color $SPACEFISH_CHAR_COLOR_FAILURE
end
__sf_lib_section \
$color \
$SPACEFISH_CHAR_PREFIX \
$SPACEFISH_CHAR_SYMBOL \
$SPACEFISH_CHAR_SUFFIX
end

View file

@ -0,0 +1,36 @@
#
# Conda
#
# Current Conda version.
function __sf_section_conda -d "Display current Conda version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_CONDA_SHOW true
__sf_util_set_default SPACEFISH_CONDA_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_CONDA_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_CONDA_SYMBOL "🅒 "
__sf_util_set_default SPACEFISH_CONDA_COLOR blue
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_CONDA_SHOW = false ]; and return
# Show Conda version only if conda is installed and CONDA_DEFAULT_ENV is set
if not type -q conda; \
or test -z "$CONDA_DEFAULT_ENV";
return
end
set -l conda_version (conda -V | string split ' ')[2]
__sf_lib_section \
$SPACEFISH_CONDA_COLOR \
$SPACEFISH_CONDA_PREFIX \
"$SPACEFISH_CONDA_SYMBOL"v"$conda_version" \
$SPACEFISH_CONDA_SUFFIX
end

View file

@ -0,0 +1,54 @@
#
# Working directory
#
function __sf_section_dir -d "Display the current truncated directory"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_DIR_SHOW true
__sf_util_set_default SPACEFISH_DIR_PREFIX "in "
__sf_util_set_default SPACEFISH_DIR_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_DIR_TRUNC 3
__sf_util_set_default SPACEFISH_DIR_TRUNC_REPO true
__sf_util_set_default SPACEFISH_DIR_COLOR cyan
# Write Permissions lock symbol
__sf_util_set_default SPACEFISH_DIR_LOCK_SHOW true
__sf_util_set_default SPACEFISH_DIR_LOCK_SYMBOL ""
__sf_util_set_default SPACEFISH_DIR_LOCK_COLOR red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_DIR_SHOW = false ]; and return
set -l dir
set -l tmp
set -l git_root (command git rev-parse --show-toplevel 2>/dev/null)
if test "$SPACEFISH_DIR_TRUNC_REPO" = "true" -a -n "$git_root"
# Resolve to physical PWD instead of logical
set -l resolvedPWD (pwd -P 2>/dev/null; or pwd)
# Treat repo root as top level directory
set tmp (string replace $git_root (basename $git_root) $resolvedPWD)
else
set -l realhome ~
set tmp (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD)
end
# Truncate the path to have a limited number of dirs
set dir (__sf_util_truncate_dir $tmp $SPACEFISH_DIR_TRUNC)
if [ $SPACEFISH_DIR_LOCK_SHOW = true -a ! -w . ]
set DIR_LOCK_SYMBOL (set_color $SPACEFISH_DIR_LOCK_COLOR)" $SPACEFISH_DIR_LOCK_SYMBOL"(set_color --bold)
end
__sf_lib_section \
$SPACEFISH_DIR_COLOR \
$SPACEFISH_DIR_PREFIX \
$dir \
"$DIR_LOCK_SYMBOL""$SPACEFISH_DIR_SUFFIX"
end

View file

@ -0,0 +1,52 @@
#
# Docker
#
# Current Docker version and Machine name.
function __sf_section_docker -d "Display docker version and machine name"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_DOCKER_SHOW true
__sf_util_set_default SPACEFISH_DOCKER_PREFIX "is "
__sf_util_set_default SPACEFISH_DOCKER_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_DOCKER_SYMBOL "🐳 "
__sf_util_set_default SPACEFISH_DOCKER_COLOR cyan
__sf_util_set_default SPACEFISH_DOCKER_VERBOSE_VERSION false
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_DOCKER_SHOW = false ]; and return
# Show Docker version only if docker is installed
type -q docker; or return
# Show docker version only when pwd has Dockerfile, docker-compose.yml, .dockerenv in root or COMPOSE_FILE
if not test -f Dockerfile \
-o -f docker-compose.yml \
-o -f /.dockerenv \
-o -f "$COMPOSE_FILE"
return
end
set -l docker_version (docker version -f "{{.Server.Version}}" 2>/dev/null)
# if docker daemon isn't running you'll get an error like 'Bad response from Docker engine'
[ -z $docker_version ]; and return
if test "$SPACEFISH_DOCKER_VERBOSE_VERSION" = "false"
set docker_version (string split - $docker_version)[1]
end
if test -n "$DOCKER_MACHINE_NAME"
set docker_version $docker_version via $DOCKER_MACHINE_NAME
end
__sf_lib_section \
$SPACEFISH_DOCKER_COLOR \
$SPACEFISH_DOCKER_PREFIX \
"$SPACEFISH_DOCKER_SYMBOL"v"$docker_version" \
$SPACEFISH_DOCKER_SUFFIX
end

View file

@ -0,0 +1,50 @@
#
# .NET
#
# .NET Framework is a software framework developed by Microsoft.
# It includes a large class library and provides language interoperability
# across several programming languages.
# Link: https://www.microsoft.com/net
function __sf_section_dotnet -d "Display the .NET SDK version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_DOTNET_SHOW true
__sf_util_set_default SPACEFISH_DOTNET_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_DOTNET_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_DOTNET_SYMBOL ".NET "
__sf_util_set_default SPACEFISH_DOTNET_COLOR "af00d7" # 128 in the original version, but renders as blue in iTerm2?
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of .NET SDK
[ $SPACEFISH_DOTNET_SHOW = false ]; and return
# Ensure the dotnet command is available
type -q dotnet; or return
if not test -f project.json \
-o -f global.json \
-o -f paket.dependencies \
-o (count *.csproj) -gt 0 \
-o (count *.fsproj) -gt 0 \
-o (count *.xproj) -gt 0 \
-o (count *.sln) -gt 0
return
end
# From the
# dotnet-cli automatically handles SDK pinning (specified in a global.json file)
# therefore, this already returns the expected version for the current directory
set -l dotnet_version (dotnet --version 2>/dev/null)
__sf_lib_section \
$SPACEFISH_DOTNET_COLOR \
$SPACEFISH_DOTNET_PREFIX \
"$SPACEFISH_DOTNET_SYMBOL""$dotnet_version" \
$SPACEFISH_DOTNET_SUFFIX
end

View file

@ -0,0 +1,57 @@
#
# Elixir
#
# A dynamic, reflective, object-oriented, general-purpose programming language.
# Link: https://www.elixir-lang.org/
function __sf_section_elixir -d "Show current version of Elixir"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_ELIXIR_SHOW true
__sf_util_set_default SPACEFISH_ELIXIR_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_ELIXIR_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_ELIXIR_SYMBOL "💧 "
__sf_util_set_default SPACEFISH_ELIXIR_DEFAULT_VERSION $SPACEFISH_ELIXIR_DEFAULT_VERSION
__sf_util_set_default SPACEFISH_ELIXIR_COLOR magenta
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Check if that user wants to show elixir version
[ $SPACEFISH_ELIXIR_SHOW = false ]; and return
# Show versions only for Elixir-specific folders
if not test -f mix.exs \
-o (count *.ex) -gt 0 \
-o (count *.exs) -gt 0
return
end
set -l elixir_version
if type -q kiex
set elixir_version $ELIXIR_VERSION
else if type -q exenv
set elixir_version (exenv version-name)
else if type -q elixir
set elixir_version (elixir -v 2>/dev/null | string match -r "Elixir.*" | string split " ")[2]
else
return
end
[ -z "$elixir_version" -o "$elixir_version" = "system" ]; and return
# Add 'v' before elixir version that starts with a number
if test -n (echo (string match -r "^[0-9].+\$" "$elixir_version"))
set elixir_version "v$elixir_version"
end
__sf_lib_section \
$SPACEFISH_ELIXIR_COLOR \
$SPACEFISH_ELIXIR_PREFIX \
"$SPACEFISH_ELIXIR_SYMBOL""$elixir_version" \
$SPACEFISH_ELIXIR_SUFFIX
end

View file

@ -0,0 +1,33 @@
#
# Execution time
#
function __sf_section_exec_time -d "Display the execution time of the last command"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_EXEC_TIME_SHOW true
__sf_util_set_default SPACEFISH_EXEC_TIME_PREFIX "took "
__sf_util_set_default SPACEFISH_EXEC_TIME_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_EXEC_TIME_COLOR yellow
__sf_util_set_default SPACEFISH_EXEC_TIME_ELAPSED 5
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_EXEC_TIME_SHOW = false ]; and return
# Allow for compatibility between fish 2.7 and 3.0
set -l command_duration "$CMD_DURATION$cmd_duration"
if test -n "$command_duration" -a "$command_duration" -gt (math "$SPACEFISH_EXEC_TIME_ELAPSED * 1000")
set -l human_command_duration (echo $command_duration | __sf_util_human_time)
__sf_lib_section \
$SPACEFISH_EXEC_TIME_COLOR \
$SPACEFISH_EXEC_TIME_PREFIX \
$human_command_duration \
$SPACEFISH_EXEC_TIME_SUFFIX
end
end

View file

@ -0,0 +1,26 @@
# Exit-code
#
function __sf_section_exit_code -d "Shows the exit code from the previous command."
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_EXIT_CODE_SHOW false
__sf_util_set_default SPACEFISH_EXIT_CODE_PREFIX ""
__sf_util_set_default SPACEFISH_EXIT_CODE_SUFFIX " "
__sf_util_set_default SPACEFISH_EXIT_CODE_SYMBOL ✘
__sf_util_set_default SPACEFISH_EXIT_CODE_COLOR red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_EXIT_CODE_SHOW = false ]; or test $sf_exit_code -eq 0; and return
__sf_lib_section \
$SPACEFISH_EXIT_CODE_COLOR \
$SPACEFISH_EXIT_CODE_PREFIX \
"$SPACEFISH_EXIT_CODE_SYMBOL$sf_exit_code" \
$SPACEFISH_EXIT_CODE_SUFFIX
end

View file

@ -0,0 +1,35 @@
#
# Git
#
function __sf_section_git -d "Display the git branch and status"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_GIT_SHOW true
__sf_util_set_default SPACEFISH_GIT_PREFIX "on "
__sf_util_set_default SPACEFISH_GIT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_GIT_SYMBOL " "
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show both git branch and git status:
# spacefish_git_branch
# spacefish_git_status
[ $SPACEFISH_GIT_SHOW = false ]; and return
set -l git_branch (__sf_section_git_branch)
set -l git_status (__sf_section_git_status)
[ -z $git_branch ]; and return
__sf_lib_section \
fff \
$SPACEFISH_GIT_PREFIX \
"$git_branch$git_status" \
$SPACEFISH_GIT_SUFFIX
end

View file

@ -0,0 +1,28 @@
#
# Git branch
#
function __sf_section_git_branch -d "Format the displayed branch name"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_GIT_BRANCH_SHOW true
__sf_util_set_default SPACEFISH_GIT_BRANCH_PREFIX $SPACEFISH_GIT_SYMBOL
__sf_util_set_default SPACEFISH_GIT_BRANCH_SUFFIX ""
__sf_util_set_default SPACEFISH_GIT_BRANCH_COLOR magenta
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_GIT_BRANCH_SHOW = false ]; and return
set -l git_branch (__sf_util_git_branch)
[ -z $git_branch ]; and return
__sf_lib_section \
$SPACEFISH_GIT_BRANCH_COLOR \
$SPACEFISH_GIT_BRANCH_PREFIX$git_branch$SPACEFISH_GIT_BRANCH_SUFFIX
end

View file

@ -0,0 +1,100 @@
#
# Git status
#
function __sf_section_git_status -d "Display the current git status"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_GIT_STATUS_SHOW true
__sf_util_set_default SPACEFISH_GIT_STATUS_PREFIX " ["
__sf_util_set_default SPACEFISH_GIT_STATUS_SUFFIX ]
__sf_util_set_default SPACEFISH_GIT_STATUS_COLOR red
__sf_util_set_default SPACEFISH_GIT_STATUS_UNTRACKED \?
__sf_util_set_default SPACEFISH_GIT_STATUS_ADDED +
__sf_util_set_default SPACEFISH_GIT_STATUS_MODIFIED !
__sf_util_set_default SPACEFISH_GIT_STATUS_RENAMED »
__sf_util_set_default SPACEFISH_GIT_STATUS_DELETED ✘
__sf_util_set_default SPACEFISH_GIT_STATUS_STASHED \$
__sf_util_set_default SPACEFISH_GIT_STATUS_UNMERGED =
__sf_util_set_default SPACEFISH_GIT_STATUS_AHEAD ⇡
__sf_util_set_default SPACEFISH_GIT_STATUS_BEHIND ⇣
__sf_util_set_default SPACEFISH_GIT_STATUS_DIVERGED ⇕
__sf_util_set_default SPACEFISH_GIT_PROMPT_ORDER untracked added modified renamed deleted stashed unmerged diverged ahead behind
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_GIT_STATUS_SHOW = false ]; and return
set -l git_status
set -l is_ahead
set -l is_behind
set -l index (command git status --porcelain 2>/dev/null -b)
set -l trimmed_index (string split \n $index | string sub --start 1 --length 2)
for i in $trimmed_index
if test (string match '\?\?' $i)
set git_status untracked $git_status
end
if test (string match '*A*' $i)
set git_status added $git_status
end
if test (string match '*M*' $i)
set git_status modified $git_status
end
if test (string match '*R*' $i)
set git_status renamed $git_status
end
if test (string match '*D*' $i)
set git_status deleted $git_status
end
if test (string match '*U*' $i)
set git_status unmerged $git_status
end
end
# Check for stashes
if test -n (echo (command git rev-parse --verify refs/stash 2>/dev/null))
set git_status stashed $git_status
end
# Check whether the branch is ahead
if test (string match '*ahead*' $index)
set is_ahead true
end
# Check whether the branch is behind
if test (string match '*behind*' $index)
set is_behind true
end
# Check whether the branch has diverged
if test "$is_ahead" = "true" -a "$is_behind" = "true"
set git_status diverged $git_status
else if test "$is_ahead" = "true"
set git_status ahead $git_status
else if test "$is_behind" = "true"
set git_status behind $git_status
end
set -l full_git_status
for i in $SPACEFISH_GIT_PROMPT_ORDER
set i (string upper $i)
set git_status (string upper $git_status)
if contains $i in $git_status
set -l status_symbol SPACEFISH_GIT_STATUS_$i
set full_git_status "$$status_symbol$full_git_status"
end
end
# Check if git status
if test -n "$full_git_status"
__sf_lib_section \
$SPACEFISH_GIT_STATUS_COLOR \
"$SPACEFISH_GIT_STATUS_PREFIX$full_git_status$SPACEFISH_GIT_STATUS_SUFFIX"
end
end

View file

@ -0,0 +1,55 @@
#
# Go
#
# Go is an open source programming language that makes it easy
# to build efficient software.
# Link: https://golang.org/
function __sf_section_golang -d "Display the current go version if you're inside GOPATH"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_GOLANG_SHOW true
__sf_util_set_default SPACEFISH_GOLANG_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_GOLANG_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_GOLANG_SYMBOL "🐹 "
__sf_util_set_default SPACEFISH_GOLANG_COLOR cyan
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show the current version of Golang
[ $SPACEFISH_GOLANG_SHOW = false ]; and return
# Ensure the go command is available
type -q go; or return
if not test -f go.mod \
-o -d Godeps \
-o -f glide.yaml \
-o (count *.go) -gt 0 \
-o -f Gopkg.yml \
-o -f Gopkg.lock \
-o ([ (count $GOPATH) -gt 0 ]; and string match $GOPATH $PWD)
return
end
set -l go_version (go version | string split ' ')
# Go version is either the commit hash and date (devel +5efe9a8f11 Web Jan 9 07:21:16 2019 +0000)
# at the time of the build or a release tag (go1.11.4)
# https://github.com/matchai/spacefish/issues/137
if test (string match 'devel*' $go_version[3])
set go_version $go_version[3]":"(string sub -s 2 $go_version[4])
else
set go_version "v"(string sub -s 3 $go_version[3])
end
__sf_lib_section \
$SPACEFISH_GOLANG_COLOR \
$SPACEFISH_GOLANG_PREFIX \
"$SPACEFISH_GOLANG_SYMBOL""$go_version" \
$SPACEFISH_GOLANG_SUFFIX
end

View file

@ -0,0 +1,38 @@
#
# Haskell Stack
#
# An advanced, purely functional programming language.
# Link: https://www.haskell.org/
function __sf_section_haskell -d "Show current version of Haskell Tool Stack"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_HASKELL_SHOW true
__sf_util_set_default SPACEFISH_HASKELL_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_HASKELL_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_HASKELL_SYMBOL "λ "
__sf_util_set_default SPACEFISH_HASKELL_COLOR red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Haskell Tool Stack.
[ $SPACEFISH_HASKELL_SHOW = false ]; and return
# Ensure the stack command is available
type -q stack; or return
# If there are stack files in current directory
[ -f ./stack.yaml ]; or return
set -l haskell_version (stack ghc -- --numeric-version --no-install-ghc)
__sf_lib_section \
$SPACEFISH_HASKELL_COLOR \
$SPACEFISH_HASKELL_PREFIX \
"$SPACEFISH_HASKELL_SYMBOL"v"$haskell_version" \
$SPACEFISH_HASKELL_SUFFIX
end

View file

@ -0,0 +1,41 @@
#
# Hostname
#
# If there is an ssh connections, current machine name.
function __sf_section_host -d "Display the current hostname if connected over SSH"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_HOST_SHOW true
__sf_util_set_default SPACEFISH_HOST_PREFIX "at "
__sf_util_set_default SPACEFISH_HOST_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_HOST_COLOR blue
__sf_util_set_default SPACEFISH_HOST_COLOR_SSH green
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ "$SPACEFISH_HOST_SHOW" = false ]; and return
if test "$SPACEFISH_HOST_SHOW" = "always"; or set -q SSH_CONNECTION;
# Determination of what color should be used
set -l host_color
if set -q SSH_CONNECTION;
set host_color $SPACEFISH_HOST_COLOR_SSH
else
set host_color $SPACEFISH_HOST_COLOR
end
__sf_lib_section \
$host_color \
$SPACEFISH_HOST_PREFIX \
(hostname) \
$SPACEFISH_HOST_SUFFIX
end
end

View file

@ -0,0 +1,43 @@
# Jobs
#
function __sf_section_jobs -d "Show icon, if there's a working jobs in the background."
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_JOBS_SHOW true
__sf_util_set_default SPACEFISH_JOBS_PREFIX ""
__sf_util_set_default SPACEFISH_JOBS_SUFFIX " "
__sf_util_set_default SPACEFISH_JOBS_SYMBOL ✦
__sf_util_set_default SPACEFISH_JOBS_COLOR blue
__sf_util_set_default SPACEFISH_JOBS_AMOUNT_PREFIX ""
__sf_util_set_default SPACEFISH_JOBS_AMOUNT_SUFFIX ""
__sf_util_set_default SPACEFISH_JOBS_AMOUNT_THRESHOLD 1
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_JOBS_SHOW = false ]; and return
set jobs_amount (jobs | wc -l | xargs) # Zsh had a much more complicated command.
if test $jobs_amount -eq 0
return
end
if test $jobs_amount -le $SPACEFISH_JOBS_AMOUNT_THRESHOLD
set jobs_amount ''
set SPACEFISH_JOBS_AMOUNT_PREFIX ''
set SPACEFISH_JOBS_AMOUNT_SUFFIX ''
end
set SPACEFISH_JOBS_SECTION "$SPACEFISH_JOBS_SYMBOL$SPACEFISH_JOBS_AMOUNT_PREFIX$jobs_amount$SPACEFISH_JOBS_AMOUNT_SUFFIX"
__sf_lib_section \
$SPACEFISH_JOBS_COLOR \
$SPACEFISH_JOBS_PREFIX \
$SPACEFISH_JOBS_SECTION \
$SPACEFISH_JOBS_SUFFIX
end

View file

@ -0,0 +1,36 @@
#
# Julia
#
# Current Julia version.
function __sf_section_julia -d "Display julia version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_JULIA_SHOW true
__sf_util_set_default SPACEFISH_JULIA_PREFIX "is "
__sf_util_set_default SPACEFISH_JULIA_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_JULIA_SYMBOL "ஃ "
__sf_util_set_default SPACEFISH_JULIA_COLOR green
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_JULIA_SHOW = false ]; and return
# Show Julia version only if julia is installed
type -q julia; or return
# Show julia version only when pwd has *.jl file(s)
[ (count *.jl) -gt 0 ]; or return
set -l julia_version (julia --version | grep --color=never -oE '[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]')
__sf_lib_section \
$SPACEFISH_JULIA_COLOR \
$SPACEFISH_JULIA_PREFIX \
"$SPACEFISH_JULIA_SYMBOL"v"$julia_version" \
$SPACEFISH_JULIA_SUFFIX
end

View file

@ -0,0 +1,45 @@
#
# Kubernetes (kubectl)
#
# Kubernetes is an open-source system for deployment, scaling,
# and management of containerized applications.
# Link: https://kubernetes.io/
function __sf_section_kubecontext -d "Display the kubernetes context"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_KUBECONTEXT_SHOW true
__sf_util_set_default SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW true
__sf_util_set_default SPACEFISH_KUBECONTEXT_PREFIX "at "
__sf_util_set_default SPACEFISH_KUBECONTEXT_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
# Additional space is added because ☸️ is wider than other symbols
# See: https://github.com/denysdovhan/spaceship-prompt/pull/432
__sf_util_set_default SPACEFISH_KUBECONTEXT_SYMBOL "☸️ "
__sf_util_set_default SPACEFISH_KUBECONTEXT_COLOR cyan
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current kubecontext
[ $SPACEFISH_KUBECONTEXT_SHOW = false ]; and return
# Ensure the kubectl command is available
type -q kubectl; or return
set -l kube_context (kubectl config current-context 2>/dev/null)
[ -z $kube_context ]; and return
if test "$SPACEFISH_KUBECONTEXT_NAMESPACE_SHOW" = "true" -a "$kube_context" != "default"
set kube_namespace (kubectl config view --minify --output 'jsonpath={..namespace}' 2>/dev/null)
set kube_context "$kube_context ($kube_namespace)"
end
__sf_lib_section \
$SPACEFISH_KUBECONTEXT_COLOR \
$SPACEFISH_KUBECONTEXT_PREFIX \
"$SPACEFISH_KUBECONTEXT_SYMBOL""$kube_context" \
$SPACEFISH_KUBECONTEXT_SUFFIX
end

View file

@ -0,0 +1,19 @@
#
# Line separator
#
function __sf_section_line_sep -d "Separate the prompt into two lines"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_PROMPT_SEPARATE_LINE true
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
if test "$SPACEFISH_PROMPT_SEPARATE_LINE" = "true"
echo -e -n \n
end
end

View file

@ -0,0 +1,58 @@
#
# Node.js
#
# Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine.
# Link: https://nodejs.org/
function __sf_section_node -d "Display the local node version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_NODE_SHOW true
__sf_util_set_default SPACEFISH_NODE_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_NODE_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_NODE_SYMBOL "⬢ "
__sf_util_set_default SPACEFISH_NODE_DEFAULT_VERSION ""
__sf_util_set_default SPACEFISH_NODE_COLOR green
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show the current version of Node
[ $SPACEFISH_NODE_SHOW = false ]; and return
# Show versions only for Node-specific folders
if not test -f ./package.json \
-o -d ./node_modules \
-o (count *.js) -gt 0
return
end
if type -q nvm
# Only recheck the node version if the nvm bin has changed
if test "$NVM_BIN" != "$sf_last_nvm_bin" -o -z "$sf_node_version"
set -g sf_node_version (nvm current 2>/dev/null)
set -g sf_last_nvm_bin $NVM_BIN
end
else if type -q nodenv
set -g sf_node_version (nodenv version-name 2>/dev/null)
else if type -q node
set -g sf_node_version (node -v 2>/dev/null)
else
return
end
# Don't echo section if the system verison of node is being used
[ "$sf_node_version" = "system" -o "$sf_node_version" = "node" ]; and return
# Don't echo section if the node version matches the default version
[ "$sf_node_version" = "$SPACEFISH_NODE_DEFAULT_VERSION" ]; and return
__sf_lib_section \
$SPACEFISH_NODE_COLOR \
$SPACEFISH_NODE_PREFIX \
"$SPACEFISH_NODE_SYMBOL$sf_node_version" \
$SPACEFISH_NODE_SUFFIX
end

View file

@ -0,0 +1,72 @@
#
# Package
#
# Current package version.
# These package managers supported:
# * NPM
# * Cargo
function __sf_section_package -d "Display the local package version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_PACKAGE_SHOW true
__sf_util_set_default SPACEFISH_PACKAGE_PREFIX "is "
__sf_util_set_default SPACEFISH_PACKAGE_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_PACKAGE_SYMBOL "📦 "
__sf_util_set_default SPACEFISH_PACKAGE_COLOR red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_PACKAGE_SHOW = false ]; and return
# Exit if there is no package.json or Cargo.toml
if not test -e ./package.json; and not test -e ./Cargo.toml
return
end
set -l package_version
# Check if package.json exists AND npm exists locally while supressing output to just exit code (-q)
if type -q npm; and test -f ./package.json
# Check if jq (json handler) exists locally. If yes, check in package.json version
if type -q jq
set package_version (jq -r '.version' package.json 2>/dev/null)
# Check if python exists locally, use json to check version in package.json
else if type -q python
set package_version (python -c "import json; print(json.load(open('package.json'))['version'])" 2>/dev/null)
# Check if node exists locally, use it to check version of package.json
else if type -q node
set package_version (node -p "require('./package.json').version" 2>/dev/null)
end
end
# Check if Cargo.toml exists and cargo command exists
# and use cargo pkgid to figure out the package
if type -q cargo; and test -f ./Cargo.toml
# Handle missing field `version` in Cargo.toml.
# `cargo pkgid` needs Cargo.lock to exists too. If
# it doesn't, do not show package version
set -l pkgid (cargo pkgid 2>&1)
# Early return on error
echo $pkgid | grep -q "error:"; and return
# Example input: abc#1.0.0. Example output: 1.0.1
set package_version (string match -r '#(.*)' $pkgid)[2]
end
if test -z "$package_version"
set package_version
else
set package_version "v$package_version"
end
__sf_lib_section \
$SPACEFISH_PACKAGE_COLOR \
$SPACEFISH_PACKAGE_PREFIX \
"$SPACEFISH_PACKAGE_SYMBOL$package_version" \
$SPACEFISH_PACKAGE_SUFFIX
end

View file

@ -0,0 +1,40 @@
#
# PHP
#
# PHP is a server-side scripting language designed primarily for web development.
# Link: http://www.php.net/
function __sf_section_php -d "Display the current php version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_PHP_SHOW true
__sf_util_set_default SPACEFISH_PHP_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_PHP_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_PHP_SYMBOL "🐘 "
__sf_util_set_default SPACEFISH_PHP_COLOR blue
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of PHP
[ $SPACEFISH_PHP_SHOW = false ]; and return
# Ensure the php command is available
type -q php; or return
if not test -f composer.json \
-o (count *.php) -gt 0
return
end
set -l php_version (php -v | string match -r 'PHP\s*[0-9.]+' | string split ' ')[2]
__sf_lib_section \
$SPACEFISH_PHP_COLOR \
$SPACEFISH_PHP_PREFIX \
"$SPACEFISH_PHP_SYMBOL"v"$php_version" \
$SPACEFISH_PHP_SUFFIX
end

View file

@ -0,0 +1,41 @@
# pyenv
#
function __sf_section_pyenv -d "Show current version of pyenv Python, including system."
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_PYENV_SHOW true
__sf_util_set_default SPACEFISH_PYENV_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_PYENV_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_PYENV_SYMBOL "🐍 "
__sf_util_set_default SPACEFISH_PYENV_COLOR yellow
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show pyenv python version
[ $SPACEFISH_PYENV_SHOW = false ]; and return
# Ensure the pyenv command is available
type -q pyenv; or return
# Show pyenv python version only for Python-specific folders
if not test -n "$PYENV_VERSION" \
-o -f .python-version \
-o -f requirements.txt \
-o -f pyproject.toml \
-o (count *.py) -gt 0
return
end
set -l pyenv_status (pyenv version-name 2>/dev/null) # This line needs explicit testing in an enviroment that has pyenv.
__sf_lib_section \
$SPACEFISH_PYENV_COLOR \
$SPACEFISH_PYENV_PREFIX \
"$SPACEFISH_PYENV_SYMBOL""$pyenv_status" \
$SPACEFISH_PYENV_SUFFIX
end

View file

@ -0,0 +1,58 @@
#
# Ruby
#
# A dynamic, reflective, object-oriented, general-purpose programming language.
# Link: https://www.ruby-lang.org/
function __sf_section_ruby -d "Show current version of Ruby"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_RUBY_SHOW true
__sf_util_set_default SPACEFISH_RUBY_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_RUBY_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_RUBY_SYMBOL "💎 "
__sf_util_set_default SPACEFISH_RUBY_COLOR red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Check if that user wants to show ruby version
[ $SPACEFISH_RUBY_SHOW = false ]; and return
# Show versions only for Ruby-specific folders
if not test -f Gemfile \
-o -f Rakefile \
-o (count *.rb) -gt 0
return
end
set -l ruby_version
if type -q rvm-prompt
set ruby_version (rvm-prompt i v g)
else if type -q rbenv
set ruby_version (rbenv version-name)
else if type -q chruby
set ruby_version $RUBY_AUTO_VERSION
else if type -q asdf
set ruby_version (asdf current ruby | awk '{print $1}')
else
return
end
[ -z "$ruby_version" -o "$ruby_version" = "system" ]; and return
# Add 'v' before ruby version that starts with a number
if test -n (echo (string match -r "^[0-9].+\$" "$ruby_version"))
set ruby_version "v$ruby_version"
end
__sf_lib_section \
$SPACEFISH_RUBY_COLOR \
$SPACEFISH_RUBY_PREFIX \
"$SPACEFISH_RUBY_SYMBOL""$ruby_version" \
$SPACEFISH_RUBY_SUFFIX
end

View file

@ -0,0 +1,45 @@
#
# Rust
#
# Rust is a systems programming language sponsored by Mozilla Research.
# Link: https://www.rust-lang.org
function __sf_section_rust -d "Display the current Rust version"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_RUST_SHOW true
__sf_util_set_default SPACEFISH_RUST_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_RUST_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_RUST_SYMBOL "𝗥 "
__sf_util_set_default SPACEFISH_RUST_COLOR red
__sf_util_set_default SPACEFISH_RUST_VERBOSE_VERSION false
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show current version of Rust
[ $SPACEFISH_RUST_SHOW = false ]; and return
# Ensure the rustc command is available
type -q rustc; or return
if not test -f Cargo.toml \
-o (count *.rs) -gt 0
return
end
set -l rust_version (rustc --version | string split ' ')[2]
if test $SPACEFISH_RUST_VERBOSE_VERSION = false
set rust_version (string split '-' $rust_version)[1] # Cut off -suffixes from version. "v1.30.0-beta" vs "v1.30.0"
end
__sf_lib_section \
$SPACEFISH_RUST_COLOR \
$SPACEFISH_RUST_PREFIX \
"$SPACEFISH_RUST_SYMBOL"v"$rust_version" \
$SPACEFISH_RUST_SUFFIX
end

View file

@ -0,0 +1,43 @@
#
# Time
#
function __sf_section_time -d "Display the current time!"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_TIME_SHOW false
__sf_util_set_default SPACEFISH_DATE_SHOW false
__sf_util_set_default SPACEFISH_TIME_PREFIX "at "
__sf_util_set_default SPACEFISH_TIME_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_TIME_FORMAT false
__sf_util_set_default SPACEFISH_TIME_12HR false
__sf_util_set_default SPACEFISH_TIME_COLOR "yellow"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_TIME_SHOW = false ]; and return
set -l time_str
if test $SPACEFISH_DATE_SHOW = true
set time_str (date '+%Y-%m-%d')" "
end
if not test $SPACEFISH_TIME_FORMAT = false
set time_str "$time_str"(date '+'$SPACEFISH_TIME_FORMAT)
else if test $SPACEFISH_TIME_12HR = true
set time_str "$time_str"(date '+%I:%M:%S') # Fish doesn't seem to have date/time formatting.
else
set time_str "$time_str"(date '+%H:%M:%S')
end
__sf_lib_section \
$SPACEFISH_TIME_COLOR \
$SPACEFISH_TIME_PREFIX \
$time_str \
$SPACEFISH_TIME_SUFFIX
end

View file

@ -0,0 +1,49 @@
#
# Username
#
function __sf_section_user -d "Display the username"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
# --------------------------------------------------------------------------
# | SPACEFISH_USER_SHOW | show username on local | show username on remote |
# |---------------------+------------------------+-------------------------|
# | false | never | never |
# | always | always | always |
# | true | if needed | always |
# | needed | if needed | if needed |
# --------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_USER_SHOW true
__sf_util_set_default SPACEFISH_USER_PREFIX "with "
__sf_util_set_default SPACEFISH_USER_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_USER_COLOR yellow
__sf_util_set_default SPACEFISH_USER_COLOR_ROOT red
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_USER_SHOW = false ]; and return
if test "$SPACEFISH_USER_SHOW" = "always" \
-o "$LOGNAME" != "$USER" \
-o "$UID" = "0" \
-o \( "$SPACEFISH_USER_SHOW" = "true" -a -n "$SSH_CONNECTION" \)
set -l user_color
if test "$USER" = "root"
set user_color $SPACEFISH_USER_COLOR_ROOT
else
set user_color $SPACEFISH_USER_COLOR
end
__sf_lib_section \
$user_color \
$SPACEFISH_USER_PREFIX \
$USER \
$SPACEFISH_USER_SUFFIX
end
end

View file

@ -0,0 +1,36 @@
# virtualenv
#
function __sf_section_venv -d "Show current virtual Python environment"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_VENV_SHOW true
__sf_util_set_default SPACEFISH_VENV_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_VENV_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_VENV_SYMBOL "·"
__sf_util_set_default SPACEFISH_VENV_GENERIC_NAMES virtualenv venv .venv
__sf_util_set_default SPACEFISH_VENV_COLOR blue
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# Show venv python version
test $SPACEFISH_VENV_SHOW = false; and return
# Check if the current directory running via Virtualenv
test -n "$VIRTUAL_ENV"; or return
set -l venv (basename $VIRTUAL_ENV)
if contains $venv $SPACEFISH_VENV_GENERIC_NAMES
set venv (basename (dirname $VIRTUAL_ENV))
end
__sf_lib_section \
$SPACEFISH_VENV_COLOR \
$SPACEFISH_VENV_PREFIX \
"$SPACEFISH_VENV_SYMBOL""$venv" \
$SPACEFISH_VENV_SUFFIX
end

View file

@ -0,0 +1,51 @@
#
# Vi Mode
#
function __sf_section_vi_mode -d "Display vi mode status"
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_VI_MODE_SHOW true
__sf_util_set_default SPACEFISH_VI_MODE_PREFIX " "
__sf_util_set_default SPACEFISH_VI_MODE_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_VI_MODE_INSERT [I]
__sf_util_set_default SPACEFISH_VI_MODE_NORMAL [N]
__sf_util_set_default SPACEFISH_VI_MODE_VISUAL [V]
__sf_util_set_default SPACEFISH_VI_MODE_REPLACE_ONE [R]
__sf_util_set_default SPACEFISH_VI_MODE_COLOR white
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
[ $SPACEFISH_VI_MODE_SHOW = false ]; and return
# Ensure fish_vi_key_bindings or fish_hybrid_key_bindings are used
# Here we are trying to be compatible with default fish_mode_prompt implementation,
# wich handle both "fish_vi_key_bindings" and "fish_hybrid_key_bindings"
[ "$fish_key_bindings" = "fish_vi_key_bindings" ]; or [ "$fish_key_bindings" = "fish_hybrid_key_bindings" ]; or return
# Use `set -l` to define local variables to avoid populating
# the global namespace
set -l vi_mode_symbol
# Check current mode and set vi_mode_symbol based on it
switch $fish_bind_mode
case default
set vi_mode_symbol $SPACEFISH_VI_MODE_NORMAL
case insert
set vi_mode_symbol $SPACEFISH_VI_MODE_INSERT
case replace_one
set vi_mode_symbol $SPACEFISH_VI_MODE_REPLACE_ONE
case visual
set vi_mode_symbol $SPACEFISH_VI_MODE_VISUAL
end
__sf_lib_section \
$SPACEFISH_VI_MODE_COLOR \
$SPACEFISH_VI_MODE_PREFIX \
$vi_mode_symbol \
$SPACEFISH_VI_MODE_SUFFIX
end

View file

@ -0,0 +1,7 @@
#
# Git branch
#
function __sf_util_git_branch -d "Display the current branch name"
echo (command git rev-parse --abbrev-ref HEAD 2>/dev/null)
end

View file

@ -0,0 +1,23 @@
#
# Human time
#
function __sf_util_human_time -d "Humanize a time interval for display"
command awk '
function hmTime(time, stamp) {
split("h:m:s:ms", units, ":")
for (i = 2; i >= -1; i--) {
if (t = int( i < 0 ? time % 1000 : time / (60 ^ i * 1000) % 60 )) {
stamp = stamp t units[sqrt((i - 2) ^ 2) + 1] " "
}
}
if (stamp ~ /^ *$/) {
return "0ms"
}
return substr(stamp, 1, length(stamp) - 1)
}
{
print hmTime($0)
}
'
end

View file

@ -0,0 +1,10 @@
#
# Set default
#
function __sf_util_set_default -a var -d "Set the default value for a global variable"
if not set -q $var
# Multiple arguments will become a list
set -g $var $argv[2..-1]
end
end

View file

@ -0,0 +1,17 @@
#
# Truncate directory
#
function __sf_util_truncate_dir -a path truncate_to -d "Truncate a directory path"
if test "$truncate_to" -eq 0
echo $path
else
set -l folders (string split / $path)
if test (count $folders) -le "$truncate_to"
echo $path
else
echo (string join / $folders[(math 0 - $truncate_to)..-1])
end
end
end

View file

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

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

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

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

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

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

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

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

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

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

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

@ -0,0 +1,34 @@
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_dir_opts $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="Search Directory $unescaped_exp_token> " --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="Search Directory> " --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
commandline --function repaint
end

View file

@ -0,0 +1,30 @@
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 selected_log_lines (
git log --no-show-signature --color=always --format=format:$fzf_git_log_format --date=short | \
_fzf_wrapper --ansi \
--multi \
--tiebreak=index \
--prompt="Search Git Log> " \
--preview='git show --color=always --stat --patch {1}' \
--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

@ -0,0 +1,36 @@
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 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="Search Git Status> " \
--query=(commandline --current-token) \
--preview='_fzf_preview_changed_file {}' \
--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

@ -0,0 +1,35 @@
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 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 \
--tiebreak=index \
--prompt="Search History> " \
--query=(commandline) \
--preview="echo -- {} | string replace --regex '^.*? │ ' '' | fish_indent --ansi" \
--preview-window="bottom:3:wrap" \
$fzf_history_opts |
string split0 |
# remove timestamps from commands selected
string replace --regex '^.*? │ ' ''
)
if test $status -eq 0
commandline --replace -- $commands_selected
end
commandline --function repaint
end

View file

@ -0,0 +1,32 @@
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="Search 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

@ -0,0 +1,48 @@
# 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="Search Variables> " \
--preview-window="wrap" \
--multi \
--query=$cleaned_curr_token \
# $fzf_shell_vars_opts is the deprecated version of $fzf_variables_opts
$fzf_shell_vars_opts $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

@ -0,0 +1,20 @@
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 FZF_DEFAULT_OPTS is not set, then set some sane defaults.
# See https://github.com/junegunn/fzf#environment-variables
if not set --query FZF_DEFAULT_OPTS
# 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

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

View file

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

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

View file

@ -0,0 +1,4 @@
function fish_mode_prompt
# Overriden by Spacefish fishshell theme
# To see vi mode in prompt add 'vi_mode' to SPACEFISH_PROMPT_ORDER
end

View file

@ -0,0 +1,33 @@
function fish_prompt
# Store the exit code of the last command
set -g sf_exit_code $status
set -g SPACEFISH_VERSION 2.7.0
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_PROMPT_ADD_NEWLINE true
__sf_util_set_default SPACEFISH_PROMPT_FIRST_PREFIX_SHOW false
__sf_util_set_default SPACEFISH_PROMPT_PREFIXES_SHOW true
__sf_util_set_default SPACEFISH_PROMPT_SUFFIXES_SHOW true
__sf_util_set_default SPACEFISH_PROMPT_DEFAULT_PREFIX "via "
__sf_util_set_default SPACEFISH_PROMPT_DEFAULT_SUFFIX " "
__sf_util_set_default SPACEFISH_PROMPT_ORDER time user dir host git package node ruby golang php rust haskell julia elixir docker aws venv conda pyenv dotnet kubecontext exec_time line_sep battery vi_mode jobs exit_code char
# ------------------------------------------------------------------------------
# Sections
# ------------------------------------------------------------------------------
# Keep track of whether the prompt has already been opened
set -g sf_prompt_opened $SPACEFISH_PROMPT_FIRST_PREFIX_SHOW
if test "$SPACEFISH_PROMPT_ADD_NEWLINE" = "true"
echo
end
for i in $SPACEFISH_PROMPT_ORDER
eval __sf_section_$i
end
set_color normal
end

View file

@ -0,0 +1,30 @@
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
set -l normal (set_color normal)
set -l status_color (set_color brgreen)
set -l cwd_color (set_color $fish_color_cwd)
set -l vcs_color (set_color brpurple)
set -l prompt_status ""
# Since we display the prompt on a new line allow the directory names to be longer.
set -q fish_prompt_pwd_dir_length
or set -lx fish_prompt_pwd_dir_length 0
# Color the prompt differently when we're root
set -l suffix ''
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set cwd_color (set_color $fish_color_cwd_root)
end
set suffix '#'
end
# Color the prompt in red on error
if test $last_status -ne 0
set status_color (set_color $fish_color_error)
set prompt_status $status_color "[" $last_status "]" $normal
end
echo -s (prompt_login) ' ' $cwd_color (prompt_pwd) $vcs_color (fish_vcs_prompt) $normal ' ' $prompt_status
echo -n -s $status_color $suffix ' ' $normal
end

View file

@ -0,0 +1,19 @@
function fish_right_prompt
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
__sf_util_set_default SPACEFISH_RPROMPT_ORDER ""
# ------------------------------------------------------------------------------
# Sections
# ------------------------------------------------------------------------------
[ -n "$SPACEFISH_RPROMPT_ORDER" ]; or return
for i in $SPACEFISH_RPROMPT_ORDER
eval __sf_section_$i
end
set_color normal
end

View file

@ -0,0 +1,46 @@
# 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=?'
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 # \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"
# 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"
end
function _fzf_uninstall_bindings --inherit-variable key_sequences
bind --erase -- $key_sequences
bind --erase --mode insert -- $key_sequences
end
end
end

View file

@ -0,0 +1,54 @@
function sudope -d "Quickly toggle sudo prefix"
# Save the current command line and cursor position.
set -l command_buffer (commandline)
set -l cursor_position (commandline -C)
# If the command line is empty, pull the last command from history.
if test -z "$command_buffer"
set command_buffer $history[1]
end
# Parse the command line (first line only).
set -l command_parts (string match -ir '^(\s*)(sudo(\s+|$))?(.*)' $command_buffer[1])
# Handle multiline commands with extra care.
set -l command_lines_count (count $command_buffer)
test $command_lines_count -gt 1
and set -l command_rest $command_buffer[2..$command_lines_count]
switch (count $command_parts)
case 3
# No "sudo".
# Add "sudo" to the beginning of the command, after any leading whitespace (if present).
commandline -r (string join \n (string join '' $command_parts[2] 'sudo ' $command_parts[3]) $command_rest)
# Push the cursor position ahead if necessary (+5 for 'sudo ').
test $cursor_position -ge (string length -- "$command_parts[2]")
and set cursor_position (math $cursor_position+5)
# Place the cursor where it was (or where it should be).
commandline -C $cursor_position
case 5
# "sudo" is present in the beginning of the command.
# Remove "sudo", leave any leading whitespace (if present).
commandline -r (string join \n (string join '' $command_parts[2 5]) $command_rest)
# Push the cursor position back if appropriate ('sudo' and whitespace).
set -l lead_length (string length -- "$command_parts[2]")
set -l sudo_length (string length -- "$command_parts[3]")
if test $cursor_position -ge (math $lead_length+$sudo_length)
# The cursor was after "sudo".
set cursor_position (math $cursor_position-$sudo_length)
else if test $cursor_position -ge $lead_length
# The cursor was somewhere on "sudo".
set cursor_position $lead_length
end
# Place the cursor where it was (or where it should be).
commandline -C -- $cursor_position
end
end

View file

@ -0,0 +1,290 @@
# Display general usage
function __to_usage
echo 'Usage:'
echo ' to (BOOKMARK|DIR) Go to BOOKMARK or DIR'
echo ' to add [BOOKMARK] [DEST] Create a BOOKMARK for DEST'
echo ' Default BOOKMARK: name of current directory'
echo ' Default DEST: path to current directory'
echo ' to add DEST Create a bookmark for DEST if it is a directory'
echo ' to ls List all bookmarks'
echo ' to mv OLD NEW Change the name of a bookmark from OLD to NEW'
echo ' to rm BOOKMARK Remove BOOKMARK'
echo ' to clean Remove bookmarks that have a missing destination'
echo ' to resolve BOOKMARK Print the destination of a bookmark'
echo ' to help Show this message'
echo
echo "Bookmarks are stored in: $TO_DIR"
echo 'To change, run: set -U TO_DIR <dir>'
return 1
end
# https://github.com/fish-shell/fish-shell/issues/6173#issuecomment-1067114363
function is_empty_dir
test -d "$argv"
or return 1 # not a directory, so not an empty directory
# count counts how many arguments it received
# if this glob doesn't match, it won't get arguments
# and so it will return 1
# because we *want* an empty directory, turn that around.
# the `{.*,*}` ensures it matches hidden files as well.
not count $argv/{.*,*} >/dev/null
end
function __to_dir
if test -n "$TO_DIR"
echo $TO_DIR
return
end
set -l dir
if test -d "$HOME/.tofish" && not is_empty_dir $HOME/.tofish
set dir $HOME/.tofish
else if test -n "$XDG_DATA_HOME"
set dir $XDG_DATA_HOME/to-fish
else
set dir $HOME/.local/share/to-fish
end
set -U TO_DIR $dir
echo $TO_DIR
end
function __to_bm_path
echo (__to_dir)/$argv
end
function __to_resolve
readlink (__to_bm_path $argv) 2>/dev/null
end
function __to_print
__to_resolve $argv | string replace -r "^$HOME" "~" | string replace -r '^~$' $HOME
end
function __to_ls
for l in (__to_dir)/*
basename $l
end
end
function __to_rm
command rm -v (__to_bm_path $argv[1]); or return $status
__to_update_bookmark_completions
end
function __to_add -a bm dest
# if there are no arguments
if test -z "$bm"
# use the current directory
set dest (pwd)
set bm (basename $dest)
else
# if there are two arguments
if test -n "$dest"
# use them as bookmark name and destination
set dest (realpath $dest)
# if there is only one argument
else
# if the argument is a directory
if string match -q '*/*' $bm && test -d "$bm"
# use it as the destination
set dest (realpath $bm)
set bm (basename $dest)
else
# if not a directory
# use it as the bookmark name
set dest (pwd)
end
end
end
if __to_resolve $bm > /dev/null
echo "ERROR: Bookmark exists: $bm -> "(__to_print $bm) >&2
return 1
end
if not test -d "$dest"
echo "ERROR: Destination does not exist: $dest" >&2
return 1
end
if string match -q '*/*' $bm
echo "ERROR: Bookmark name cannot contain '/': $bm" >&2
return 1
end
switch (uname)
case Darwin
command ln -s $dest (__to_bm_path $bm); or return $status
case '*'
command ln -sT $dest (__to_bm_path $bm); or return $status
end
echo $bm "->" (__to_print $bm)
__to_update_bookmark_completions
end
function __to_complete_directories
set -l cl (commandline -ct | string split -m 1 /)
set -l bm $cl[1]
set -l bmdir (__to_resolve $bm)
if test -z "$bmdir"
__fish_complete_directories
else
set -e cl[1]
if test -z "$cl"
__fish_complete_directories $bmdir/ | string replace -r 'Directory$' $bm
else
__fish_complete_directories $bmdir/$cl | string replace -r 'Directory$' $bm
end
end
end
function __to_update_bookmark_completions
complete -e -c to
complete -c to -k -x -s h -l help -d 'Show help'
# Subcommands
complete -c to -k -n '__fish_use_subcommand' -f -a 'help' -d 'Show help'
complete -c to -k -n '__fish_use_subcommand' -x -a 'resolve' -d 'Print bookmark destination'
complete -c to -k -n '__fish_use_subcommand' -x -a 'clean' -d 'Remove bad bookmarks'
complete -c to -k -n '__fish_use_subcommand' -x -a 'mv' -d 'Rename bookmark'
complete -c to -k -n '__fish_use_subcommand' -x -a 'rm' -d 'Remove bookmark'
complete -c to -k -n '__fish_use_subcommand' -f -a 'ls' -d 'List bookmarks'
complete -c to -k -n '__fish_use_subcommand' -x -a 'add' -d 'Create bookmark'
# Directories
complete -c to -k -n '__fish_use_subcommand' -r -a '(__to_complete_directories)'
# Bookmarks
for bm in (__to_ls | sort -r)
complete -c to -k -n '__fish_use_subcommand; or __fish_seen_subcommand_from rm mv resolve' -r -a (echo $bm | string escape) -d (__to_print $bm)
end
end
function to -d 'Bookmarking tool'
set -l dir (__to_dir)
# Create tofish directory
if not test -d "$dir"
if command mkdir $dir
echo "Created bookmark directory: $dir"
else
echo "Failed to Create bookmark directory: $dir"
return 1
end
end
# Catch usage errors
set -l cmd $argv[1]
set -l numargs (count $argv)
switch $cmd
# subcommands that don't take an argument
case ls help clean
if not test $numargs -eq 1
echo "Usage: to $cmd"
return 1
end
# subcommands that require an argument
case rm resolve
if not test $numargs -eq 2
echo "Usage: to $cmd BOOKMARK"
return 1
end
# add has 2 optional arguments
case add
if not test $numargs -ge 1 -a $numargs -le 3
echo 'Usage: to add [BOOKMARK] [DEST]'
echo ' to add DEST'
return 1
end
# subcommands that require 2 arguments
case mv
if not test $numargs -eq 3
echo 'Usage: to mv OLD NEW'
return 1
end
end
switch $cmd
# Add a bookmark
case add
__to_add $argv[2..-1]
return $status
# Remove a bookmark
case rm
__to_rm $argv[2]
return $status
# List all bookmarks
case ls
for bm in (__to_ls)
echo "$bm -> "(__to_print $bm)
end
return 0
# Rename a bookmark
case mv
set -l old $argv[2]
if not __to_resolve $old > /dev/null
echo "ERROR: Bookmark not found: $old"
return 1
end
set -l new $argv[3]
__to_add $new (__to_resolve $old); or return $status
__to_rm $old; or return $status
return 0
# Clean
case clean
for bm in (__to_ls)
if not test -d (__to_resolve $bm)
__to_rm $bm
end
end
return 0
# Resolve
case resolve
__to_resolve $argv[2]
return $status
# Help
case -h --help help
__to_usage
return 0
# Default
case '*'
set -l name $argv[1]
if test -z "$name"
__to_usage
return 1
end
set -l dest (__to_resolve $name)
if test -z "$dest"
if test -d "$name"
echo "cd \"$name\"" | source -
else
echo "to: No such bookmark “$name" >&2
return 1
end
else if test -d "$dest"
echo "cd \"$dest\"" | source -
else
echo "to: Destination for bookmark “$name” does not exist: $dest" >&2
return 1
end
end
end

View file

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

@ -34,7 +34,7 @@ workspace=HDMI-A-1,30
general {
border_size=2
col.inactive_border=rgba(c6d0f599)
col.active_border = rgba(c6d0f5ee) rgba(b7bdf888) rgba(b7bdf888) rgba(c6d0f5ee) 45deg
col.active_border = rgba(c6d0f5ee) rgba(b7bdf880) rgba(b7bdf880) rgba(c6d0f5ee) 45deg
gaps_in=10
gaps_out=20
@ -56,7 +56,7 @@ decoration {
drop_shadow=true
shadow_range=15
col.shadow=rgba(b7bdf888)
col.shadow=rgba(b7bdf56f)
col.shadow_inactive=rgba(000000ff)
dim_inactive = false

View file

@ -844,7 +844,7 @@ tab_bar_margin_height 0.0 0.0
#: The second number is the margin between the tab bar and the
#: contents of the current tab.
tab_bar_style fade
tab_bar_style powerline
#: The tab bar style, can be one of:
@ -902,7 +902,7 @@ tab_separator " ┇"
#: The separator between tabs in the tab bar when using separator as
#: the tab_bar_style.
tab_powerline_style angled
tab_powerline_style slanted
#: The powerline separator style between tabs in the tab bar when
#: using powerline as the tab_bar_style, can be one of: angled,
@ -915,7 +915,7 @@ tab_activity_symbol none
#: leading or trailing spaces, surround the text with quotes. See
#: tab_title_template for how this is rendered.
tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{title}"
tab_title_template {title}{' :{}:'.format(num_windows) if num_windows > 1 else ''}
#: A template to render the tab title. The default just renders the
#: title with optional symbols for bell and activity. If you wish to
@ -1096,7 +1096,7 @@ shell fish
#: --login and --interactive to ensure that the shell starts in
#: interactive mode and reads its startup rc files.
editor vscodium
editor codium
#: The terminal based text editor (such as vim or nano) to use when
#: editing the kitty config file or similar tasks.
@ -2139,83 +2139,4 @@ map shift+cmd+/ open_url https://sw.kovidgoyal.net/kitty/
#: }}}
#: }}}
tab_bar_min_tabs 2
tab_bar_edge bottom
tab_bar_style powerline
tab_powerline_style slanted
tab_title_template {title}{' :{}:'.format(num_windows) if num_windows > 1 else ''}
# The basic colors
foreground #CAD3F5
background #24273A
selection_foreground #24273A
selection_background #F4DBD6
# Cursor colors
cursor #F4DBD6
cursor_text_color #24273A
# URL underline color when hovering with mouse
url_color #F4DBD6
# Kitty window border colors
active_border_color #B7BDF8
inactive_border_color #6E738D
bell_border_color #EED49F
# OS Window titlebar colors
wayland_titlebar_color system
macos_titlebar_color system
# Tab bar colors
active_tab_foreground #181926
active_tab_background #C6A0F6
inactive_tab_foreground #CAD3F5
inactive_tab_background #1E2030
tab_bar_background #181926
# Colors for marks (marked text in the terminal)
mark1_foreground #24273A
mark1_background #B7BDF8
mark2_foreground #24273A
mark2_background #C6A0F6
mark3_foreground #24273A
mark3_background #7DC4E4
# The 16 terminal colors
# black
color0 #494D64
color8 #5B6078
# red
color1 #ED8796
color9 #ED8796
# green
color2 #A6DA95
color10 #A6DA95
# yellow
color3 #EED49F
color11 #EED49F
# blue
color4 #8AADF4
color12 #8AADF4
# magenta
color5 #F5BDE6
color13 #F5BDE6
# cyan
color6 #8BD5CA
color14 #8BD5CA
# white
color7 #B8C0E0
color15 #A5ADCB
#: }}}

232
.config/lazygit/config.yml Normal file
View file

@ -0,0 +1,232 @@
gui:
# stuff relating to the UI
windowSize: "normal" # one of 'normal' | 'half' | 'full' default is 'normal'
scrollHeight: 2 # how many lines you scroll by
scrollPastBottom: true # enable scrolling past the bottom
sidePanelWidth: 0.3333 # number from 0 to 1
expandFocusedSidePanel: false
mainPanelSplitMode: "flexible" # one of 'horizontal' | 'flexible' | 'vertical'
language: "auto" # one of 'auto' | 'en' | 'zh' | 'pl' | 'nl' | 'ja' | 'ko' | 'ru'
timeFormat: "02 Jan 06" # https://pkg.go.dev/time#Time.Format
shortTimeFormat: "3:04PM"
theme:
activeBorderColor:
- green
- bold
inactiveBorderColor:
- white
searchingActiveBorderColor:
- cyan
- bold
optionsTextColor:
- blue
selectedLineBgColor:
- blue # set to `default` to have no background colour
selectedRangeBgColor:
- blue
cherryPickedCommitBgColor:
- cyan
cherryPickedCommitFgColor:
- blue
unstagedChangesColor:
- red
defaultFgColor:
- default
commitLength:
show: true
mouseEvents: true
skipDiscardChangeWarning: false
skipStashWarning: false
showFileTree: true # for rendering changes files in a tree format
showListFooter: true # for seeing the '5 of 20' message in list panels
showRandomTip: true
showBranchCommitHash: false # show commit hashes alongside branch names
experimentalShowBranchHeads: false # visualize branch heads with (*) in commits list
showBottomLine: true # for hiding the bottom information line (unless it has important information to tell you)
showCommandLog: true
showIcons: false # deprecated: use nerdFontsVersion instead
nerdFontsVersion: "" # nerd fonts version to use ("2" or "3"); empty means don't show nerd font icons
commandLogSize: 8
splitDiff: "auto" # one of 'auto' | 'always'
skipRewordInEditorWarning: false # for skipping the confirmation before launching the reword editor
border: "single" # one of 'single' | 'double' | 'rounded' | 'hidden'
git:
paging:
colorArg: always
useConfig: false
commit:
signOff: false
merging:
# only applicable to unix users
manualCommit: false
# extra args passed to `git merge`, e.g. --no-ff
args: ""
log:
# one of date-order, author-date-order, topo-order or default.
# topo-order makes it easier to read the git log graph, but commits may not
# appear chronologically. See https://git-scm.com/docs/git-log#_commit_ordering
order: "topo-order"
# one of always, never, when-maximised
# this determines whether the git graph is rendered in the commits panel
showGraph: "when-maximised"
# displays the whole git graph by default in the commits panel (equivalent to passing the `--all` argument to `git log`)
showWholeGraph: false
skipHookPrefix: WIP
# The main branches. We colour commits green if they belong to one of these branches,
# so that you can easily see which commits are unique to your branch (coloured in yellow)
mainBranches: [master, main]
autoFetch: true
autoRefresh: true
fetchAll: true # Pass --all flag when running git fetch. Set to false to fetch only origin (or the current branch's upstream remote if there is one)
branchLogCmd: "git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --"
allBranchesLogCmd: "git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium"
overrideGpg: false # prevents lazygit from spawning a separate process when using GPG
disableForcePushing: false
parseEmoji: false
diffContextSize: 3 # how many lines of context are shown around a change in diffs
os:
editPreset: "neovim" # see 'Configuring File Editing' section
edit: "neovim {{filename}}"
editAtLine: "neovim --line={{line}} {{filename}}"
editAtLineAndWait: "neovim --block --line={{line}} {{filename}}"
refresher:
refreshInterval: 10 # File/submodule refresh interval in seconds. Auto-refresh can be disabled via option 'git.autoRefresh'.
fetchInterval: 60 # Re-fetch interval in seconds. Auto-fetch can be disabled via option 'git.autoFetch'.
update:
method: prompt # can be: prompt | background | never
days: 14 # how often an update is checked for
confirmOnQuit: false
# determines whether hitting 'esc' will quit the application when there is nothing to cancel/close
quitOnTopLevelReturn: false
disableStartupPopups: false
notARepository: "prompt" # one of: 'prompt' | 'create' | 'skip' | 'quit'
promptToReturnFromSubprocess: true # display confirmation when subprocess terminates
keybinding:
universal:
quit: "q"
quit-alt1: "<c-c>" # alternative/alias of quit
return: "<esc>" # return to previous menu, will quit if there's nowhere to return
quitWithoutChangingDirectory: "Q"
togglePanel: "<tab>" # goto the next panel
prevItem: "<up>" # go one line up
nextItem: "<down>" # go one line down
prevItem-alt: "k" # go one line up
nextItem-alt: "j" # go one line down
prevPage: "," # go to next page in list
nextPage: "." # go to previous page in list
gotoTop: "<" # go to top of list
gotoBottom: ">" # go to bottom of list
scrollLeft: "H" # scroll left within list view
scrollRight: "L" # scroll right within list view
prevBlock: "<left>" # goto the previous block / panel
nextBlock: "<right>" # goto the next block / panel
prevBlock-alt: "h" # goto the previous block / panel
nextBlock-alt: "l" # goto the next block / panel
jumpToBlock: ["1", "2", "3", "4", "5"] # goto the Nth block / panel
nextMatch: "n"
prevMatch: "N"
optionMenu: null # show help menu
optionMenu-alt1: "?" # show help menu
select: "<space>"
goInto: "<enter>"
openRecentRepos: "<c-r>"
confirm: "<enter>"
remove: "d"
new: "n"
edit: "e"
openFile: "o"
scrollUpMain: "<pgup>" # main panel scroll up
scrollDownMain: "<pgdown>" # main panel scroll down
scrollUpMain-alt1: "K" # main panel scroll up
scrollDownMain-alt1: "J" # main panel scroll down
scrollUpMain-alt2: "<c-u>" # main panel scroll up
scrollDownMain-alt2: "<c-d>" # main panel scroll down
executeCustomCommand: ":"
createRebaseOptionsMenu: "m"
pushFiles: "P"
pullFiles: "p"
refresh: "R"
createPatchOptionsMenu: "<c-p>"
nextTab: "]"
prevTab: "["
nextScreenMode: "+"
prevScreenMode: "_"
undo: "z"
redo: "<c-z>"
filteringMenu: "<c-s>"
diffingMenu: "W"
diffingMenu-alt: "<c-e>" # deprecated
copyToClipboard: "<c-o>"
submitEditorText: "<enter>"
extrasMenu: "@"
toggleWhitespaceInDiffView: "<c-w>"
increaseContextInDiffView: "}"
decreaseContextInDiffView: "{"
status:
checkForUpdate: "u"
recentRepos: "<enter>"
files:
commitChanges: "c"
commitChangesWithoutHook: "w" # commit changes without pre-commit hook
amendLastCommit: "A"
commitChangesWithEditor: "C"
ignoreFile: "i"
refreshFiles: "r"
stashAllChanges: "s"
viewStashOptions: "S"
toggleStagedAll: "a" # stage/unstage all
viewResetOptions: "D"
fetch: "f"
toggleTreeView: "`"
openMergeTool: "M"
openStatusFilter: "<c-b>"
branches:
createPullRequest: "o"
viewPullRequestOptions: "O"
checkoutBranchByName: "c"
forceCheckoutBranch: "F"
rebaseBranch: "r"
renameBranch: "R"
mergeIntoCurrentBranch: "M"
viewGitFlowOptions: "i"
fastForward: "f" # fast-forward this branch from its upstream
createTag: "T"
pushTag: "P"
setUpstream: "u" # set as upstream of checked-out branch
fetchRemote: "f"
commits:
squashDown: "s"
renameCommit: "r"
renameCommitWithEditor: "R"
viewResetOptions: "g"
markCommitAsFixup: "f"
createFixupCommit: "F" # create fixup commit for this commit
squashAboveCommits: "S"
moveDownCommit: "<c-j>" # move commit down one
moveUpCommit: "<c-k>" # move commit up one
amendToCommit: "A"
pickCommit: "p" # pick commit (when mid-rebase)
revertCommit: "t"
cherryPickCopy: "c"
cherryPickCopyRange: "C"
pasteCommits: "v"
tagCommit: "T"
checkoutCommit: "<space>"
resetCherryPick: "<c-R>"
copyCommitMessageToClipboard: "<c-y>"
openLogMenu: "<c-l>"
viewBisectOptions: "b"
stash:
popStash: "g"
renameStash: "r"
commitFiles:
checkoutCommitFile: "c"
main:
toggleDragSelect: "v"
toggleDragSelect-alt: "V"
toggleSelectHunk: "a"
pickBothHunks: "b"
submodules:
init: "i"
update: "u"
bulkMenu: "b"

View file

@ -28,7 +28,7 @@ WarnBeforeStartingStream=false
WarnBeforeStoppingStream=false
WarnBeforeStoppingRecord=false
geometry=AdnQywADAAAAAAAAAAAAAAAACdMAAAPPAAAAAAAAAAAAAAnTAAADzwAAAAEAAAAACgAAAAAAAAAAAAAACdMAAAPP
DockState=AAAA/wAAAAD9AAAAAQAAAAMAAAnUAAABAfwBAAAABvsAAAAUAHMAYwBlAG4AZQBzAEQAbwBjAGsBAAAAAAAAAYIAAACgAP////sAAAAWAHMAbwB1AHIAYwBlAHMARABvAGMAawEAAAGGAAAB/gAAAKAA////+wAAABIAbQBpAHgAZQByAEQAbwBjAGsBAAADiAAAA60AAADeAP////sAAAAeAHQAcgBhAG4AcwBpAHQAaQBvAG4AcwBEAG8AYwBrAQAABzkAAAFWAAAAoQD////7AAAAGABjAG8AbgB0AHIAbwBsAHMARABvAGMAawEAAAiTAAABQQAAAJ4A////+wAAABIAcwB0AGEAdABzAEQAbwBjAGsCAAADogAAAbgAAAK8AAAAyAAACdQAAAKbAAAABAAAAAQAAAAIAAAACPwAAAAA
DockState=AAAA/wAAAAD9AAAAAQAAAAMAAAnUAAABAfwBAAAABvsAAAAUAHMAYwBlAG4AZQBzAEQAbwBjAGsBAAAAAAAAAYIAAACgAP////sAAAAWAHMAbwB1AHIAYwBlAHMARABvAGMAawEAAAGGAAAB/QAAAKAA////+wAAABIAbQBpAHgAZQByAEQAbwBjAGsBAAADhwAAA64AAADeAP////sAAAAeAHQAcgBhAG4AcwBpAHQAaQBvAG4AcwBEAG8AYwBrAQAABzkAAAFWAAAAoQD////7AAAAGABjAG8AbgB0AHIAbwBsAHMARABvAGMAawEAAAiTAAABQQAAAJ4A////+wAAABIAcwB0AGEAdABzAEQAbwBjAGsCAAADogAAAbgAAAK8AAAAyAAACdQAAAKbAAAABAAAAAQAAAAIAAAACPwAAAAA
PreviewEnabled=true
AlwaysOnTop=false
SceneDuplicationMode=true

View file

@ -26,7 +26,7 @@ context.properties = {
core.name = pipewire-0 # core name and socket name
## Properties for the DSP configuration.
#default.clock.rate = 48000
default.clock.rate = 48000
default.clock.allowed-rates = [ 44100 48000 ]
default.clock.quantum = 1024
default.clock.min-quantum = 16

View file

@ -10,8 +10,6 @@ if [[ "$?" == 0 ]]; then
playerctl --all-players stop
pkill wleave
sleep 0.5s
~/.config/sway/lock.sh
sleep 0.5s
systemctl suspend-then-hibernate
elif [[ "$1" == 'lock' ]]; then
pkill wleave
@ -21,8 +19,6 @@ if [[ "$?" == 0 ]]; then
playerctl --all-players stop
pkill wleave
sleep 0.5s
~/.config/sway/lock.sh
sleep 0.5s
systemctl suspend
elif [[ "$1" == 'logout' ]]; then
hyprctl dispatch exit none

View file

@ -51,6 +51,13 @@
background: transparent;
}
#star-button[starred],
#star-button {
display: none !important;
}
#bookmarks-menu-button toolbarbutton { visibility:collapse !important; }
/* multi tab selection */
#tabbrowser-tabs:not([noshadowfortests])
.tabbrowser-tab:is([multiselected])
@ -678,7 +685,7 @@ url(about:home) {
text-align: center !important;
justify-content: center;
align-items: center;
margin: 6px 6px 6px 6px !important;
margin: 6px 0px 6px 6px !important;
border: 2px solid rgba(183, 189, 248, 0.5);
background-clip: padding-box;
padding-inline: 0 !important;

1
.tofish/fish Symbolic link
View file

@ -0,0 +1 @@
/home/matt/.config/fish

1
.tofish/hypr Symbolic link
View file

@ -0,0 +1 @@
/home/matt/.config/hypr

File diff suppressed because one or more lines are too long

25
.zshrc
View file

@ -8,7 +8,7 @@ export ZSH="$HOME/.oh-my-zsh"
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="robbyrussell"
ZSH_THEME="intheloop"
# source ~/.oh-my-zsh/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh
# source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
@ -73,12 +73,20 @@ ZSH_THEME="robbyrussell"
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
plugins=(git adb aliases archlinux colorize command-not-found colored-man-pages cp docker docker-machine docker-compose dotenv
zsh-autocomplete fast-syntax-highlighting zsh-autosuggestions fzf man python ripgrep rust sudo
)
export FZF_DEFAULT_OPTS=" \
--color=bg+:#363a4f,bg:#24273a,spinner:#f4dbd6,hl:#ed8796 \
--color=fg:#cad3f5,header:#ed8796,info:#c6a0f6,pointer:#f4dbd6 \
--color=marker:#f4dbd6,fg+:#cad3f5,prompt:#c6a0f6,hl+:#ed8796"
export FZF_BASE=/usr/bin/fzf
source $ZSH/oh-my-zsh.sh
# User configuration
# /home/matt/.config/tty/macchiato.sh
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
@ -102,11 +110,12 @@ fi
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
/home/matt/.config/tty/macchiato.sh
# Some aliases
alias code='vscodium'
alias ls='exa --long --header -a'
alias ls='exa --long --header -a --icons'
alias tree='exa --long --header -a --icons --tree'
alias bruh='genact -s 4'
alias matrix='unimatrix'
alias q='exit'
@ -121,9 +130,11 @@ alias gpt='tgpt'
alias clock='tty-clock -sbc'
alias l='xplr'
alias sysproc='sysz'
alias cat='bat'
alias dots='yadm enter lazygit'
PATH=$PATH:/home/matt/.local/bin
TERMINAL=$TERMINAL:/usr/bin/kitty
export EDITOR=vscodium
export EDITOR=codium
neofetch
neofetch