diff --git a/fish/.config/fish/conf.d/setup.fish b/fish/.config/fish/conf.d/setup.fish index bc4f786..3c5b2a1 100644 --- a/fish/.config/fish/conf.d/setup.fish +++ b/fish/.config/fish/conf.d/setup.fish @@ -1,73 +1,73 @@ function __fish_setup_on_tty_login --description "Set up environment on tty login" - set -qx XDG_CONFIG_HOME; or set -Ux XDG_CONFIG_HOME $HOME/.config - set -qx XDG_CACHE_HOME; or set -Ux XDG_CACHE_HOME $HOME/.cache - set -qx XDG_DATA_HOME; or set -Ux XDG_DATA_HOME $HOME/.local/share - set -qx XDG_STATE_HOME; or set -Ux XDG_STATE_HOME $HOME/.local/state - set -qx SSH_AUTH_SOCK; or set -Ux SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket + set -qx XDG_CONFIG_HOME; or set -Ux XDG_CONFIG_HOME $HOME/.config + set -qx XDG_CACHE_HOME; or set -Ux XDG_CACHE_HOME $HOME/.cache + set -qx XDG_DATA_HOME; or set -Ux XDG_DATA_HOME $HOME/.local/share + set -qx XDG_STATE_HOME; or set -Ux XDG_STATE_HOME $HOME/.local/state + set -qx SSH_AUTH_SOCK; or set -Ux SSH_AUTH_SOCK $XDG_RUNTIME_DIR/ssh-agent.socket - # Wayland session - set -qx XDG_SESSION_TYPE; or set -Ux XDG_SESSION_TYPE wayland - set -qx XDG_SESSION_DESKTOP; or set -Ux XDG_SESSION_DESKTOP wayland - set -qx XDG_CURRENT_DESKTOP; or set -Ux XDG_CURRENT_DESKTOP wayland + # Wayland session + set -qx XDG_SESSION_TYPE; or set -Ux XDG_SESSION_TYPE wayland + set -qx XDG_SESSION_DESKTOP; or set -Ux XDG_SESSION_DESKTOP wayland + set -qx XDG_CURRENT_DESKTOP; or set -Ux XDG_CURRENT_DESKTOP wayland - # Firefox - set -qx MOZ_ENABLE_WAYLAND; or set -Ux MOZ_ENABLE_WAYLAND 1 - set -qx MOZ_DBUS_REMOTE; or set -Ux MOZ_DBUS_REMOTE 1 + # Firefox + set -qx MOZ_ENABLE_WAYLAND; or set -Ux MOZ_ENABLE_WAYLAND 1 + set -qx MOZ_DBUS_REMOTE; or set -Ux MOZ_DBUS_REMOTE 1 - # QT - set -qx QT_QPA_PLATFORM; or set -Ux QT_QPA_PLATFORM wayland - set -qx QT_QPA_PLATFORMTHEME; or set -Ux QT_QPA_PLATFORMTHEME qt5ct + # QT + set -qx QT_QPA_PLATFORM; or set -Ux QT_QPA_PLATFORM wayland + set -qx QT_QPA_PLATFORMTHEME; or set -Ux QT_QPA_PLATFORMTHEME qt5ct - for extra_path in ~/.{local,nix-profile,cargo,cabal,ghcup}/bin - if test -d "$extra_path" - set -gxp PATH "$extra_path" + for extra_path in ~/.{local,nix-profile,cargo,cabal,ghcup}/bin + if test -d "$extra_path" + set -gxp PATH "$extra_path" + end end - end - if type -qf nvim - set -gx EDITOR nvim - set -gx VISUAL nvim - set -gx MANPAGER 'nvim +Man!' - else - if type -qf vim - set -gx EDITOR vim - set -gx VISUAL vim + if type -qf nvim + set -gx EDITOR nvim + set -gx VISUAL nvim + set -gx MANPAGER 'nvim +Man!' + else + if type -qf vim + set -gx EDITOR vim + set -gx VISUAL vim + end end - end - if test -d {$HOME}/.nix-defexpr/channels - set -gx NIX_PATH {$HOME}/.nix-defexpr/channels - set -gx NIX_SSL_CERT_FILE '/etc/ssl/certs/ca-certificates.crt' - end - - if test -d /var/lib/flatpak - # https://github.com/fish-shell/fish-shell/issues/7485#issuecomment-728984689 - # https://wiki.archlinux.org/title/Flatpak#Adding_Flatpak_.desktop_files_to_your_menu - set -l xdg_data_home $XDG_DATA_HOME ~/.local/share - set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share - - for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin - if test -d $flatpakdir - contains $flatpakdir $PATH; or set -a PATH $flatpakdir - end + if test -d {$HOME}/.nix-defexpr/channels + set -gx NIX_PATH {$HOME}/.nix-defexpr/channels + set -gx NIX_SSL_CERT_FILE '/etc/ssl/certs/ca-certificates.crt' end - end - if type -qf fnm - fnm env --shell=fish --log-level=quiet | source - end + if test -d /var/lib/flatpak + # https://github.com/fish-shell/fish-shell/issues/7485#issuecomment-728984689 + # https://wiki.archlinux.org/title/Flatpak#Adding_Flatpak_.desktop_files_to_your_menu + set -l xdg_data_home $XDG_DATA_HOME ~/.local/share + set -gx --path XDG_DATA_DIRS $xdg_data_home[1]/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share - set -gx CLICOLOR 1 - set -gx LSCOLORS 'gxfxcxdxbxegedabaggxgx' + for flatpakdir in ~/.local/share/flatpak/exports/bin /var/lib/flatpak/exports/bin + if test -d $flatpakdir + contains $flatpakdir $PATH; or set -a PATH $flatpakdir + end + end + end - set -Ux GST_DEBUG_NO_COLOR 1 - set -Ux GST_DEBUG_COLOR_MODE "off" + if type -qf fnm + fnm env --shell=fish --log-level=quiet | source + end - mkdir -p /tmp/gst-dot - set -Ux GST_DEBUG_DUMP_DOT_DIR /tmp/gst-dot + set -gx CLICOLOR 1 + set -gx LSCOLORS gxfxcxdxbxegedabaggxgx + + set -Ux GST_DEBUG_NO_COLOR 1 + set -Ux GST_DEBUG_COLOR_MODE off + + mkdir -p /tmp/gst-dot + set -Ux GST_DEBUG_DUMP_DOT_DIR /tmp/gst-dot end # Instead of tty check, we would have liked to do this using status is-login # check but for some reason that does not work? set --local TTY1 (tty) -[ "$TTY1" = "/dev/tty1" ] && __fish_setup_on_tty_login +[ "$TTY1" = /dev/tty1 ] && __fish_setup_on_tty_login diff --git a/fish/.config/fish/conf.d/sway.fish b/fish/.config/fish/conf.d/sway.fish index 0f61f7a..ba16fbd 100644 --- a/fish/.config/fish/conf.d/sway.fish +++ b/fish/.config/fish/conf.d/sway.fish @@ -1,3 +1,3 @@ # If running from tty1 start sway set --local TTY1 (tty) -[ "$TTY1" = "/dev/tty1" ] && exec sway +[ "$TTY1" = /dev/tty1 ] && exec sway diff --git a/fish/.config/fish/conf.d/virtualfish-loader.fish b/fish/.config/fish/conf.d/virtualfish-loader.fish index d6e7ff6..d0e2efa 100644 --- a/fish/.config/fish/conf.d/virtualfish-loader.fish +++ b/fish/.config/fish/conf.d/virtualfish-loader.fish @@ -1,4 +1,4 @@ set -g VIRTUALFISH_VERSION 2.5.4 set -g VIRTUALFISH_PYTHON_EXEC /usr/bin/python source /usr/lib/python3.10/site-packages/virtualfish/virtual.fish -emit virtualfish_did_setup_plugins \ No newline at end of file +emit virtualfish_did_setup_plugins diff --git a/fish/.config/fish/functions/b.fish b/fish/.config/fish/functions/b.fish index 01a0c58..b5ab292 100644 --- a/fish/.config/fish/functions/b.fish +++ b/fish/.config/fish/functions/b.fish @@ -1,10 +1,10 @@ function b --description 'Move up the directory specified number of times' - if test -z $argv[1] - set n 1 - else - set n $argv[1] - end - for i in (seq $n) - cd .. - end + if test -z $argv[1] + set n 1 + else + set n $argv[1] + end + for i in (seq $n) + cd .. + end end diff --git a/fish/.config/fish/functions/c.fish b/fish/.config/fish/functions/c.fish index 4aa8bda..89325cd 100644 --- a/fish/.config/fish/functions/c.fish +++ b/fish/.config/fish/functions/c.fish @@ -1,3 +1,3 @@ function c --wraps=clear --description 'alias c=clear' - clear $argv; + clear $argv end diff --git a/fish/.config/fish/functions/cat.fish b/fish/.config/fish/functions/cat.fish index 5ef6a67..9106247 100644 --- a/fish/.config/fish/functions/cat.fish +++ b/fish/.config/fish/functions/cat.fish @@ -1,3 +1,3 @@ function cat --wraps=bat --description 'alias cat=bat' - bat $argv; + bat $argv end diff --git a/fish/.config/fish/functions/cbD.fish b/fish/.config/fish/functions/cbD.fish index 422dd1d..2dd6591 100644 --- a/fish/.config/fish/functions/cbD.fish +++ b/fish/.config/fish/functions/cbD.fish @@ -1,3 +1,3 @@ function cbD --wraps='cargo doc --open' --description 'alias cbD=cargo doc --open' - cargo doc --open $argv; + cargo doc --open $argv end diff --git a/fish/.config/fish/functions/cba.fish b/fish/.config/fish/functions/cba.fish index 39ce939..4a39b7c 100644 --- a/fish/.config/fish/functions/cba.fish +++ b/fish/.config/fish/functions/cba.fish @@ -1,3 +1,3 @@ function cba --wraps='cargo update && cargo build --all && cargo doc' --description 'alias cba=cargo update && cargo build --all && cargo doc' - cargo update && cargo build --all && cargo doc $argv; + cargo update && cargo build --all && cargo doc $argv end diff --git a/fish/.config/fish/functions/cbb.fish b/fish/.config/fish/functions/cbb.fish index 8fb30e4..c5a4e2c 100644 --- a/fish/.config/fish/functions/cbb.fish +++ b/fish/.config/fish/functions/cbb.fish @@ -1,3 +1,3 @@ function cbb --wraps='cargo build --all' --description 'alias cbb=cargo build --all' - cargo build --all $argv; + cargo build --all $argv end diff --git a/fish/.config/fish/functions/cbc.fish b/fish/.config/fish/functions/cbc.fish index 22800a2..27d115d 100644 --- a/fish/.config/fish/functions/cbc.fish +++ b/fish/.config/fish/functions/cbc.fish @@ -1,3 +1,3 @@ function cbc --wraps='cargo clean' --description 'alias cbc=cargo clean' - cargo clean $argv; + cargo clean $argv end diff --git a/fish/.config/fish/functions/cbd.fish b/fish/.config/fish/functions/cbd.fish index 43d7277..b547b89 100644 --- a/fish/.config/fish/functions/cbd.fish +++ b/fish/.config/fish/functions/cbd.fish @@ -1,3 +1,3 @@ function cbd --wraps='cargo doc' --description 'alias cbd=cargo doc' - cargo doc $argv; + cargo doc $argv end diff --git a/fish/.config/fish/functions/cbu.fish b/fish/.config/fish/functions/cbu.fish index 5a4bf3c..0844480 100644 --- a/fish/.config/fish/functions/cbu.fish +++ b/fish/.config/fish/functions/cbu.fish @@ -1,3 +1,3 @@ function cbu --wraps='cargo update' --description 'alias cbu=cargo update' - cargo update $argv; + cargo update $argv end diff --git a/fish/.config/fish/functions/cdG.fish b/fish/.config/fish/functions/cdG.fish index ac8bbaf..b794121 100644 --- a/fish/.config/fish/functions/cdG.fish +++ b/fish/.config/fish/functions/cdG.fish @@ -1,4 +1,4 @@ function cdG --description 'Select a coredump to run coredumpctl gdb' - coredumpctl list --reverse | awk -F" " '$9 == "present"' | fzf | read -l result - coredumpctl gdb (echo $result | awk -F" " '{print $5}') + coredumpctl list --reverse | awk -F" " '$9 == "present"' | fzf | read -l result + coredumpctl gdb (echo $result | awk -F" " '{print $5}') end diff --git a/fish/.config/fish/functions/cdg.fish b/fish/.config/fish/functions/cdg.fish index c5d59ea..0981ec2 100644 --- a/fish/.config/fish/functions/cdg.fish +++ b/fish/.config/fish/functions/cdg.fish @@ -1,3 +1,3 @@ function cdg --description 'coredumpctl gdb on last crashed process' - coredumpctl gdb + coredumpctl gdb end diff --git a/fish/.config/fish/functions/cdi.fish b/fish/.config/fish/functions/cdi.fish index f40fcac..6566376 100644 --- a/fish/.config/fish/functions/cdi.fish +++ b/fish/.config/fish/functions/cdi.fish @@ -1,4 +1,4 @@ function cdi --description 'Select a coredump to run coredumpctl info' - coredumpctl list --reverse | awk -F" " '$9 == "present"' | fzf | read -l result - coredumpctl info (echo $result | awk -F" " '{print $5}') + coredumpctl list --reverse | awk -F" " '$9 == "present"' | fzf | read -l result + coredumpctl info (echo $result | awk -F" " '{print $5}') end diff --git a/fish/.config/fish/functions/coqtop.fish b/fish/.config/fish/functions/coqtop.fish index 1aa50fc..46e0676 100644 --- a/fish/.config/fish/functions/coqtop.fish +++ b/fish/.config/fish/functions/coqtop.fish @@ -1,3 +1,3 @@ function coqtop - rlwrap coqtop $argv + rlwrap coqtop $argv end diff --git a/fish/.config/fish/functions/dotP.fish b/fish/.config/fish/functions/dotP.fish index 9961b5f..4c00a2f 100644 --- a/fish/.config/fish/functions/dotP.fish +++ b/fish/.config/fish/functions/dotP.fish @@ -1,5 +1,5 @@ function dotP --description 'Generate Pipewire dot graph for all nodes' - pw-dot -L -a -o /tmp/pw.dot - dot -Tsvg /tmp/pw.dot > ~/Pictures/pipewire/pw-dot-(date +%T).svg - rm /tmp/pw.dot + pw-dot -L -a -o /tmp/pw.dot + dot -Tsvg /tmp/pw.dot >~/Pictures/pipewire/pw-dot-(date +%T).svg + rm /tmp/pw.dot end diff --git a/fish/.config/fish/functions/dotg.fish b/fish/.config/fish/functions/dotg.fish index ea09140..03e6526 100644 --- a/fish/.config/fish/functions/dotg.fish +++ b/fish/.config/fish/functions/dotg.fish @@ -1,14 +1,14 @@ function dotg --description 'Generate gstreamer dot graph for selected file' - if count $argv > /dev/null - set dotpath "$argv" - else - set dotpath "$GST_DEBUG_DUMP_DOT_DIR" - end + if count $argv >/dev/null + set dotpath "$argv" + else + set dotpath "$GST_DEBUG_DUMP_DOT_DIR" + end - find $dotpath -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" | fzf | read -l result; + find $dotpath -maxdepth 1 -regextype posix-extended -regex ".*\.(dot)" | fzf | read -l result - if test -n "$result" - dot -Tsvg "$result" -O - mv "$result".svg ~/Pictures/gstreamer - end + if test -n "$result" + dot -Tsvg "$result" -O + mv "$result".svg ~/Pictures/gstreamer + end end diff --git a/fish/.config/fish/functions/dotp.fish b/fish/.config/fish/functions/dotp.fish index a1a9a2e..9b7793e 100644 --- a/fish/.config/fish/functions/dotp.fish +++ b/fish/.config/fish/functions/dotp.fish @@ -1,5 +1,5 @@ function dotp --description 'Generate Pipewire dot graph for linked nodes' - pw-dot -L -s -o /tmp/pw.dot - dot -Tsvg /tmp/pw.dot > ~/Pictures/pipewire/pw-dot-(date +%T).svg - rm /tmp/pw.dot + pw-dot -L -s -o /tmp/pw.dot + dot -Tsvg /tmp/pw.dot >~/Pictures/pipewire/pw-dot-(date +%T).svg + rm /tmp/pw.dot end diff --git a/fish/.config/fish/functions/dpw.fish b/fish/.config/fish/functions/dpw.fish index 5536d79..cda55e3 100644 --- a/fish/.config/fish/functions/dpw.fish +++ b/fish/.config/fish/functions/dpw.fish @@ -1,3 +1,3 @@ function dpw --wraps=pw-dump\ \|\ jq\ \|\ nvim\ -c\ \'setlocal\ ft=json\'\ -R --description alias\ dpw=pw-dump\ \|\ jq\ \|\ nvim\ -c\ \'setlocal\ ft=json\'\ -R - pw-dump | jq | nvim -c 'setlocal ft=json' -R $argv; + pw-dump | jq | nvim -c 'setlocal ft=json' -R $argv end diff --git a/fish/.config/fish/functions/fcR.fish b/fish/.config/fish/functions/fcR.fish index e2adff8..ff24af8 100644 --- a/fish/.config/fish/functions/fcR.fish +++ b/fish/.config/fish/functions/fcR.fish @@ -1,3 +1,3 @@ function fcR --description 'Git revert a selected commit using fzf' - git revert (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi +s | awk '{print $1}') + git revert (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi +s | awk '{print $1}') end diff --git a/fish/.config/fish/functions/fcf.fish b/fish/.config/fish/functions/fcf.fish index 37a341c..bd4e319 100644 --- a/fish/.config/fish/functions/fcf.fish +++ b/fish/.config/fish/functions/fcf.fish @@ -1,3 +1,3 @@ function fcf --description 'Git commit fixup using fzf' - git commit --fixup (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi | cut -d ' ' -f1) + git commit --fixup (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi | cut -d ' ' -f1) end diff --git a/fish/.config/fish/functions/fco.fish b/fish/.config/fish/functions/fco.fish index 9fa1b68..6886de4 100644 --- a/fish/.config/fish/functions/fco.fish +++ b/fish/.config/fish/functions/fco.fish @@ -1,3 +1,3 @@ function fco --description 'Checkout a branch using fzf' - git branch --all | grep -v HEAD | string trim | fzf | read -l result; and git checkout "$result" + git branch --all | grep -v HEAD | string trim | fzf | read -l result; and git checkout "$result" end diff --git a/fish/.config/fish/functions/fcoc.fish b/fish/.config/fish/functions/fcoc.fish index 5ca45be..beb6ffd 100644 --- a/fish/.config/fish/functions/fcoc.fish +++ b/fish/.config/fish/functions/fcoc.fish @@ -1,3 +1,3 @@ function fcoc --description 'Checkout a commit using fzf' - git log --pretty=oneline --abbrev-commit --reverse | fzf --tac +s -e | awk '{print $1;}' | read -l result; and git checkout "$result" + git log --pretty=oneline --abbrev-commit --reverse | fzf --tac +s -e | awk '{print $1;}' | read -l result; and git checkout "$result" end diff --git a/fish/.config/fish/functions/fcr.fish b/fish/.config/fish/functions/fcr.fish index 7f1ba23..3f33498 100644 --- a/fish/.config/fish/functions/fcr.fish +++ b/fish/.config/fish/functions/fcr.fish @@ -1,3 +1,3 @@ function fcr --description 'Git reset to a selected commit using fzf' - git reset $argv (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi +s | awk '{print $1}') + git reset $argv (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi +s | awk '{print $1}') end diff --git a/fish/.config/fish/functions/ffa.fish b/fish/.config/fish/functions/ffa.fish index d42553b..1cdc219 100644 --- a/fish/.config/fish/functions/ffa.fish +++ b/fish/.config/fish/functions/ffa.fish @@ -1,3 +1,3 @@ function ffa --description 'Git add files using fzf' - git add -- (git ls-files --modified --others --exclude-standard | fzf -m --preview 'bat --color=always {}') + git add -- (git ls-files --modified --others --exclude-standard | fzf -m --preview 'bat --color=always {}') end diff --git a/fish/.config/fish/functions/ffco.fish b/fish/.config/fish/functions/ffco.fish index a8b92ae..9529044 100644 --- a/fish/.config/fish/functions/ffco.fish +++ b/fish/.config/fish/functions/ffco.fish @@ -1,3 +1,3 @@ function ffco --description 'Git checkout a file using fzf' - git checkout $argv -- (git ls-files --modified --exclude-standard | fzf -m) + git checkout $argv -- (git ls-files --modified --exclude-standard | fzf -m) end diff --git a/fish/.config/fish/functions/ffr.fish b/fish/.config/fish/functions/ffr.fish index 00147cc..770b98c 100644 --- a/fish/.config/fish/functions/ffr.fish +++ b/fish/.config/fish/functions/ffr.fish @@ -1,3 +1,3 @@ function ffr --description 'Git restore a file using fzf' - git restore $argv -- (git ls-files --modified --exclude-standard | fzf -m) + git restore $argv -- (git ls-files --modified --exclude-standard | fzf -m) end diff --git a/fish/.config/fish/functions/ffrs.fish b/fish/.config/fish/functions/ffrs.fish index dcc9ef4..4fbc8f8 100644 --- a/fish/.config/fish/functions/ffrs.fish +++ b/fish/.config/fish/functions/ffrs.fish @@ -1,3 +1,3 @@ function ffrs --description 'Git restore a staged file using fzf' - git restore --staged $argv -- (git diff --name-only --staged | fzf -m) + git restore --staged $argv -- (git diff --name-only --staged | fzf -m) end diff --git a/fish/.config/fish/functions/finfo.fish b/fish/.config/fish/functions/finfo.fish index 7096bd9..c481747 100644 --- a/fish/.config/fish/functions/finfo.fish +++ b/fish/.config/fish/functions/finfo.fish @@ -1,3 +1,3 @@ function finfo --description "Get information from media using ffprobe" - ffprobe -v error -show_format -show_streams -show_frames $argv + ffprobe -v error -show_format -show_streams -show_frames $argv end diff --git a/fish/.config/fish/functions/fish_profile.fish b/fish/.config/fish/functions/fish_profile.fish index 636807e..5157b99 100644 --- a/fish/.config/fish/functions/fish_profile.fish +++ b/fish/.config/fish/functions/fish_profile.fish @@ -1,7 +1,7 @@ function fish_profile - if test -e /tmp/fish.profile - rm /tmp/fish.profile - end - fish --profile-startup /tmp/fish.profile -i -c exit - sort -nk2 /tmp/fish.profile + if test -e /tmp/fish.profile + rm /tmp/fish.profile + end + fish --profile-startup /tmp/fish.profile -i -c exit + sort -nk2 /tmp/fish.profile end diff --git a/fish/.config/fish/functions/fish_prompt.fish b/fish/.config/fish/functions/fish_prompt.fish index e3302f8..d38ea42 100644 --- a/fish/.config/fish/functions/fish_prompt.fish +++ b/fish/.config/fish/functions/fish_prompt.fish @@ -1,82 +1,93 @@ set --path -a NESTED_FISH_LABELS function fish_prompt - set -l command_status $status - set -l question_mark_in_circle '?'\u20dd - set_color red; echo -n '# ' + set -l command_status $status + set -l question_mark_in_circle '?'\u20dd + set_color red + echo -n '# ' - # Print nesting - if test (count $NESTED_FISH_LABELS) -gt 0 - echo -ns '[' (set_color yellow) \ - (string join (set_color red)/(set_color yellow) $NESTED_FISH_LABELS) \ - (set_color red) '] ' - end + # Print nesting + if test (count $NESTED_FISH_LABELS) -gt 0 + echo -ns '[' (set_color yellow) \ + (string join (set_color red)/(set_color yellow) $NESTED_FISH_LABELS) \ + (set_color red) '] ' + end - # Print current location - if [ "$PWD" = "$HOME" ] - set_color green; echo -n '~' - else - set -l parent_dir (dirname "$PWD") - set_color blue - if [ "$parent_dir" = "$HOME" ] - echo -n '~' + # Print current location + if [ "$PWD" = "$HOME" ] + set_color green + echo -n '~' else - echo -n (basename "$parent_dir") + set -l parent_dir (dirname "$PWD") + set_color blue + if [ "$parent_dir" = "$HOME" ] + echo -n '~' + else + echo -n (basename "$parent_dir") + end + echo -n ' → ' + set_color green + echo -n (basename "$PWD") end - echo -n ' → ' - set_color green; echo -n (basename "$PWD") - end - echo -n ' ' + echo -n ' ' - # Show some pretty git information if we're in a git repo - set -l is_git_worktree (git rev-parse --is-inside-work-tree 2>/dev/null) - if test "$is_git_worktree" = true - if git rev-parse '@{u}' >/dev/null 2>&1 - # If an upstream is set, check how far ahead/behind the branch is - set -l git_commits_ahead (git rev-list '@{u}..HEAD' | wc -l | awk '{print $1}') - set -l git_commits_behind (git rev-list 'HEAD..@{u}' | wc -l | awk '{print $1}') - if [ \( "$git_commits_ahead" -eq 0 \) -a \( "$git_commits_behind" -eq 0 \) ] - set_color blue; echo -n '⦿' - else - if [ "$git_commits_behind" -gt 0 ] - set_color red; echo -n "↓$git_commits_behind" + # Show some pretty git information if we're in a git repo + set -l is_git_worktree (git rev-parse --is-inside-work-tree 2>/dev/null) + if test "$is_git_worktree" = true + if git rev-parse '@{u}' >/dev/null 2>&1 + # If an upstream is set, check how far ahead/behind the branch is + set -l git_commits_ahead (git rev-list '@{u}..HEAD' | wc -l | awk '{print $1}') + set -l git_commits_behind (git rev-list 'HEAD..@{u}' | wc -l | awk '{print $1}') + if [ \( "$git_commits_ahead" -eq 0 \) -a \( "$git_commits_behind" -eq 0 \) ] + set_color blue + echo -n '⦿' + else + if [ "$git_commits_behind" -gt 0 ] + set_color red + echo -n "↓$git_commits_behind" + end + if [ "$git_commits_ahead" -gt 0 ] + set_color brred + echo -n "↑$git_commits_ahead" + end + end + else + # Otherwise, indicate that an upstream is unknown + set_color brred + echo -n "$question_mark_in_circle" end - if [ "$git_commits_ahead" -gt 0 ] - set_color brred; echo -n "↑$git_commits_ahead" + + set -l git_branch (git branch 2>/dev/null | sed -n '/\* /s///p') + if test -n "$git_branch" + set_color blue + echo -n ' [' + # Color the branch name differently if the working tree is dirty + if [ (count (git status --porcelain)) -gt 0 ] + set_color brred + else + set_color yellow + end + echo -n "$git_branch" + set_color blue + echo -n '] ' end - end + end + + if [ "$command_status" -eq 0 ] + set_color brcyan + echo -n 'λ: ' else - # Otherwise, indicate that an upstream is unknown - set_color brred; echo -n "$question_mark_in_circle" + set_color red + echo -n 'λ! ' + end + set_color normal + + # Color the hostname in the prompt dynamically whenever connected through SSH + if set -q SSH_TTY + set -g fish_color_host brred end - set -l git_branch (git branch 2>/dev/null | sed -n '/\* /s///p') - if test -n "$git_branch" - set_color blue; echo -n ' [' - # Color the branch name differently if the working tree is dirty - if [ (count (git status --porcelain)) -gt 0 ] - set_color brred - else - set_color yellow - end - echo -n "$git_branch" - set_color blue; echo -n '] ' + if set -q VIRTUAL_ENV + echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " " end - end - - if [ "$command_status" -eq 0 ] - set_color brcyan; echo -n 'λ: ' - else - set_color red; echo -n 'λ! ' - end - set_color normal - - # Color the hostname in the prompt dynamically whenever connected through SSH - if set -q SSH_TTY - set -g fish_color_host brred - end - - if set -q VIRTUAL_ENV - echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " " - end end diff --git a/fish/.config/fish/functions/fish_user_key_bindings.fish b/fish/.config/fish/functions/fish_user_key_bindings.fish index f7cc218..6dc93b8 100644 --- a/fish/.config/fish/functions/fish_user_key_bindings.fish +++ b/fish/.config/fish/functions/fish_user_key_bindings.fish @@ -1,5 +1,5 @@ function fish_user_key_bindings - # https://github.com/fish-shell/fish-shell/issues/5593 - bind \cd true - fzf_key_bindings + # https://github.com/fish-shell/fish-shell/issues/5593 + bind \cd true + fzf_key_bindings end diff --git a/fish/.config/fish/functions/frbi.fish b/fish/.config/fish/functions/frbi.fish index c052687..7cc4afc 100644 --- a/fish/.config/fish/functions/frbi.fish +++ b/fish/.config/fish/functions/frbi.fish @@ -1,3 +1,3 @@ function frbi --description 'Git interactive rebase using fzf' - git rebase -i (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi | cut -d ' ' -f1) + git rebase -i (git log --pretty=oneline --abbrev-commit --color=always | fzf --ansi | cut -d ' ' -f1) end diff --git a/fish/.config/fish/functions/fstream.fish b/fish/.config/fish/functions/fstream.fish index d135f48..7ba741d 100644 --- a/fish/.config/fish/functions/fstream.fish +++ b/fish/.config/fish/functions/fstream.fish @@ -1,3 +1,3 @@ function fstream --description "Show streams in media using ffprobe" - ffprobe -v error -show_streams $argv + ffprobe -v error -show_streams $argv end diff --git a/fish/.config/fish/functions/fu.fish b/fish/.config/fish/functions/fu.fish index 0c6f067..8e5f6c7 100644 --- a/fish/.config/fish/functions/fu.fish +++ b/fish/.config/fish/functions/fu.fish @@ -1,3 +1,3 @@ function fu - fnm use + fnm use end diff --git a/fish/.config/fish/functions/gd.fish b/fish/.config/fish/functions/gd.fish index f425a4c..dd6f796 100644 --- a/fish/.config/fish/functions/gd.fish +++ b/fish/.config/fish/functions/gd.fish @@ -1,3 +1,3 @@ function gd - git diff $argv + git diff $argv end diff --git a/fish/.config/fish/functions/gdba.fish b/fish/.config/fish/functions/gdba.fish index b354bab..235cdf1 100644 --- a/fish/.config/fish/functions/gdba.fish +++ b/fish/.config/fish/functions/gdba.fish @@ -1,3 +1,3 @@ function gdba --description 'Attach to a process' - gdb attach -p (ps -ef | fzf | awk '{print $2}' | head -1) + gdb attach -p (ps -ef | fzf | awk '{print $2}' | head -1) end diff --git a/fish/.config/fish/functions/gdbp.fish b/fish/.config/fish/functions/gdbp.fish index e53e1be..89e6afb 100644 --- a/fish/.config/fish/functions/gdbp.fish +++ b/fish/.config/fish/functions/gdbp.fish @@ -1,3 +1,3 @@ function gdbp --description 'Attach to a python process' - gdb python3 (ps -ef | fzf | awk '{print $2}' | head -1) + gdb python3 (ps -ef | fzf | awk '{print $2}' | head -1) end diff --git a/fish/.config/fish/functions/gdbr.fish b/fish/.config/fish/functions/gdbr.fish index bacca51..9d991fd 100644 --- a/fish/.config/fish/functions/gdbr.fish +++ b/fish/.config/fish/functions/gdbr.fish @@ -1,3 +1,3 @@ function gdbr --description 'Start a command/process with rust-gdb' - rust-gdb --args $argv + rust-gdb --args $argv end diff --git a/fish/.config/fish/functions/gdbt.fish b/fish/.config/fish/functions/gdbt.fish index e94fd3a..bf7e0ea 100644 --- a/fish/.config/fish/functions/gdbt.fish +++ b/fish/.config/fish/functions/gdbt.fish @@ -1,24 +1,24 @@ function gdbt -d "GDB with tmux panes" - if set -q TMUX - set proc (ps -ef | fzf | awk '{print $2}') + if set -q TMUX + set proc (ps -ef | fzf | awk '{print $2}') - if test -n "$proc" - set -l tty1_id (tmux split-pane -hPF "#D" "tail -f /dev/null") - tmux last-pane - set -l tty1 (tmux display-message -p -t "$tty1_id" '#{pane_tty}') + if test -n "$proc" + set -l tty1_id (tmux split-pane -hPF "#D" "tail -f /dev/null") + tmux last-pane + set -l tty1 (tmux display-message -p -t "$tty1_id" '#{pane_tty}') - set -l tty2_id (tmux split-pane -hPF "#D" "tail -f /dev/null") - tmux last-pane - set -l tty2 (tmux display-message -p -t "$tty2_id" '#{pane_tty}') + set -l tty2_id (tmux split-pane -hPF "#D" "tail -f /dev/null") + tmux last-pane + set -l tty2 (tmux display-message -p -t "$tty2_id" '#{pane_tty}') - tmux select-layout even-horizontal + tmux select-layout even-horizontal - gdb -q -ex "dashboard breakpoints -output $tty1" -ex "dashboard variables -output $tty1" -ex "dashboard threads -output $tty2" -ex "attach $proc" + gdb -q -ex "dashboard breakpoints -output $tty1" -ex "dashboard variables -output $tty1" -ex "dashboard threads -output $tty2" -ex "attach $proc" - tmux kill-pane -t $tty1_id - tmux kill-pane -t $tty2_id + tmux kill-pane -t $tty1_id + tmux kill-pane -t $tty2_id + end + else + echo "Not inside TMUX" end - else - echo "Not inside TMUX" - end end diff --git a/fish/.config/fish/functions/gdd.fish b/fish/.config/fish/functions/gdd.fish index b1ecf7c..d822aa9 100644 --- a/fish/.config/fish/functions/gdd.fish +++ b/fish/.config/fish/functions/gdd.fish @@ -1,4 +1,3 @@ function gdd --description "Use difftastic as a difftool" - git difftool --tool=difftastic $argv + git difftool --tool=difftastic $argv end - diff --git a/fish/.config/fish/functions/gdk.fish b/fish/.config/fish/functions/gdk.fish index a5a7a1b..da7df27 100644 --- a/fish/.config/fish/functions/gdk.fish +++ b/fish/.config/fish/functions/gdk.fish @@ -1,3 +1,3 @@ function gdk - git difftool --tool=kitty $argv + git difftool --tool=kitty $argv end diff --git a/fish/.config/fish/functions/gdt.fish b/fish/.config/fish/functions/gdt.fish index 58970c9..29437f1 100644 --- a/fish/.config/fish/functions/gdt.fish +++ b/fish/.config/fish/functions/gdt.fish @@ -1,3 +1,3 @@ function gdt - git difftool $argv + git difftool $argv end diff --git a/fish/.config/fish/functions/gf.fish b/fish/.config/fish/functions/gf.fish index e3c96bf..c84a836 100644 --- a/fish/.config/fish/functions/gf.fish +++ b/fish/.config/fish/functions/gf.fish @@ -1,3 +1,3 @@ function gf - git fetch --all --tags -f + git fetch --all --tags -f end diff --git a/fish/.config/fish/functions/git_remote_toggle.fish b/fish/.config/fish/functions/git_remote_toggle.fish index 1d1b6af..a4219da 100644 --- a/fish/.config/fish/functions/git_remote_toggle.fish +++ b/fish/.config/fish/functions/git_remote_toggle.fish @@ -1,76 +1,76 @@ function git_remote_toggle --description 'Switch git repository between HTTPS and SSH' - set -l options h/help q/quiet S/ssh H/https - argparse $options -- $argv; or return + set -l options h/help q/quiet S/ssh H/https + argparse $options -- $argv; or return - if set -q _flag_help - echo 'Usage: git_remote_toggle [-h/--help] [-q/--quiet] [-S/--ssh] [-H/--https] [remotes ...]' - return 0 - end - - if set -q _flag_ssh; and set -q _flag_https - echo 'Must choose only one of --ssh and --https' - return 1 - end - - if ! __grt_in_git - echo 'Not in a git repository' - return 1 - end - - for remote in $argv - set -l url (git remote get-url $remote 2>/dev/null) - set -l newurl - - if test -z "$url" - if ! set -q _flag_quiet - echo "Remote $remote does not exist" - end - continue - else if __grt_is_ssh $url; and ! set -q _flag_ssh - set newurl (__grt_to_https $url) - else if __grt_is_https $url; and ! set -q _flag_https - set newurl (__grt_to_ssh $url) + if set -q _flag_help + echo 'Usage: git_remote_toggle [-h/--help] [-q/--quiet] [-S/--ssh] [-H/--https] [remotes ...]' + return 0 end - if test -n "$newurl" - # Sanity check - if __grt_is_ssh $url; and __grt_is_https $newurl - else if __grt_is_https $url; and __grt_is_ssh $newurl - else - echo "Something went wrong: $url -> $newurl" - continue - end - - if ! set -q _flag_quiet - echo "$remote: $url -> $newurl" - end - git remote set-url $remote $newurl + if set -q _flag_ssh; and set -q _flag_https + echo 'Must choose only one of --ssh and --https' + return 1 + end + + if ! __grt_in_git + echo 'Not in a git repository' + return 1 + end + + for remote in $argv + set -l url (git remote get-url $remote 2>/dev/null) + set -l newurl + + if test -z "$url" + if ! set -q _flag_quiet + echo "Remote $remote does not exist" + end + continue + else if __grt_is_ssh $url; and ! set -q _flag_ssh + set newurl (__grt_to_https $url) + else if __grt_is_https $url; and ! set -q _flag_https + set newurl (__grt_to_ssh $url) + end + + if test -n "$newurl" + # Sanity check + if __grt_is_ssh $url; and __grt_is_https $newurl + else if __grt_is_https $url; and __grt_is_ssh $newurl + else + echo "Something went wrong: $url -> $newurl" + continue + end + + if ! set -q _flag_quiet + echo "$remote: $url -> $newurl" + end + git remote set-url $remote $newurl + end end - end end # git@github.com:{repo} -> https://github.com/{repo} function __grt_to_https - set -l url (string replace ':' '/' $argv) - set -l url (string replace 'git@' 'https://' $url) - echo $url + set -l url (string replace ':' '/' $argv) + set -l url (string replace 'git@' 'https://' $url) + echo $url end # https://github.com/{repo} -> git@github.com:{repo} function __grt_to_ssh - set -l url (string replace 'https://' 'git@' $argv) - set -l url (string replace '/' ':' $url) - echo $url + set -l url (string replace 'https://' 'git@' $argv) + set -l url (string replace '/' ':' $url) + echo $url end function __grt_is_ssh - string match -qr '^git@' $argv + string match -qr '^git@' $argv end function __grt_is_https - string match -qr '^https://' $argv + string match -qr '^https://' $argv end function __grt_in_git - git status 2&>/dev/null + git status 2&>/dev/null end diff --git a/fish/.config/fish/functions/gl.fish b/fish/.config/fish/functions/gl.fish index dffaad2..6ca8245 100644 --- a/fish/.config/fish/functions/gl.fish +++ b/fish/.config/fish/functions/gl.fish @@ -1,23 +1,21 @@ function gl --description 'Git browse commits' - set -l log_line_to_hash "echo {} | grep -o '[a-f0-9]\{7\}' | head -1" - set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | bat -ldiff'" - set -l view_commit_nvim "$log_line_to_hash | xargs -I % sh -c 'git show %'" - set -l copy_commit_hash "$log_line_to_hash | wl-copy" - set -l git_checkout "$log_line_to_hash | xargs -I % sh -c 'git checkout %'" - set -l git_cherry_pick "$log_line_to_hash | xargs -I % sh -c 'git cherry-pick %'" - set -l open_cmd "xdg-open" + set -l log_line_to_hash "echo {} | grep -o '[a-f0-9]\{7\}' | head -1" + set -l view_commit "$log_line_to_hash | xargs -I % sh -c 'git show --color=always % | bat -ldiff'" + set -l view_commit_nvim "$log_line_to_hash | xargs -I % sh -c 'git show %'" + set -l copy_commit_hash "$log_line_to_hash | wl-copy" + set -l git_checkout "$log_line_to_hash | xargs -I % sh -c 'git checkout %'" + set -l git_cherry_pick "$log_line_to_hash | xargs -I % sh -c 'git cherry-pick %'" + set -l open_cmd xdg-open - set github_open "$log_line_to_hash | xargs -I % sh -c '$open_cmd https://github.\$(git config remote.origin.url | cut -f2 -d. | tr \':\' /)/commit/%'" + set github_open "$log_line_to_hash | xargs -I % sh -c '$open_cmd https://github.\$(git config remote.origin.url | cut -f2 -d. | tr \':\' /)/commit/%'" - git log --color=always --format='%C(auto)%h%d %s %C(green)%C(bold)%cr% C(blue)%an' $argv | \ - fzf --exact --no-sort --reverse --tiebreak=index --no-multi --ansi \ - --preview="$view_commit" \ - --header="ENTER to view, CTRL-Y to copy hash, CTRL-O to open on GitHub, CTRL-X to checkout, CTRL-C to exit, CTRL-S to cherry-pick" \ - --bind "enter:execute:$view_commit_nvim | nvim -R -" \ - --bind "ctrl-y:execute:$copy_commit_hash" \ - --bind "ctrl-x:execute:$git_checkout" \ - --bind "ctrl-o:execute:$github_open" \ - --bind "ctrl-s:execute:$git_cherry_pick" \ - --bind "ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-n:preview-down,ctrl-p:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up" + git log --color=always --format='%C(auto)%h%d %s %C(green)%C(bold)%cr% C(blue)%an' $argv | fzf --exact --no-sort --reverse --tiebreak=index --no-multi --ansi \ + --preview="$view_commit" \ + --header="ENTER to view, CTRL-Y to copy hash, CTRL-O to open on GitHub, CTRL-X to checkout, CTRL-C to exit, CTRL-S to cherry-pick" \ + --bind "enter:execute:$view_commit_nvim | nvim -R -" \ + --bind "ctrl-y:execute:$copy_commit_hash" \ + --bind "ctrl-x:execute:$git_checkout" \ + --bind "ctrl-o:execute:$github_open" \ + --bind "ctrl-s:execute:$git_cherry_pick" \ + --bind "ctrl-d:half-page-down,ctrl-u:half-page-up,ctrl-n:preview-down,ctrl-p:preview-up,ctrl-f:preview-page-down,ctrl-b:preview-page-up" end - diff --git a/fish/.config/fish/functions/gm.fish b/fish/.config/fish/functions/gm.fish index 60a8aeb..644c6e4 100644 --- a/fish/.config/fish/functions/gm.fish +++ b/fish/.config/fish/functions/gm.fish @@ -1,3 +1,3 @@ function gm - git merge $argv + git merge $argv end diff --git a/fish/.config/fish/functions/gn.fish b/fish/.config/fish/functions/gn.fish index a669dc7..d14ebaf 100644 --- a/fish/.config/fish/functions/gn.fish +++ b/fish/.config/fish/functions/gn.fish @@ -1,3 +1,3 @@ function gn --wraps='nvim +Git +only' --description 'alias gn=nvim +Git +only' - nvim +Git +only $argv; + nvim +Git +only $argv end diff --git a/fish/.config/fish/functions/grf.fish b/fish/.config/fish/functions/grf.fish index e015a9b..63423b8 100644 --- a/fish/.config/fish/functions/grf.fish +++ b/fish/.config/fish/functions/grf.fish @@ -1,3 +1,3 @@ function grf --description 'Search within a file with grep with context' - grep --color=always -C 10 --group-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | less -R + grep --color=always -C 10 --group-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | less -R end diff --git a/fish/.config/fish/functions/gs.fish b/fish/.config/fish/functions/gs.fish index 7d76a06..aa601b3 100644 --- a/fish/.config/fish/functions/gs.fish +++ b/fish/.config/fish/functions/gs.fish @@ -1,3 +1,3 @@ function gs --wraps='git status' - git status + git status end diff --git a/fish/.config/fish/functions/gsl.fish b/fish/.config/fish/functions/gsl.fish index 292d170..54d0764 100644 --- a/fish/.config/fish/functions/gsl.fish +++ b/fish/.config/fish/functions/gsl.fish @@ -1,3 +1,3 @@ function gsl --wraps=gst-launch-1.0 --description 'alias gsl=gst-launch-1.0' - gst-launch-1.0 $argv; + gst-launch-1.0 $argv end diff --git a/fish/.config/fish/functions/gst.fish b/fish/.config/fish/functions/gst.fish index 81fdb1b..0c84405 100644 --- a/fish/.config/fish/functions/gst.fish +++ b/fish/.config/fish/functions/gst.fish @@ -1,3 +1,3 @@ function gst --wraps=gst-inspect-1.0 --description 'alias gst=gst-inspect-1.0' - gst-inspect-1.0 $argv; + gst-inspect-1.0 $argv end diff --git a/fish/.config/fish/functions/gsv.fish b/fish/.config/fish/functions/gsv.fish index 3e6e9ae..ebda471 100644 --- a/fish/.config/fish/functions/gsv.fish +++ b/fish/.config/fish/functions/gsv.fish @@ -1,3 +1,3 @@ function gsv --wraps='git status' - git status --verbose + git status --verbose end diff --git a/fish/.config/fish/functions/hf.fish b/fish/.config/fish/functions/hf.fish index bff7842..f6a872c 100644 --- a/fish/.config/fish/functions/hf.fish +++ b/fish/.config/fish/functions/hf.fish @@ -1,3 +1,3 @@ function hf --description "Start htop with commands matching filter" - htop -F $argv + htop -F $argv end diff --git a/fish/.config/fish/functions/icat.fish b/fish/.config/fish/functions/icat.fish index 19b233b..2ee70a0 100644 --- a/fish/.config/fish/functions/icat.fish +++ b/fish/.config/fish/functions/icat.fish @@ -1,3 +1,3 @@ function icat --wraps='kitty +kitten icat (fzf)' --description 'alias icat=kitty +kitten icat (fzf)' - kitty +kitten icat (fzf) $argv; + kitty +kitten icat (fzf) $argv end diff --git a/fish/.config/fish/functions/jb.fish b/fish/.config/fish/functions/jb.fish index 68063fe..de32edf 100644 --- a/fish/.config/fish/functions/jb.fish +++ b/fish/.config/fish/functions/jb.fish @@ -1,3 +1,3 @@ function jb --wraps='journalctl -r -b -1' --description 'alias jb=journalctl -r -b -1' - journalctl -r -b -1 $argv; + journalctl -r -b -1 $argv end diff --git a/fish/.config/fish/functions/jbl.fish b/fish/.config/fish/functions/jbl.fish index 7ea931a..7a6f348 100644 --- a/fish/.config/fish/functions/jbl.fish +++ b/fish/.config/fish/functions/jbl.fish @@ -1,3 +1,3 @@ function jbl --description 'Select a boot to view logs' - journalctl -r -b (journalctl --list-boots | fzf --tac | awk '{print $1}') + journalctl -r -b (journalctl --list-boots | fzf --tac | awk '{print $1}') end diff --git a/fish/.config/fish/functions/jf.fish b/fish/.config/fish/functions/jf.fish index 066f0ce..e2ddb75 100644 --- a/fish/.config/fish/functions/jf.fish +++ b/fish/.config/fish/functions/jf.fish @@ -1,3 +1,3 @@ function jf --wraps='journalctl -f' --description 'alias jf=journalctl -f' - journalctl -f $argv; + journalctl -f $argv end diff --git a/fish/.config/fish/functions/jk.fish b/fish/.config/fish/functions/jk.fish index cc85fbe..d4a4c37 100644 --- a/fish/.config/fish/functions/jk.fish +++ b/fish/.config/fish/functions/jk.fish @@ -1,3 +1,3 @@ function jk --wraps='journalctl -r -k' --description 'alias jk=journalctl -r -k' - journalctl -r -k $argv; + journalctl -r -k $argv end diff --git a/fish/.config/fish/functions/jr.fish b/fish/.config/fish/functions/jr.fish index f7b5b11..5a7a62e 100644 --- a/fish/.config/fish/functions/jr.fish +++ b/fish/.config/fish/functions/jr.fish @@ -1,3 +1,3 @@ function jr --wraps='journalctl -r' --description 'alias jr=journalctl -r' - journalctl -r $argv; + journalctl -r $argv end diff --git a/fish/.config/fish/functions/ju.fish b/fish/.config/fish/functions/ju.fish index 66ddb45..19d87d9 100644 --- a/fish/.config/fish/functions/ju.fish +++ b/fish/.config/fish/functions/ju.fish @@ -1,3 +1,3 @@ function ju --wraps='journalctl -u' --description 'alias ju=journalctl -u' - journalctl -u $argv; + journalctl -u $argv end diff --git a/fish/.config/fish/functions/jx.fish b/fish/.config/fish/functions/jx.fish index 791c1cf..978127c 100644 --- a/fish/.config/fish/functions/jx.fish +++ b/fish/.config/fish/functions/jx.fish @@ -1,3 +1,3 @@ function jx --wraps='journalctl -xe' --description 'alias jx=journalctl -xe' - journalctl -xe $argv; + journalctl -xe $argv end diff --git a/fish/.config/fish/functions/kr.fish b/fish/.config/fish/functions/kr.fish index 57f3fbb..f016740 100644 --- a/fish/.config/fish/functions/kr.fish +++ b/fish/.config/fish/functions/kr.fish @@ -1,5 +1,5 @@ function kr --description "Reload kitty configuration" - for pid in (pidof kitty | string split ' ') - kill -SIGUSR1 $pid - end + for pid in (pidof kitty | string split ' ') + kill -SIGUSR1 $pid + end end diff --git a/fish/.config/fish/functions/l.fish b/fish/.config/fish/functions/l.fish index 9f3ee3e..8a82540 100644 --- a/fish/.config/fish/functions/l.fish +++ b/fish/.config/fish/functions/l.fish @@ -1,3 +1,3 @@ function l -w exa - exa -l $argv + exa -l $argv end diff --git a/fish/.config/fish/functions/lg.fish b/fish/.config/fish/functions/lg.fish index c38d288..fae1454 100644 --- a/fish/.config/fish/functions/lg.fish +++ b/fish/.config/fish/functions/lg.fish @@ -1,3 +1,3 @@ function lg - lazygit -ucd ~/.config/lazygit + lazygit -ucd ~/.config/lazygit end diff --git a/fish/.config/fish/functions/ll.fish b/fish/.config/fish/functions/ll.fish index 78622b4..5840cc3 100644 --- a/fish/.config/fish/functions/ll.fish +++ b/fish/.config/fish/functions/ll.fish @@ -1,3 +1,3 @@ function ll -w exa - exa -la $argv + exa -la $argv end diff --git a/fish/.config/fish/functions/lt.fish b/fish/.config/fish/functions/lt.fish index b008dfd..118ac1c 100644 --- a/fish/.config/fish/functions/lt.fish +++ b/fish/.config/fish/functions/lt.fish @@ -1,3 +1,3 @@ function lt -w exa - exa --tree --git-ignore $argv + exa --tree --git-ignore $argv end diff --git a/fish/.config/fish/functions/m.fish b/fish/.config/fish/functions/m.fish index 5e02c63..5db8eeb 100644 --- a/fish/.config/fish/functions/m.fish +++ b/fish/.config/fish/functions/m.fish @@ -1,3 +1,3 @@ function m --wraps=mutt --description 'alias m=mutt' - mutt $argv; + mutt $argv end diff --git a/fish/.config/fish/functions/mkdcd.fish b/fish/.config/fish/functions/mkdcd.fish index 603e8d7..0e5c48b 100644 --- a/fish/.config/fish/functions/mkdcd.fish +++ b/fish/.config/fish/functions/mkdcd.fish @@ -1,6 +1,6 @@ function mkdcd -d "Create a new directory and immediately cd into it" - mkdir -p -- $argv - if test $status = 0 - cd $argv - end + mkdir -p -- $argv + if test $status = 0 + cd $argv + end end diff --git a/fish/.config/fish/functions/mkdir.fish b/fish/.config/fish/functions/mkdir.fish index a4432f7..8ea8461 100644 --- a/fish/.config/fish/functions/mkdir.fish +++ b/fish/.config/fish/functions/mkdir.fish @@ -1,3 +1,3 @@ function mkdir - command mkdir -p $argv + command mkdir -p $argv end diff --git a/fish/.config/fish/functions/mkvtomp4.fish b/fish/.config/fish/functions/mkvtomp4.fish index 37ff656..e974a0a 100644 --- a/fish/.config/fish/functions/mkvtomp4.fish +++ b/fish/.config/fish/functions/mkvtomp4.fish @@ -1,6 +1,6 @@ function mkvtomp4 --description "Reencode mkv to mp4" - for i in *.mkv - set fname (basename $i .mkv) - ffmpeg -i $i -c:v libx264 -c:a aac $fname.mp4 - end + for i in *.mkv + set fname (basename $i .mkv) + ffmpeg -i $i -c:v libx264 -c:a aac $fname.mp4 + end end diff --git a/fish/.config/fish/functions/nvim_profile.fish b/fish/.config/fish/functions/nvim_profile.fish index aa6e69e..0a14bc0 100644 --- a/fish/.config/fish/functions/nvim_profile.fish +++ b/fish/.config/fish/functions/nvim_profile.fish @@ -1,7 +1,7 @@ function nvim_profile - if test -e /tmp/nvim_profile.profile - rm /tmp/nvim_profile.profile - end - nvim --startuptime /tmp/nvim_profile.profile +q - tail -1 /tmp/nvim_profile.profile | awk '{print $1}' + if test -e /tmp/nvim_profile.profile + rm /tmp/nvim_profile.profile + end + nvim --startuptime /tmp/nvim_profile.profile +q + tail -1 /tmp/nvim_profile.profile | awk '{print $1}' end diff --git a/fish/.config/fish/functions/pfr.fish b/fish/.config/fish/functions/pfr.fish index 8cb1e7a..e6cefeb 100644 --- a/fish/.config/fish/functions/pfr.fish +++ b/fish/.config/fish/functions/pfr.fish @@ -1,4 +1,4 @@ function pfr --description 'Select a process to record performance data in given file name' - set proc (ps -ef | fzf | awk '{print $2}') - perf record -F 99 -o $argv -p $proc + set proc (ps -ef | fzf | awk '{print $2}') + perf record -F 99 -o $argv -p $proc end diff --git a/fish/.config/fish/functions/pft.fish b/fish/.config/fish/functions/pft.fish index ecb5e14..ac17ea0 100644 --- a/fish/.config/fish/functions/pft.fish +++ b/fish/.config/fish/functions/pft.fish @@ -1,4 +1,4 @@ function pft --description 'Select a process to run perf top' - set proc (ps -ef | fzf | awk '{print $2}') - perf top -p $proc + set proc (ps -ef | fzf | awk '{print $2}') + perf top -p $proc end diff --git a/fish/.config/fish/functions/pk.fish b/fish/.config/fish/functions/pk.fish index a2ed2db..b055133 100644 --- a/fish/.config/fish/functions/pk.fish +++ b/fish/.config/fish/functions/pk.fish @@ -1,4 +1,4 @@ function pk --description 'Fuzzy find a process to kill' - set proc (ps -ef | fzf | awk '{print $2}') - kill -SIGKILL $proc + set proc (ps -ef | fzf | awk '{print $2}') + kill -SIGKILL $proc end diff --git a/fish/.config/fish/functions/psmem.fish b/fish/.config/fish/functions/psmem.fish index 1a9f5f0..510ad75 100644 --- a/fish/.config/fish/functions/psmem.fish +++ b/fish/.config/fish/functions/psmem.fish @@ -1,4 +1,4 @@ function psmem --description 'Show memory usage of a process' - set proc (ps -ef | fzf | awk '{print $2}') - ps_mem -p $proc + set proc (ps -ef | fzf | awk '{print $2}') + ps_mem -p $proc end diff --git a/fish/.config/fish/functions/pst.fish b/fish/.config/fish/functions/pst.fish index 7bdb2d6..90de9c6 100644 --- a/fish/.config/fish/functions/pst.fish +++ b/fish/.config/fish/functions/pst.fish @@ -1,4 +1,4 @@ function pst --description 'Show process tree of a process' - set proc (ps -ef | fzf | awk '{print $2}' | head -1) - pstree -H $proc $proc + set proc (ps -ef | fzf | awk '{print $2}' | head -1) + pstree -H $proc $proc end diff --git a/fish/.config/fish/functions/rfc.fish b/fish/.config/fish/functions/rfc.fish index 3628ab3..a9da827 100644 --- a/fish/.config/fish/functions/rfc.fish +++ b/fish/.config/fish/functions/rfc.fish @@ -1,6 +1,6 @@ function rfc --description 'Search for string in RFC documents and open' - if test -e ~/rfc - rg --files-with-matches $argv ~/rfc | fzf --preview='less {}' | read -l result - nvim -R $result - end + if test -e ~/rfc + rg --files-with-matches $argv ~/rfc | fzf --preview='less {}' | read -l result + nvim -R $result + end end diff --git a/fish/.config/fish/functions/rgc.fish b/fish/.config/fish/functions/rgc.fish index ab7dccd..b0598c6 100644 --- a/fish/.config/fish/functions/rgc.fish +++ b/fish/.config/fish/functions/rgc.fish @@ -1,3 +1,3 @@ function rgc --description 'Search within a file with ripgrep with context' - rg --color never -C 10 --context-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | nvim -R + rg --color never -C 10 --context-separator="---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" $argv | nvim -R end diff --git a/fish/.config/fish/functions/rgf.fish b/fish/.config/fish/functions/rgf.fish index ed3676a..be8bca4 100644 --- a/fish/.config/fish/functions/rgf.fish +++ b/fish/.config/fish/functions/rgf.fish @@ -1,3 +1,3 @@ function rgf --description 'Search within a file with ripgrep' - rg --color never $argv | nvim -R + rg --color never $argv | nvim -R end diff --git a/fish/.config/fish/functions/sdd.fish b/fish/.config/fish/functions/sdd.fish index 7357404..1852b03 100644 --- a/fish/.config/fish/functions/sdd.fish +++ b/fish/.config/fish/functions/sdd.fish @@ -1,3 +1,3 @@ function sdd --wraps='systemctl disable ' --description 'alias sdd=systemctl disable ' - systemctl disable $argv; + systemctl disable $argv end diff --git a/fish/.config/fish/functions/sde.fish b/fish/.config/fish/functions/sde.fish index 20751dd..abf2765 100644 --- a/fish/.config/fish/functions/sde.fish +++ b/fish/.config/fish/functions/sde.fish @@ -1,3 +1,3 @@ function sde --wraps='systemctl enable ' --description 'alias sde=systemctl enable ' - systemctl enable $argv; + systemctl enable $argv end diff --git a/fish/.config/fish/functions/sds.fish b/fish/.config/fish/functions/sds.fish index 20d6b59..519ee59 100644 --- a/fish/.config/fish/functions/sds.fish +++ b/fish/.config/fish/functions/sds.fish @@ -1,3 +1,3 @@ function sds --wraps='systemctl status ' --description 'alias sds=systemctl status ' - systemctl status $argv; + systemctl status $argv end diff --git a/fish/.config/fish/functions/sfc.fish b/fish/.config/fish/functions/sfc.fish index 4819d49..ea77624 100644 --- a/fish/.config/fish/functions/sfc.fish +++ b/fish/.config/fish/functions/sfc.fish @@ -1,3 +1,3 @@ function sfc --wraps='source ~/.config/fish/config.fish' --description 'alias sfc=source ~/.config/fish/config.fish' - source ~/.config/fish/config.fish $argv; + source ~/.config/fish/config.fish $argv end diff --git a/fish/.config/fish/functions/su.fish b/fish/.config/fish/functions/su.fish index 84cc0cf..d0244d9 100644 --- a/fish/.config/fish/functions/su.fish +++ b/fish/.config/fish/functions/su.fish @@ -1,4 +1,4 @@ # https://wiki.archlinux.org/title/fish#Make_su_launch_fish function su - command su --shell=/usr/bin/fish $argv + command su --shell=/usr/bin/fish $argv end diff --git a/fish/.config/fish/functions/t.fish b/fish/.config/fish/functions/t.fish index e1aeb29..a706f3e 100644 --- a/fish/.config/fish/functions/t.fish +++ b/fish/.config/fish/functions/t.fish @@ -1,3 +1,3 @@ function t --wraps='tokei .' --description 'alias t=tokei .' - tokei . $argv; + tokei . $argv end diff --git a/fish/.config/fish/functions/ta.fish b/fish/.config/fish/functions/ta.fish index eeb6ba0..45f9a56 100644 --- a/fish/.config/fish/functions/ta.fish +++ b/fish/.config/fish/functions/ta.fish @@ -1,4 +1,4 @@ function ta --description 'Attaches to a selected session' - set session (tmux list-sessions | fzf | awk -F':' '{print $1}') - tmux attach -t $session; + set session (tmux list-sessions | fzf | awk -F':' '{print $1}') + tmux attach -t $session end diff --git a/fish/.config/fish/functions/tks.fish b/fish/.config/fish/functions/tks.fish index e4ff864..3d70c16 100644 --- a/fish/.config/fish/functions/tks.fish +++ b/fish/.config/fish/functions/tks.fish @@ -1,3 +1,3 @@ function tks --wraps='tmux kill-server' --description 'alias tks=tmux kill-server' - tmux kill-server $argv; + tmux kill-server $argv end diff --git a/fish/.config/fish/functions/tksa.fish b/fish/.config/fish/functions/tksa.fish index 2f0cfd4..8f8e9e5 100644 --- a/fish/.config/fish/functions/tksa.fish +++ b/fish/.config/fish/functions/tksa.fish @@ -1,3 +1,3 @@ function tksa --wraps='tmux kill-session -a' --description 'alias tksa=tmux kill-session -a' - tmux kill-session -a $argv; + tmux kill-session -a $argv end diff --git a/fish/.config/fish/functions/tls.fish b/fish/.config/fish/functions/tls.fish index f7418a4..22a22af 100644 --- a/fish/.config/fish/functions/tls.fish +++ b/fish/.config/fish/functions/tls.fish @@ -1,3 +1,3 @@ function tls --wraps='tmux ls' --description 'alias tls=tmux ls' - tmux ls $argv; + tmux ls $argv end diff --git a/fish/.config/fish/functions/topf.fish b/fish/.config/fish/functions/topf.fish index 10e8a34..58cb2ca 100644 --- a/fish/.config/fish/functions/topf.fish +++ b/fish/.config/fish/functions/topf.fish @@ -1,4 +1,4 @@ function topf --description 'Select a process to run top' - set proc (ps -ef | fzf | awk '{print $2}') - top -H -p $proc + set proc (ps -ef | fzf | awk '{print $2}') + top -H -p $proc end diff --git a/fish/.config/fish/functions/v.fish b/fish/.config/fish/functions/v.fish index d4ceb93..8ff6858 100644 --- a/fish/.config/fish/functions/v.fish +++ b/fish/.config/fish/functions/v.fish @@ -1,3 +1,3 @@ function v --wraps=nvim --description 'alias v=nvim' - nvim $argv; + nvim $argv end diff --git a/fish/.config/fish/functions/vc.fish b/fish/.config/fish/functions/vc.fish index 97e1084..15b071e 100644 --- a/fish/.config/fish/functions/vc.fish +++ b/fish/.config/fish/functions/vc.fish @@ -1,3 +1,3 @@ function vc --wraps='nvim --clean' --description 'alias vc=nvim --clean' - nvim --clean $argv; + nvim --clean $argv end diff --git a/fish/.config/fish/functions/vd.fish b/fish/.config/fish/functions/vd.fish index 2c5862c..674ef47 100644 --- a/fish/.config/fish/functions/vd.fish +++ b/fish/.config/fish/functions/vd.fish @@ -2,5 +2,5 @@ # ACMRU = Added || Copied || Modified || Renamed || Unmerged # Edit all uncommitted files that have changes since the last commit (be they staged or unstaged) function vd --wraps='nvim (git diff HEAD --name-only --diff-filter=ACMR)' --description 'alias vd=nvim (git diff HEAD --name-only --diff-filter=ACMR)' - nvim (git diff HEAD --name-only --diff-filter=ACMR) $argv; + nvim (git diff HEAD --name-only --diff-filter=ACMR) $argv end diff --git a/fish/.config/fish/functions/vdc.fish b/fish/.config/fish/functions/vdc.fish index 9183790..cca6330 100644 --- a/fish/.config/fish/functions/vdc.fish +++ b/fish/.config/fish/functions/vdc.fish @@ -1,3 +1,3 @@ function vdc --wraps='nvim (git diff HEAD^ --name-only --diff-filter=ACMR)' --description 'Edit all files that were altered in the last commit' - nvim (git diff HEAD^ --name-only --diff-filter=ACMR) $argv; + nvim (git diff HEAD^ --name-only --diff-filter=ACMR) $argv end diff --git a/fish/.config/fish/functions/vdm.fish b/fish/.config/fish/functions/vdm.fish index abf451d..45ff368 100644 --- a/fish/.config/fish/functions/vdm.fish +++ b/fish/.config/fish/functions/vdm.fish @@ -1,3 +1,3 @@ function vdm --wraps='nvim (git diff master --name-only --diff-filter=ACMR)' --description 'Edit files changed since master' - nvim (git diff master --name-only --diff-filter=ACMR) $argv; + nvim (git diff master --name-only --diff-filter=ACMR) $argv end diff --git a/fish/.config/fish/functions/vds.fish b/fish/.config/fish/functions/vds.fish index cd058f7..92d4529 100644 --- a/fish/.config/fish/functions/vds.fish +++ b/fish/.config/fish/functions/vds.fish @@ -1,3 +1,3 @@ function vds --wraps='nvim (git diff --staged --name-only --diff-filter=ACMR)' --description 'Edit all staged files that have changes since the last commit' - nvim (git diff --staged --name-only --diff-filter=ACMR) $argv; + nvim (git diff --staged --name-only --diff-filter=ACMR) $argv end diff --git a/fish/.config/fish/functions/vdu.fish b/fish/.config/fish/functions/vdu.fish index 65ab1ba..35071bf 100644 --- a/fish/.config/fish/functions/vdu.fish +++ b/fish/.config/fish/functions/vdu.fish @@ -1,3 +1,3 @@ function vdu --wraps='nvim (git diff --name-only --diff-filter=U | uniq)' --description 'Edit files unmerged' - nvim (git diff --name-only --diff-filter=U | uniq) $argv; + nvim (git diff --name-only --diff-filter=U | uniq) $argv end diff --git a/fish/.config/fish/functions/vdua.fish b/fish/.config/fish/functions/vdua.fish index 774fd97..8c97e02 100644 --- a/fish/.config/fish/functions/vdua.fish +++ b/fish/.config/fish/functions/vdua.fish @@ -1,3 +1,3 @@ function vdua --wraps='git add (git diff --name-only --diff-filter=U)' --description 'Add unmerged files' - git add (git diff --name-only --diff-filter=U) $argv; + git add (git diff --name-only --diff-filter=U) $argv end diff --git a/fish/.config/fish/functions/vfv.fish b/fish/.config/fish/functions/vfv.fish index d1f94bb..69d8f14 100644 --- a/fish/.config/fish/functions/vfv.fish +++ b/fish/.config/fish/functions/vfv.fish @@ -1,3 +1,3 @@ function vfv --wraps='v (fzf)' --description 'alias vf=v (fzf)' - v (fzf) $argv; + v (fzf) $argv end diff --git a/fish/.config/fish/functions/vg.fish b/fish/.config/fish/functions/vg.fish index 7cfa181..b4e8726 100644 --- a/fish/.config/fish/functions/vg.fish +++ b/fish/.config/fish/functions/vg.fish @@ -1,3 +1,3 @@ function vg --wraps=vgrep --description 'alias vg=vgrep' - vgrep $argv; + vgrep $argv end diff --git a/fish/.config/fish/functions/vn.fish b/fish/.config/fish/functions/vn.fish index d13fbe9..6f009dd 100644 --- a/fish/.config/fish/functions/vn.fish +++ b/fish/.config/fish/functions/vn.fish @@ -1,3 +1,3 @@ function vn --wraps='nvim -u NONE' --description 'alias vn=nvim -u NONE' - nvim -u NONE $argv; + nvim -u NONE $argv end diff --git a/fish/.config/fish/functions/vnp.fish b/fish/.config/fish/functions/vnp.fish index 24f70cf..d91f49d 100644 --- a/fish/.config/fish/functions/vnp.fish +++ b/fish/.config/fish/functions/vnp.fish @@ -1,3 +1,3 @@ function vnp --wraps='nvim --noplugin' --description 'alias vnp=nvim --noplugin' - nvim --noplugin $argv; + nvim --noplugin $argv end diff --git a/fish/.config/fish/functions/vnrc.fish b/fish/.config/fish/functions/vnrc.fish index 3ea1848..2c4155d 100644 --- a/fish/.config/fish/functions/vnrc.fish +++ b/fish/.config/fish/functions/vnrc.fish @@ -1,3 +1,3 @@ function vnrc --wraps='nvim -u NORC' --description 'alias vnrc=nvim -u NORC' - nvim -u NORC $argv; + nvim -u NORC $argv end diff --git a/fish/.config/fish/functions/vo.fish b/fish/.config/fish/functions/vo.fish index 7a933ab..6b07b00 100644 --- a/fish/.config/fish/functions/vo.fish +++ b/fish/.config/fish/functions/vo.fish @@ -1,3 +1,3 @@ function vo --description 'Pipe a command output to neovim' - $argv | nvim -R + $argv | nvim -R end diff --git a/fish/.config/fish/functions/vs.fish b/fish/.config/fish/functions/vs.fish index f9e4b2b..31f3732 100644 --- a/fish/.config/fish/functions/vs.fish +++ b/fish/.config/fish/functions/vs.fish @@ -1,3 +1,3 @@ function vs --wraps='vgrep -s' --description 'alias vs=vgrep -s' - vgrep -s $argv; + vgrep -s $argv end