fish: Clean up with fish_indent
This commit is contained in:
parent
6a6a8b4d2a
commit
478fede9e4
107 changed files with 370 additions and 362 deletions
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
# If running from tty1 start sway
|
||||
set --local TTY1 (tty)
|
||||
[ "$TTY1" = "/dev/tty1" ] && exec sway
|
||||
[ "$TTY1" = /dev/tty1 ] && exec sway
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function c --wraps=clear --description 'alias c=clear'
|
||||
clear $argv;
|
||||
clear $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function cat --wraps=bat --description 'alias cat=bat'
|
||||
bat $argv;
|
||||
bat $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function cbc --wraps='cargo clean' --description 'alias cbc=cargo clean'
|
||||
cargo clean $argv;
|
||||
cargo clean $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function cbd --wraps='cargo doc' --description 'alias cbd=cargo doc'
|
||||
cargo doc $argv;
|
||||
cargo doc $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function cbu --wraps='cargo update' --description 'alias cbu=cargo update'
|
||||
cargo update $argv;
|
||||
cargo update $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function cdg --description 'coredumpctl gdb on last crashed process'
|
||||
coredumpctl gdb
|
||||
coredumpctl gdb
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function coqtop
|
||||
rlwrap coqtop $argv
|
||||
rlwrap coqtop $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function fu
|
||||
fnm use
|
||||
fnm use
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gd
|
||||
git diff $argv
|
||||
git diff $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gdbr --description 'Start a command/process with rust-gdb'
|
||||
rust-gdb --args $argv
|
||||
rust-gdb --args $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
function gdd --description "Use difftastic as a difftool"
|
||||
git difftool --tool=difftastic $argv
|
||||
git difftool --tool=difftastic $argv
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gdk
|
||||
git difftool --tool=kitty $argv
|
||||
git difftool --tool=kitty $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gdt
|
||||
git difftool $argv
|
||||
git difftool $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gf
|
||||
git fetch --all --tags -f
|
||||
git fetch --all --tags -f
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gm
|
||||
git merge $argv
|
||||
git merge $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gs --wraps='git status'
|
||||
git status
|
||||
git status
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function gsv --wraps='git status'
|
||||
git status --verbose
|
||||
git status --verbose
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function hf --description "Start htop with commands matching filter"
|
||||
htop -F $argv
|
||||
htop -F $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function jf --wraps='journalctl -f' --description 'alias jf=journalctl -f'
|
||||
journalctl -f $argv;
|
||||
journalctl -f $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function jr --wraps='journalctl -r' --description 'alias jr=journalctl -r'
|
||||
journalctl -r $argv;
|
||||
journalctl -r $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function ju --wraps='journalctl -u' --description 'alias ju=journalctl -u'
|
||||
journalctl -u $argv;
|
||||
journalctl -u $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function jx --wraps='journalctl -xe' --description 'alias jx=journalctl -xe'
|
||||
journalctl -xe $argv;
|
||||
journalctl -xe $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function l -w exa
|
||||
exa -l $argv
|
||||
exa -l $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function lg
|
||||
lazygit -ucd ~/.config/lazygit
|
||||
lazygit -ucd ~/.config/lazygit
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function ll -w exa
|
||||
exa -la $argv
|
||||
exa -la $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function lt -w exa
|
||||
exa --tree --git-ignore $argv
|
||||
exa --tree --git-ignore $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function m --wraps=mutt --description 'alias m=mutt'
|
||||
mutt $argv;
|
||||
mutt $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function mkdir
|
||||
command mkdir -p $argv
|
||||
command mkdir -p $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function sdd --wraps='systemctl disable ' --description 'alias sdd=systemctl disable '
|
||||
systemctl disable $argv;
|
||||
systemctl disable $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function sde --wraps='systemctl enable ' --description 'alias sde=systemctl enable '
|
||||
systemctl enable $argv;
|
||||
systemctl enable $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function sds --wraps='systemctl status ' --description 'alias sds=systemctl status '
|
||||
systemctl status $argv;
|
||||
systemctl status $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function t --wraps='tokei .' --description 'alias t=tokei .'
|
||||
tokei . $argv;
|
||||
tokei . $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function tls --wraps='tmux ls' --description 'alias tls=tmux ls'
|
||||
tmux ls $argv;
|
||||
tmux ls $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function v --wraps=nvim --description 'alias v=nvim'
|
||||
nvim $argv;
|
||||
nvim $argv
|
||||
end
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function vc --wraps='nvim --clean' --description 'alias vc=nvim --clean'
|
||||
nvim --clean $argv;
|
||||
nvim --clean $argv
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
function vfv --wraps='v (fzf)' --description 'alias vf=v (fzf)'
|
||||
v (fzf) $argv;
|
||||
v (fzf) $argv
|
||||
end
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue