bash: remove unnecessary, update the rest; zsh: minor tweaks

test_branch
Von Random 3 months ago
parent ec982fd1b0
commit cfa47c3630
  1. 51
      bashrc
  2. 7
      zsh/functions.zsh
  3. 2
      zsh/prompt-powerline.zsh

@ -2,7 +2,6 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# {{{ settings
HISTSIZE=1000
HISTFILE="$HOME/.bash_history.$UID"
HISTCONTROL=ignoredups
@ -13,21 +12,14 @@ export PAGER=less
export EDITOR=vim
export TIME_STYLE=long-iso
export SSH_AUTH_SOCK="$HOME/.ssh/ssh_auth_sock"
# }}}
# {{{ prompt
prompt_command() {
case "$TERM" in
(screen*) printf '\ek%s\e\\' "${HOSTNAME%%.*}";;
(*) printf '\e]0;%s\a' "${HOSTNAME%%.*}";;
esac
}
((UID)) && ps_clr=4 || ps_clr=1
((UID)) && ps_clr=53 || ps_clr=52
# just a colored version of [ $USER $HOSTNAME:$CWD ]
printf -v PS1 '\\[\\e[0m\\][ \\[\\e[3%sm\\]\\u\\[\\e[0m\\] \\h:\\[\\e[32m\\w\\[\\e[0m\\] ]\n\\$ ' $ps_clr
printf -v PS1 '\\[\\e[0m\\]\\[\\e[48;5;%sm\\] \\u \\[\\e[48;5;237m\\] \\h \\[\\e[48;5;234m \\w \\[\\e[0m\\]\n\\$ ' $ps_clr
unset ps_clr
PROMPT_COMMAND=prompt_command
# }}}
# {{{ aliases
unalias ls ld ll 2>/dev/null
beep() { printf "\007"; }
fixterm() { printf "c"; }
@ -38,7 +30,8 @@ whence() { command -v "$@"; }
# ls
ls() { command ls --color=auto --group-directories-first "$@"; }
ll() { command ls -lha --color=auto --group-directories-first "$@"; }
ll() { ls -alh "$@"; }
ll() { ls -dlh "$@"; }
# git
gci() { command git commit "$@"; }
@ -56,36 +49,10 @@ atmux() { tmux attach; }
# sudo
sush() { command sudo -Es; }
# vim
vi() { command vim "$@"; }
# }}}
# {{{ plugins and traps
# bash-completion
completion_path='/usr/share/bash-completion/bash_completion'
[[ -r "$completion_path" ]] && source "$completion_path"
# grc
if [[ -x $(command -v grc) ]]; then
cmds=(\
cc configure cvs df diff dig gcc gmake id ip last lsof make mount \
mtr netstat ping ping6 ps tcpdump traceroute traceroute6 \
)
for cmd in "${cmds[@]}"; do
alias $cmd="command grc -es --colour=auto $cmd"
done
unset cmds cmd
fi
# some cool git stuff
gdiff() { /usr/bin/git diff --color "$@"; }
gdf() {
local difftool
if difftool=$(command -v sdiff-so-fancy); then
gdiff "$@" | "$difftool" | less --tabs=4 -RSFX
else
gdiff "$@"
fi
}
# we want to see exit code on error (it also has to be the last entry here)
trap_msg='\e[31m>>\e[0m exit \e[31m%s\e[0m\n'
trap 'printf "$trap_msg" "$?" >&2' ERR
# }}}

@ -1,5 +1,5 @@
# some distributions love to force some aliases upon user :<
unalias ls ll ld 2>/dev/null
unalias ls ld ll 2>/dev/null
beep() { printf $'\007' }
fixterm() { printf $'c' }
@ -15,7 +15,7 @@ if [[ -x $(whence -p exa) ]]; then
ll() { ls -alg $@ }
ld() { ls -dlg $@ }
else
ls() { command ls --color=auto $@ }
ls() { command ls --color=auto --group-directories-first $@ }
ll() { ls -alh $@ }
ld() { ls -dlh $@ }
fi
@ -56,9 +56,6 @@ atmux() { tmux attach || tmux }
# sudo
sush() { command sudo -Es }
# vim
vi() { command vim $@ }
# grc
if [[ -x $(whence -p grc) ]]; then
cmds=(\

@ -20,8 +20,8 @@ typeset -A prompt_symbols=(
typeset -A prompt_colors=(
fg 15
user 53
ssh 90
root 52
ssh 90
host 237
cwd 234
ro 124

Loading…
Cancel
Save