Files
dotfiles/shell/.config/shellconfig/aliases.sh
T

87 lines
1.7 KiB
Bash

alias v=nvim
alias k=kak
alias hs='history $HISTSIZE | rg'
alias kc='kak -c "$(kak -l | kff)"'
alias kf='fd -t f | kff | xargs kd'
alias kh='fd -H -t f | kff | xargs kd'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias tl='tmux list-sessions'
alias rgh='rg -.'
alias fdh='fd -H'
alias lg=lazygit
alias z='cd $(fd -t d --one-file-system . ~ | kff)'
eval $(dircolors)
alias nocaps='setxkbmap pl -option ctrl:nocaps'
alias fixdp='xrandr --output DP-0 --right-of DP-2'
alias a4='COLORTERM=truecolor TERM=xterm-256color a4'
a4i() {
local Q="${@:-}"
local NAME=$(a4 -l | grep '^ ' | fzy -q "$Q" | tr '\t' ' ' | cut -d' ' -f6-)
if [ -n "$NAME" ]; then
a4 -a "$NAME"
fi
}
tn() {
if [ $# -eq 0 ]; then
tmux new
else
tmux new -A -s "$@"
fi
}
tni() {
local Q="${@:-}"
local DIR=$(zoxide query -l | vis-menu -p 'Dir:' -l 10 "$Q")
if [ -n "$DIR" ]; then
local NAME=$(echo | vis-menu -p 'Session name:' $(basename $DIR))
if [ -n "$DIR" ]; then
tmux new -A -s "$NAME" -c "$DIR"
fi
fi
}
ta() {
if [ $# -eq 0 ]; then
tmux attach
else
tmux attach -t "$@"
fi
}
tai() {
local Q="${@:-}"
local NAME=$(tmux ls | vis-menu -p 'Session:' -l 10 "$Q" | cut -d: -f1)
if [ -n "$NAME" ]; then
tmux attach -t "$NAME"
fi
}
vf() {
if [ "$TERM" = "xterm-kitty" ]; then
local FILE=$(kitten choose-file)
[ -n "$FILE" ] && nvim "$FILE"
else
nvim $(fzf --multi)
fi
}
vd() {
if [ "$TERM" = "xterm-kitty" ]; then
local DIR=$(kitten choose-file --mode dir)
[ -n "$DIR" ] && ( cd "$DIR" && exec nvim )
else
local DIR=$(fzf --walker dir,follow,hidden)
[ -n "$DIR" ] && ( cd "$DIR" && exec nvim )
fi
}
vz() {
local DIR=$(zoxide query -l | fzf --query "$Q")
[ -n "$DIR" ] && ( cd "$DIR" && exec nvim )
}