dotfiles

Configuration dotfiles
git clone git://git.wimdupont.com/dotfiles.git
Log | Files | Refs | README | LICENSE

commit 746efbca5388dd82b5293d3f7ca5adb7e3898632
parent 33f7f093b8b43cc3a083c5e492d88231c003e5ef
Author: Wim Dupont <wim@wimdupont.com>
Date:   Sun,  5 May 2024 18:57:17 +0200

added bashrc

Diffstat:
A.bashrc | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+), 0 deletions(-)

diff --git a/.bashrc b/.bashrc @@ -0,0 +1,79 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +set -o vi + +shopt -s histappend # append to history, don't overwrite it +export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" + +GPG_TTY=$(tty) +export GPG_TTY + +export EDITOR=vim + +# requires arc-gtk-theme package +export GTK_THEME=Arc-Dark + +lf () { + # `command` is needed in case `lfcd` is aliased to `lf` + cd "$(command lf -print-last-dir "$@")" +} + +# run single ssh-agent and cache keys for x duration +if ! pgrep -u "$USER" ssh-agent > /dev/null; then + test ! -f "$XDG_RUNTIME_DIR/ssh-agent.env" && touch "$XDG_RUNTIME_DIR/ssh-agent.env" + ssh-agent -t 30m > "$XDG_RUNTIME_DIR/ssh-agent.env" +fi +if [[ ! -f "$SSH_AUTH_SOCK" ]]; then + source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null +fi + +function ts() { + date -d @$1 "+%F %r" +} + +function gitbig(){ + git rev-list --objects --all | + git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | + sed -n 's/^blob //p' | + sort --numeric-sort --key=2 | + cut -c 1-12,41- | + $(command -v gnumfmt || echo numfmt) --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest +} + +function rssf(){ + url="$1"; curl -L -s "$url" | sfeed_web "$url" +} + +function findstr(){ + grep -Rnw . -e "$1" +} + +function vimis(){ + sudo vim $(whereis $1 | cut -d ' ' -f2) +} + +function irc(){ + username=$1 + test -z "$username" && echo "Username?" && read username + tmux new-session -d -s irc && tmux send-keys -t irc "ii -s irc.libera.chat -n $username" Enter +} + +alias ls='ls --color=auto' +alias ll='ls -l' +alias weather='curl wttr.in' +alias bt='bluetoothctl' +alias r='lf' +alias wifi='nmcli radio wifi' +alias todo='vim ~/authored/.todo.adoc' +alias signal-cli='sh ~/Downloads/signal-cli/signal-cli.sh' +alias lg='lazygit' +alias rss='export SFEED_URL_FILE="$HOME/.sfeed/urls" && [ -f "$SFEED_URL_FILE" ] || touch "$SFEED_URL_FILE" && sfeed_curses ~/.sfeed/feeds/*' +alias rssu='sfeed_update ~/.sfeed/sfeedrc' +alias rsse='vim ~/.sfeed/sfeedrc' + +PS1='[\u@\h \W]\$ '