2017-02-07 16:16:45 -06:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# filesystem 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
|
|
|
|
alias tree='tree -Csuh'
|
2018-08-31 09:27:45 -05:00
|
|
|
alias f='fzf'
|
2018-09-25 21:32:34 -05:00
|
|
|
alias cp="rsync -ah --progress"
|
2018-11-12 08:44:57 -06:00
|
|
|
alias year="cal $(date +%Y)"
|
2017-02-07 16:16:45 -06:00
|
|
|
|
2019-10-11 11:57:13 -05:00
|
|
|
# gets the newest function for the current directory (or the specified directory
|
|
|
|
# if one is provided)
|
|
|
|
function ltl() {
|
|
|
|
local d="${1-$PWD}"
|
|
|
|
unset -v l
|
|
|
|
for f in "$d"/*; do
|
|
|
|
[[ $f -nt $l ]] && [[ ! -d $f ]] && l="$f"
|
|
|
|
done
|
|
|
|
echo "$l"
|
|
|
|
}
|
|
|
|
|
2019-12-31 10:15:01 -06:00
|
|
|
function ltld() {
|
|
|
|
local d="${1-$PWD}"
|
|
|
|
unset -v l
|
|
|
|
for f in "$d"/*; do
|
|
|
|
[[ $f -nt $l ]] && [[ -d $f ]] && l="$f"
|
|
|
|
done
|
|
|
|
echo "$l"
|
|
|
|
}
|
|
|
|
|
2019-10-11 11:57:13 -05:00
|
|
|
alias vltl="vim \"\$(ltl)\""
|
2019-12-31 10:15:01 -06:00
|
|
|
alias cdltl="cd \"\$(ltld)\""
|
2019-11-02 19:42:38 -05:00
|
|
|
alias ltlv="vltl"
|
2019-10-11 11:57:13 -05:00
|
|
|
|
2017-02-07 16:16:45 -06:00
|
|
|
# navigation aliases
|
2018-08-09 09:40:14 -05:00
|
|
|
function c() {
|
|
|
|
if [[ -n $1 ]]; then
|
|
|
|
cd "${NICE_HOME}" || exit 1
|
|
|
|
else
|
2018-10-19 01:17:08 -05:00
|
|
|
cd "${NICE_HOME}" && cd "${1}" || exit 1
|
2018-08-09 09:40:14 -05:00
|
|
|
fi
|
|
|
|
}
|
2017-02-07 16:16:45 -06:00
|
|
|
alias cd..="cd .."
|
2018-04-06 17:28:31 -05:00
|
|
|
alias cdd="cd \"\$DOTFILES_PATH\"" # go to dotfiles
|
2019-12-31 10:15:01 -06:00
|
|
|
alias cde="cd \"\$ENV_DOTFILES_PATH\"" # go to env dotfiles
|
|
|
|
alias cdc="cd \"\$XDG_CONFIG_HOME\"" # go to ~/.config
|
2018-11-03 14:17:39 -05:00
|
|
|
alias cdn="cd \"\$NOTES_PATH\""
|
2019-08-06 12:33:23 -05:00
|
|
|
alias cdl="cd \"\$NICE_HOME/dl\""
|
2019-08-23 09:45:26 -05:00
|
|
|
alias cdg="cd \"\$NICE_HOME/games\""
|
2018-08-09 09:40:14 -05:00
|
|
|
|
2017-02-07 16:16:45 -06:00
|
|
|
# quick parent-directory aliases
|
|
|
|
alias ..="cd .."
|
|
|
|
alias ...="cd ../.."
|
|
|
|
alias ....="cd ../../.."
|
|
|
|
alias .....="cd ../../../.."
|
|
|
|
alias ......="cd ../../../../.."
|
|
|
|
alias .......="cd ../../../../../.."
|
|
|
|
alias ........="cd ../../../../../../.."
|
|
|
|
alias .........="cd ../../../../../../../.."
|
|
|
|
|
|
|
|
# tmux aliases
|
|
|
|
# TODO: see if this can be worked around?
|
|
|
|
alias tmux='TERM=screen-256color-bce tmux' # syntax higlighting for vim in tmux
|
|
|
|
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"
|
2018-04-06 17:28:31 -05:00
|
|
|
alias tdf="tmux attach -t dotfiles || tmux new -s dotfiles -c \"\$DOTFILES_PATH\""
|
2018-04-09 08:34:38 -05:00
|
|
|
alias tmon="tmux attach -t monitoring || tmux new -s monitoring"
|
2018-07-05 09:47:46 -05:00
|
|
|
alias tcom="tmux attach -t comms || tmux new -s comms"
|
2019-05-08 13:31:23 -05:00
|
|
|
alias tn="tmux attach -t notes || tmux new -s notes -c \"\$NOTES_PATH\""
|
2019-08-13 16:18:27 -05:00
|
|
|
alias tm="tmux attach -t music || tmux new -s music"
|
2017-02-07 16:16:45 -06:00
|
|
|
|
|
|
|
# git aliases
|
2017-11-14 17:31:30 -06:00
|
|
|
# TODO: make these git aliases in the gitconfig?
|
2019-08-10 21:40:35 -05:00
|
|
|
g() {
|
|
|
|
if [[ $# == '0' ]]; then
|
|
|
|
git status
|
|
|
|
else
|
|
|
|
git $*
|
|
|
|
fi
|
|
|
|
}
|
2017-02-07 16:16:45 -06:00
|
|
|
alias gs="git status"
|
2019-02-04 01:43:53 -06:00
|
|
|
alias gd="git diff"
|
2019-07-03 13:42:36 -05:00
|
|
|
alias gds="git diff --staged"
|
2019-08-10 21:40:35 -05:00
|
|
|
# alias gdv="git dv" # TODO: what is this?
|
2017-02-07 16:16:45 -06:00
|
|
|
alias gpl="git pull"
|
2018-10-31 14:40:57 -05:00
|
|
|
alias gp="git push"
|
|
|
|
alias gpa="git push --all && git push --tags"
|
2019-08-13 16:18:27 -05:00
|
|
|
alias gpt="git push && git push --tags"
|
2019-08-10 21:40:35 -05:00
|
|
|
alias gpf="git push --force-with-lease"
|
2017-03-16 14:17:16 -05:00
|
|
|
alias gac="git add -A && git commit"
|
2019-11-28 08:22:41 -06:00
|
|
|
alias gacnv="git add -A && git commit --no-verify"
|
2017-11-14 17:31:30 -06:00
|
|
|
alias gsur="git submodule update --remote"
|
2018-08-31 09:27:45 -05:00
|
|
|
alias glf="git ls-files"
|
2019-03-06 12:20:34 -06:00
|
|
|
alias gl="git log --pretty=format:\"%h %ad%x09%an%x09%s\" --date=short"
|
2017-02-07 16:16:45 -06:00
|
|
|
|
2019-01-29 08:08:34 -06:00
|
|
|
# docker aliases
|
|
|
|
alias dlf="docker logs --tail=500 -f"
|
|
|
|
alias dclf="docker-compose logs --tail=500 -f"
|
2019-01-29 08:10:42 -06:00
|
|
|
alias ctop="docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock quay.io/vektorlab/ctop:latest"
|
2019-01-29 08:08:34 -06:00
|
|
|
|
2017-02-07 16:16:45 -06:00
|
|
|
# misc aliases
|
2018-08-09 09:40:14 -05:00
|
|
|
alias p="ping 8.8.8.8"
|
2017-04-25 07:59:41 -05:00
|
|
|
alias C="clear && clear"
|
2017-11-14 17:31:30 -06:00
|
|
|
alias r="ranger"
|
2019-02-22 09:27:43 -06:00
|
|
|
alias rn="/usr/bin/watch -n 1"
|
2018-04-06 17:28:31 -05:00
|
|
|
alias sctl="sudo systemctl"
|
2019-11-12 11:06:20 -06:00
|
|
|
alias sctlu="systemctl --user"
|
|
|
|
alias logs="sudo journalctl"
|
|
|
|
alias logsr="sudo journalctl -r"
|
|
|
|
alias logsf="sudo journalctl -f"
|
2018-08-21 10:02:55 -05:00
|
|
|
alias btctl="sudo bluetoothctl"
|
2019-12-31 10:15:01 -06:00
|
|
|
alias pbcopy="clip"
|
2018-04-06 17:28:31 -05:00
|
|
|
alias pt="htop -t" # experimental htop tree-view-by-default
|
|
|
|
alias resrc="source \$HOME/.bashrc"
|
2018-11-03 14:05:58 -05:00
|
|
|
alias redshift="redshift -r -l 39.0997:-94.5786 -t 6500K:2500K"
|
2018-08-25 01:39:47 -05:00
|
|
|
alias gpmdpe="electron --app=/usr/share/gpmdp/resources/app.asar"
|
2018-10-23 14:37:57 -05:00
|
|
|
alias t="task"
|
2019-02-27 23:29:49 -06:00
|
|
|
alias sc="sc-im"
|
|
|
|
alias scs="sc-im \"\$NOTES_PATH/_scratch.sc\""
|
2019-09-06 14:42:53 -05:00
|
|
|
alias disks="lsblk && df -h"
|
|
|
|
alias dd="dd status=progress"
|
2019-10-31 12:42:25 -05:00
|
|
|
alias wifi="sudo nmtui"
|
2018-08-25 01:39:47 -05:00
|
|
|
|
2017-02-07 16:16:45 -06:00
|
|
|
# games aliases
|
|
|
|
# this sometimes fixes steam dynamic library issues?
|
2018-11-08 07:32:36 -06:00
|
|
|
alias lsteam="LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so' steam"
|
2017-02-07 16:16:45 -06:00
|
|
|
|
2018-11-08 07:32:36 -06:00
|
|
|
# override the man commands with vim
|
2017-02-07 16:16:45 -06:00
|
|
|
alias _man="\\man"
|
|
|
|
alias man="vman"
|
2019-03-19 10:54:11 -05:00
|
|
|
|
|
|
|
# neomutt is better
|
|
|
|
alias mutt="neomutt"
|
2019-09-06 14:42:53 -05:00
|
|
|
|
|
|
|
# fsw aliases
|
|
|
|
alias fsw-mix-test="fsw \"mix test\" ./**/*.{ex,exs,erl,hrl,xrl,yrl}"
|
2019-12-16 17:21:44 -06:00
|
|
|
|
|
|
|
# weechat aliases
|
|
|
|
alias chat="WEECHAT_PASSPHRASE=\"\$(pass weechat-passphrase | head -n 1)\" weechat"
|