66 lines
1.9 KiB
Bash
66 lines
1.9 KiB
Bash
#!/usr/bin/env sh
|
|
|
|
#
|
|
# Bash / ZSH aliases and customizations
|
|
#
|
|
|
|
# Shell options
|
|
|
|
HISTSIZE=100000
|
|
HISTFILE="$HOME/.cache/shell_history"
|
|
|
|
## COMMAND CONFIGURATION
|
|
|
|
# Completion for existing commands
|
|
|
|
alias cp="cp -i --reflink=auto"
|
|
alias grep="grep --color=auto"
|
|
alias dd='dd status=progress'
|
|
alias rm='rm -v --one-file-system'
|
|
alias free='free -m'
|
|
alias diff='diff --color=auto'
|
|
alias dmesg='dmesg --ctime'
|
|
alias wget='wget --hsts-file $HOME/.cache/wget-hsts'
|
|
|
|
# [ -f ~/.local/bin/colorSchemeApplyFzf ] && . ~/.local/bin/colorSchemeApplyFzf # Only applies RGB colors...
|
|
POWERLINE_GO_DEFAULT_OPTS=(-colorize-hostname -max-width 25 -cwd-max-dir-size 10 -modules 'user,host,venv,cwd,perms,git' -modules-right 'jobs,exit,duration,load') # For reading by shell profiles
|
|
FZF_DEFAULT_OPTS="--height 40% --layout=default"
|
|
FZF_CTRL_T_OPTS="--preview '[[ -d {} ]] && ls -l --color=always {} || [[ \$(file --mime {}) =~ binary ]] && file --brief {} || (highlight -O ansi -l {} || coderay {} || rougify {} || cat {}) 2> /dev/null | head -500'"
|
|
FZF_COMPLETION_OPTS="${FZF_CTRL_T_OPTS}"
|
|
|
|
# Colored ls
|
|
_colored_ls() {
|
|
\ls -lh --color=always $@ | awk '
|
|
BEGIN {
|
|
FPAT = "([[:space:]]*[^[:space:]]+)";
|
|
OFS = "";
|
|
}
|
|
{
|
|
$1 = "\033[36m" $1 "\033[0m";
|
|
$2 = "\033[31m" $2 "\033[0m";
|
|
$3 = "\033[32m" $3 "\033[0m";
|
|
$4 = "\033[32m" $4 "\033[0m";
|
|
$5 = "\033[31m" $5 "\033[0m";
|
|
$6 = "\033[34m" $6 "\033[0m";
|
|
$7 = "\033[34m" $7 "\033[0m";
|
|
print
|
|
}
|
|
'
|
|
}
|
|
alias ll="_colored_ls"
|
|
alias la="_colored_ls -a"
|
|
|
|
# To keep until https://github.com/openssh/openssh-portable/commit/f64f8c00d158acc1359b8a096835849b23aa2e86
|
|
# is merged
|
|
function _ssh {
|
|
if [ "${TERM}" = "alacritty" ]
|
|
then
|
|
TERM=xterm-256color ssh "$@"
|
|
else
|
|
ssh "$@"
|
|
fi
|
|
}
|
|
alias ssh='_ssh'
|
|
|
|
## FUNCTIONS
|