2020-01-16 17:01:59 -06:00
|
|
|
#!/usr/bin/env fish
|
|
|
|
|
|
|
|
# ls aliases
|
|
|
|
alias lx 'ls -lXB' # order by filetype
|
|
|
|
alias lk 'ls -lSr' # order by filesize reversed
|
|
|
|
alias lt 'ls -ltr' # order by file modified time
|
|
|
|
alias lc 'ls -ltcr' # order by filectime
|
|
|
|
alias lu 'ls -ltur' # order by file access time
|
|
|
|
alias ls 'ls -h --color --group-directories-first' # flat view w/ directories first
|
|
|
|
alias l 'ls -h --color --group-directories-first' # same as above
|
|
|
|
alias ll 'ls -lv --group-directories-first' # non-flat view
|
|
|
|
alias lm 'll | more'
|
|
|
|
alias lr 'll -R' # please don't - why is this even here...?
|
|
|
|
alias la 'll -A' # show all
|
|
|
|
|
|
|
|
# other file aliases
|
|
|
|
alias tree 'tree -Csuh'
|
|
|
|
alias f fzf
|
|
|
|
alias cp 'rsync -ah --progress'
|
|
|
|
|
|
|
|
# gets the newest file in the current directory (or the specified directory
|
|
|
|
# if one is provided)
|
|
|
|
function ltl
|
|
|
|
set d $argv[1] .
|
|
|
|
set -l l ""
|
|
|
|
for f in $d[1]/*
|
|
|
|
if test -z $l; set l $f; continue; end
|
|
|
|
if command test $f -nt $l; and test ! -d $f
|
|
|
|
set l $f
|
|
|
|
end
|
|
|
|
end
|
|
|
|
echo $l
|
|
|
|
end
|
|
|
|
|
2020-01-23 09:51:03 -06:00
|
|
|
function scount -d "Silent count" -w count
|
|
|
|
count $argv > /dev/null
|
|
|
|
end
|
|
|
|
|
2020-01-16 17:01:59 -06:00
|
|
|
function ltld
|
|
|
|
set d $argv[1] .
|
|
|
|
set -l l ""
|
|
|
|
for f in $d[1]/*
|
|
|
|
if test -z $l; set l $f; continue; end
|
|
|
|
if command test $f -nt $l; and test -d $f
|
|
|
|
set l $f
|
|
|
|
end
|
|
|
|
end
|
|
|
|
echo $l
|
|
|
|
end
|
|
|
|
|
|
|
|
alias vltl "vim (ltl)"
|
|
|
|
alias cdltl "cd (ltld)"
|
|
|
|
alias ltlv vltl
|
|
|
|
|
2020-01-23 09:51:03 -06:00
|
|
|
function d -w cd
|
|
|
|
if scount $argv
|
|
|
|
cd $argv || exit 1
|
2020-01-16 17:01:59 -06:00
|
|
|
else
|
|
|
|
cd $NICE_HOME || exit 1
|
|
|
|
end
|
2020-01-23 09:51:03 -06:00
|
|
|
la
|
2020-01-16 17:01:59 -06:00
|
|
|
end
|
2020-01-23 09:51:03 -06:00
|
|
|
|
|
|
|
# navigation aliases
|
|
|
|
function c -w cd
|
|
|
|
if scount $argv
|
|
|
|
cd $NICE_HOME && d $argv || exit 1
|
|
|
|
else
|
|
|
|
d $NICE_HOME
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
alias cd.. "d .."
|
|
|
|
alias cdd "d $DOTFILES_PATH" # go to dotfiles
|
|
|
|
alias cde "d $ENV_PATH" # go to env dotfiles
|
|
|
|
alias cdc "d $XDG_CONFIG_HOME" # go to ~/.config
|
|
|
|
alias cdn "d $NOTES_PATH"
|
|
|
|
alias cdl "d $NICE_HOME/dl"
|
|
|
|
alias cdg "d $NICE_HOME/games"
|
2020-01-16 17:01:59 -06:00
|
|
|
|
|
|
|
# quick parent-directory aliases
|
2020-01-23 09:51:03 -06:00
|
|
|
alias .. "d .."
|
|
|
|
alias ... "d ../.."
|
|
|
|
alias .... "d ../../.."
|
|
|
|
alias ..... "d ../../../.."
|
|
|
|
alias ...... "d ../../../../.."
|
|
|
|
alias ....... "d ../../../../../.."
|
|
|
|
alias ........ "d ../../../../../../.."
|
|
|
|
alias ......... "d ../../../../../../../.."
|
2020-01-16 17:01:59 -06:00
|
|
|
|
|
|
|
# tmux aliases
|
|
|
|
# TODO: see if this can be worked around?
|
|
|
|
alias tmnew "tmux new -s"
|
|
|
|
alias tmls "tmux list-sessions"
|
|
|
|
alias tmatt "tmux attach -t"
|
|
|
|
alias tu "tmux attach -t utils || tmux new -s utils"
|
|
|
|
alias tdf "tmux attach -t dotfiles || tmux new -s dotfiles -c $DOTFILES_PATH"
|
|
|
|
alias tmon "tmux attach -t monitoring || tmux new -s monitoring"
|
|
|
|
alias tcom "tmux attach -t comms || tmux new -s comms"
|
|
|
|
alias tn "tmux attach -t notes || tmux new -s notes -c $NOTES_PATH"
|
|
|
|
alias tm "tmux attach -t music || tmux new -s music"
|
|
|
|
|
|
|
|
# git aliases
|
|
|
|
# TODO: make these git aliases in the gitconfig?
|
|
|
|
function g
|
2020-01-23 09:51:03 -06:00
|
|
|
if scount $argv
|
2020-01-16 17:01:59 -06:00
|
|
|
git $argv
|
|
|
|
else
|
|
|
|
git status
|
|
|
|
end
|
|
|
|
end
|
|
|
|
alias gs "git status"
|
2020-02-12 11:13:46 -06:00
|
|
|
alias gd "git diff"
|
2020-02-12 09:46:01 -06:00
|
|
|
alias gds "gd --staged"
|
2020-01-16 17:01:59 -06:00
|
|
|
# alias gdv "git dv" # TODO: what is this?
|
|
|
|
alias gpl "git pull"
|
2020-03-06 15:43:01 -06:00
|
|
|
alias ga "git add"
|
|
|
|
alias gcm "git commit -m"
|
|
|
|
alias gco "git checkout"
|
2020-01-16 17:01:59 -06:00
|
|
|
alias gp "git push"
|
|
|
|
alias gpa "git push --all && git push --tags"
|
|
|
|
alias gpt "git push && git push --tags"
|
|
|
|
alias gpf "git push --force-with-lease"
|
|
|
|
alias gac "git add -A && git commit"
|
|
|
|
alias gacnv "git add -A && git commit --no-verify"
|
|
|
|
alias gsur "git submodule update --remote"
|
|
|
|
alias glf "git ls-files"
|
|
|
|
alias gl "git log --pretty=format:\"%h %ad%x09%an%x09%s\" --date=short"
|
|
|
|
|
|
|
|
# docker aliases
|
|
|
|
alias dlf "docker logs --tail=500 -f"
|
|
|
|
alias dclf "docker-compose logs --tail=500 -f"
|
|
|
|
alias ctop "docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest"
|
|
|
|
|
|
|
|
# misc aliases
|
2020-03-06 15:43:01 -06:00
|
|
|
function pp
|
|
|
|
while not ping -n 1 -t 5 8.8.8.8
|
|
|
|
sleep 1
|
|
|
|
end
|
|
|
|
end
|
2020-01-16 17:01:59 -06:00
|
|
|
alias p "ping 8.8.8.8"
|
|
|
|
alias C "clear && clear"
|
|
|
|
alias r "ranger"
|
|
|
|
alias rn "/usr/bin/watch -n 1"
|
|
|
|
alias sctl "sudo systemctl"
|
|
|
|
alias sctlu "systemctl --user"
|
|
|
|
alias logs "sudo journalctl"
|
|
|
|
alias logsr "sudo journalctl -r"
|
|
|
|
alias logsf "sudo journalctl -f"
|
|
|
|
alias bt "sudo bluetoothctl"
|
|
|
|
alias btctl "bt"
|
|
|
|
alias btctl "sudo bluetoothctl"
|
|
|
|
alias pbcopy "clip"
|
|
|
|
alias pt "htop -t" # experimental htop tree-view-by-default
|
2020-01-20 10:49:06 -06:00
|
|
|
alias resrc "source $XDG_CONFIG_HOME/fish/config.fish"
|
2020-01-16 17:01:59 -06:00
|
|
|
alias redshift "redshift -r -l 39.0997:-94.5786 -t 6500K:2500K"
|
|
|
|
alias gpmdpe "electron --app=/usr/share/gpmdp/resources/app.asar"
|
|
|
|
alias t "task"
|
|
|
|
alias sc "sc-im"
|
|
|
|
alias scs "sc-im $NOTES_PATH/_scratch.sc"
|
|
|
|
alias disks "lsblk && df -h"
|
|
|
|
alias dd "dd status=progress"
|
|
|
|
alias wifi "sudo nmtui"
|
|
|
|
alias year 'cal (date +%Y)'
|
|
|
|
alias y year
|
2020-01-20 14:01:06 -06:00
|
|
|
alias pa pulsemixer
|
2020-02-12 11:13:46 -06:00
|
|
|
alias vd vdiff
|
2020-01-16 17:01:59 -06:00
|
|
|
|
|
|
|
# games aliases
|
|
|
|
# this sometimes fixes steam dynamic library issues?
|
|
|
|
alias lsteam "env LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' steam"
|
|
|
|
|
|
|
|
# override the man commands with vim
|
|
|
|
alias _man "\\man"
|
|
|
|
alias man "vman"
|
|
|
|
|
|
|
|
# neomutt is better
|
|
|
|
alias mutt "neomutt"
|
2020-01-22 17:25:47 -06:00
|
|
|
alias mail "mutt"
|
2020-01-16 17:01:59 -06:00
|
|
|
|
|
|
|
# fsw aliases
|
|
|
|
alias fsw-mix-test 'fsw "mix test" ./**/*.{ex,exs,erl,hrl,xrl,yrl}'
|
|
|
|
|
2020-01-23 09:51:03 -06:00
|
|
|
function field
|
|
|
|
not scount $argv && echo "No field index provided"; exit 1
|
|
|
|
awk "{print \$$argv[1]}"
|
|
|
|
end
|
|
|
|
|
2020-01-16 17:01:59 -06:00
|
|
|
# weechat aliases
|
|
|
|
function chat
|
2020-01-20 09:12:52 -06:00
|
|
|
set -l pass (pass config/weechat-passphrase | head -n 1)
|
2020-01-22 17:25:47 -06:00
|
|
|
env WEECHAT_PASSPHRASE=$pass weechat
|
2020-01-16 17:01:59 -06:00
|
|
|
end
|