fish: Clean up with fish_indent

This commit is contained in:
Sanchayan Maity 2022-04-12 17:41:50 +05:30
parent 6a6a8b4d2a
commit 478fede9e4
107 changed files with 370 additions and 362 deletions

View file

@ -58,10 +58,10 @@ function __fish_setup_on_tty_login --description "Set up environment on tty logi
end
set -gx CLICOLOR 1
set -gx LSCOLORS 'gxfxcxdxbxegedabaggxgx'
set -gx LSCOLORS gxfxcxdxbxegedabaggxgx
set -Ux GST_DEBUG_NO_COLOR 1
set -Ux GST_DEBUG_COLOR_MODE "off"
set -Ux GST_DEBUG_COLOR_MODE off
mkdir -p /tmp/gst-dot
set -Ux GST_DEBUG_DUMP_DOT_DIR /tmp/gst-dot
@ -70,4 +70,4 @@ 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

View file

@ -1,3 +1,3 @@
# If running from tty1 start sway
set --local TTY1 (tty)
[ "$TTY1" = "/dev/tty1" ] && exec sway
[ "$TTY1" = /dev/tty1 ] && exec sway

View file

@ -1,3 +1,3 @@
function c --wraps=clear --description 'alias c=clear'
clear $argv;
clear $argv
end

View file

@ -1,3 +1,3 @@
function cat --wraps=bat --description 'alias cat=bat'
bat $argv;
bat $argv
end

View file

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

View file

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

View file

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

View file

@ -1,3 +1,3 @@
function cbc --wraps='cargo clean' --description 'alias cbc=cargo clean'
cargo clean $argv;
cargo clean $argv
end

View file

@ -1,3 +1,3 @@
function cbd --wraps='cargo doc' --description 'alias cbd=cargo doc'
cargo doc $argv;
cargo doc $argv
end

View file

@ -1,3 +1,3 @@
function cbu --wraps='cargo update' --description 'alias cbu=cargo update'
cargo update $argv;
cargo update $argv
end

View file

@ -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
dot -Tsvg /tmp/pw.dot >~/Pictures/pipewire/pw-dot-(date +%T).svg
rm /tmp/pw.dot
end

View file

@ -1,11 +1,11 @@
function dotg --description 'Generate gstreamer dot graph for selected file'
if count $argv > /dev/null
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

View file

@ -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
dot -Tsvg /tmp/pw.dot >~/Pictures/pipewire/pw-dot-(date +%T).svg
rm /tmp/pw.dot
end

View file

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

View file

@ -3,7 +3,8 @@ 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_color red
echo -n '# '
# Print nesting
if test (count $NESTED_FISH_LABELS) -gt 0
@ -14,7 +15,8 @@ function fish_prompt
# Print current location
if [ "$PWD" = "$HOME" ]
set_color green; echo -n '~'
set_color green
echo -n '~'
else
set -l parent_dir (dirname "$PWD")
set_color blue
@ -24,7 +26,8 @@ function fish_prompt
echo -n (basename "$parent_dir")
end
echo -n ' → '
set_color green; echo -n (basename "$PWD")
set_color green
echo -n (basename "$PWD")
end
echo -n ' '
@ -36,23 +39,28 @@ function fish_prompt
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 '⦿'
set_color blue
echo -n '⦿'
else
if [ "$git_commits_behind" -gt 0 ]
set_color red; echo -n "$git_commits_behind"
set_color red
echo -n "$git_commits_behind"
end
if [ "$git_commits_ahead" -gt 0 ]
set_color brred; echo -n "$git_commits_ahead"
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"
set_color brred
echo -n "$question_mark_in_circle"
end
set -l git_branch (git branch 2>/dev/null | sed -n '/\* /s///p')
if test -n "$git_branch"
set_color blue; echo -n ' ['
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
@ -60,14 +68,17 @@ function fish_prompt
set_color yellow
end
echo -n "$git_branch"
set_color blue; echo -n '] '
set_color blue
echo -n '] '
end
end
if [ "$command_status" -eq 0 ]
set_color brcyan; echo -n 'λ: '
set_color brcyan
echo -n 'λ: '
else
set_color red; echo -n 'λ! '
set_color red
echo -n 'λ! '
end
set_color normal

View file

@ -1,4 +1,3 @@
function gdd --description "Use difftastic as a difftool"
git difftool --tool=difftastic $argv
end

View file

@ -5,12 +5,11 @@ function gl --description 'Git browse commits'
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 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/%'"
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 \
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 -" \
@ -20,4 +19,3 @@ function gl --description 'Git browse commits'
--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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,3 @@
function jf --wraps='journalctl -f' --description 'alias jf=journalctl -f'
journalctl -f $argv;
journalctl -f $argv
end

View file

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

View file

@ -1,3 +1,3 @@
function jr --wraps='journalctl -r' --description 'alias jr=journalctl -r'
journalctl -r $argv;
journalctl -r $argv
end

View file

@ -1,3 +1,3 @@
function ju --wraps='journalctl -u' --description 'alias ju=journalctl -u'
journalctl -u $argv;
journalctl -u $argv
end

View file

@ -1,3 +1,3 @@
function jx --wraps='journalctl -xe' --description 'alias jx=journalctl -xe'
journalctl -xe $argv;
journalctl -xe $argv
end

View file

@ -1,3 +1,3 @@
function m --wraps=mutt --description 'alias m=mutt'
mutt $argv;
mutt $argv
end

View file

@ -1,3 +1,3 @@
function sdd --wraps='systemctl disable ' --description 'alias sdd=systemctl disable '
systemctl disable $argv;
systemctl disable $argv
end

View file

@ -1,3 +1,3 @@
function sde --wraps='systemctl enable ' --description 'alias sde=systemctl enable '
systemctl enable $argv;
systemctl enable $argv
end

View file

@ -1,3 +1,3 @@
function sds --wraps='systemctl status ' --description 'alias sds=systemctl status '
systemctl status $argv;
systemctl status $argv
end

View file

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

View file

@ -1,3 +1,3 @@
function t --wraps='tokei .' --description 'alias t=tokei .'
tokei . $argv;
tokei . $argv
end

View file

@ -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;
tmux attach -t $session
end

View file

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

View file

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

View file

@ -1,3 +1,3 @@
function tls --wraps='tmux ls' --description 'alias tls=tmux ls'
tmux ls $argv;
tmux ls $argv
end

View file

@ -1,3 +1,3 @@
function v --wraps=nvim --description 'alias v=nvim'
nvim $argv;
nvim $argv
end

View file

@ -1,3 +1,3 @@
function vc --wraps='nvim --clean' --description 'alias vc=nvim --clean'
nvim --clean $argv;
nvim --clean $argv
end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,3 +1,3 @@
function vfv --wraps='v (fzf)' --description 'alias vf=v (fzf)'
v (fzf) $argv;
v (fzf) $argv
end

View file

@ -1,3 +1,3 @@
function vg --wraps=vgrep --description 'alias vg=vgrep'
vgrep $argv;
vgrep $argv
end

View file

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

View file

@ -1,3 +1,3 @@
function vnp --wraps='nvim --noplugin' --description 'alias vnp=nvim --noplugin'
nvim --noplugin $argv;
nvim --noplugin $argv
end

View file

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

View file

@ -1,3 +1,3 @@
function vs --wraps='vgrep -s' --description 'alias vs=vgrep -s'
vgrep -s $argv;
vgrep -s $argv
end