From 8a140dc9d399222a46816f67d615bbf9c734f020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 11 Feb 2024 14:35:57 +0100 Subject: clean up bashrc --- bashrc | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/bashrc b/bashrc index e333935..82ce142 100644 --- a/bashrc +++ b/bashrc @@ -1,4 +1,4 @@ -#! /bin/bash +#! /usr/bin/env bash # PROMPT function parse_git_branch() @@ -8,19 +8,13 @@ function parse_git_branch() export PS1='\[\033[01;33m\]\u\[\033[01;35m\]@\[\033[00;31m\]\h\[\033[00m\]:\[\033[0;33m\] \W \[\033[01;35m\]$(parse_git_branch)\[\033[0;33m\] \[\033[0m\]\$ ' unset PROMPT_COMMAND -# COLORS -if [ -r /usr/share/terminfo/x/xterm-256color ] -then - export TERM='xterm-256color' -else - export TERM='xterm-color' -fi -[ -r ~/.dir_colors ] && eval $(dircolors ~/.dir_colors) +# LS COLORS +[ -r ~/.dir_colors ] && eval "$(dircolors ~/.dir_colors)" alias ls="ls --color=auto -F -b -T 0" -alias ll="ls -l --color=auto -F -b -T 0" +alias la="ls -l --color=auto -F -b -T 0" # BELL -[ ! -z $DISPLAY ] && xset b 0 +[ -n "$DISPLAY" ] && xset b 0 # VIMMODE set -o vi @@ -30,8 +24,8 @@ export QT_FONT_DPI=100 export QT_SCALE_FACTOR=1 # ENV -HOME_=$(readlink -f ${HOME%/}) -export PATH=${HOME_}/bin:${PATH#${HOME_}/bin:} +HOME_=$(readlink -f "${HOME%/}") +export PATH=${HOME_}/bin:${PATH#"${HOME_}/bin:"} export EDITOR=nvim export GEM_HOME="${HOME_}/.gem/ruby/3.0.0" export PATH=$PATH:$GEM_HOME/bin @@ -40,8 +34,8 @@ export MPD_HOST=fakenews # catch and eval dmalloc output #function dmalloc { eval `command dmalloc -b $*`; } alias vim=nvim -alias gvim='nvim --listen godothost .' alias vimdiff="nvim -d" +alias gvim='nvim --listen godothost .' alias sf='systemctl --user restart pipewire*' alias fuck='eval $(thefuck $(fc -ln -1)); history -r' alias tt='clear && task' @@ -50,6 +44,7 @@ alias ki='khal interactive' alias zz='clear && khal calendar && task -old' alias ddu='zcat ~/.cache/ncdu-data.gz | ncdu -f-' alias cc='cd $(find ~/usr ~/_wip -type d | fzy)' +alias cl='clean .' # FUNCTIONS function lip () { # local ips @@ -61,7 +56,7 @@ function xip () { # external ip } function rman () { # centered man - env COLUMNS=$(($COLUMNS/3*2)) man "${@}" | pr -o $((COLUMNS/3/2)) | less + env COLUMNS=$((COLUMNS*2/3)) man "${@}" | pr -o $((COLUMNS/2/3)) | less } function xcon () { # external established connections @@ -71,12 +66,10 @@ function xcon () { # external established connections } # SSH -ssh-add -l &>/dev/null -if [ $? -ne 0 ] +if ! (ssh-add -l &>/dev/null) then [ -r ~/.ssh/agent ] && eval "$(<~/.ssh/agent)" >/dev/null - ssh-add -l &>/dev/null - if [ $? -ne 0 ] + if ! (ssh-add -l &>/dev/null) then (umask 066; ssh-agent > ~/.ssh/agent) eval "$(<~/.ssh/agent)" >/dev/null -- cgit v1.1-2-g2b99