This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/apps/shell/fish/aliases.fish

129 lines
3.2 KiB
Fish
Raw Normal View History

2020-01-16 17:01:59 -06:00
#!/usr/bin/env fish
# TODO: exa?
2020-01-16 17:01:59 -06:00
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 la 'll -A' # show all
# TODO: cat > bat
2020-01-16 17:01:59 -06:00
alias tree 'tree -Csuh'
alias f fzf
alias t "tmux"
2020-11-06 11:16:29 -06:00
alias rcp 'rsync -r -ah --progress'
2020-01-16 17:01:59 -06:00
2020-11-22 00:21:37 -06:00
function r --wraps nnn --description 'support nnn quit and change directory'
set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd"
nnn -P p $argv
test -e $NNN_TMPFILE && source $NNN_TMPFILE && rm $NNN_TMPFILE
end
2020-11-05 21:13:39 -06:00
alias vltl "$EDITOR (ltl)"
2020-01-16 17:01:59 -06:00
alias cdltl "cd (ltld)"
2020-11-05 21:13:39 -06:00
function d -w cd --description "Quickly jump to NICE_HOME (or given dir) and show files."
if scount $argv
cd $argv || exit 1
2020-01-16 17:01:59 -06:00
else
cd $NICE_HOME || exit 1
end
la
2020-01-16 17:01:59 -06:00
end
# navigation aliases
2020-11-06 11:50:32 -06:00
function c --description "Quickly jump to a subdirectory of NICE_HOME (or just to NICE_HOME if none given)"
if scount $argv
cd $NICE_HOME && d $argv || exit 1
else
d $NICE_HOME
end
end
2020-11-06 11:50:32 -06:00
complete --erase --command c
2020-11-20 21:40:10 -06:00
complete --command c -a \
"(pushd $NICE_HOME && fd . . --max-depth 1 --min-depth 1 -x ls -p && popd)"
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"
2020-11-05 21:13:39 -06:00
alias cdl "d $XDG_DOWNLOAD_DIR"
alias cdg "d $XDG_GAMES_DIR"
alias cdnx "d $DOTFILES_PATH/env/nix"
2020-01-16 17:01:59 -06:00
# quick parent-directory aliases
alias .. "d .."
alias ... "d ../.."
alias .... "d ../../.."
alias ..... "d ../../../.."
alias ...... "d ../../../../.."
alias ....... "d ../../../../../.."
alias ........ "d ../../../../../../.."
alias ......... "d ../../../../../../../.."
2020-01-16 17:01:59 -06:00
function g -w git
if scount $argv
2020-01-16 17:01:59 -06:00
git $argv
else
git status
end
end
# 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" # TODO: this should clear a tmux pane's scrollback/logs
2020-11-20 21:40:10 -06:00
alias l "nnn"
2020-01-16 17:01:59 -06:00
alias sctl "sudo systemctl"
alias sctlu "systemctl --user"
2020-11-21 23:13:58 -06:00
# TODO: a vi-like tui for bluetooth would be great
alias bt "sctl start bluetooth && sudo bluetoothctl"
2020-01-16 17:01:59 -06:00
alias btctl "bt"
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 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 svim "sudo -E nvim"
2020-01-16 17:01:59 -06:00
alias year 'cal (date +%Y)'
alias mount 'sudo -E mount'
2020-01-20 14:01:06 -06:00
alias pa pulsemixer
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
2020-04-21 16:38:58 -05:00
2020-07-02 11:17:42 -05:00
function rgl
# ripgrep | less
rg --color always $argv | less -r
end
# kubernetes aliases
alias k "kubectl"
alias kg "k get"
2020-04-21 16:38:58 -05:00
# grep aliases
alias rg "rg --text"
alias grep "rg"
2020-11-05 22:29:58 -06:00
alias vim nvim
alias vi nvim
2020-11-22 00:21:37 -06:00
alias v nvim
2020-11-05 22:29:58 -06:00