From b538219e088f30382452a57cbb86e8bade2bc422 Mon Sep 17 00:00:00 2001 From: Eric Renfro Date: Thu, 14 Mar 2024 21:25:23 -0400 Subject: [PATCH] Added .shell-includes and updated .bashrc to them --- .bashrc | 31 ++++++++++++++++--------------- .shell-aliases | 29 +++++++++++++++++++++++++++++ .shell-common | 12 ++++++++++++ .shell-env | 31 +++++++++++++++++++++++++++++++ 4 files changed, 88 insertions(+), 15 deletions(-) create mode 100644 .shell-aliases create mode 100644 .shell-common create mode 100644 .shell-env diff --git a/.bashrc b/.bashrc index 420f48d..737ded1 100644 --- a/.bashrc +++ b/.bashrc @@ -5,26 +5,27 @@ # If not running interactively, don't do anything [[ $- != *i* ]] && return -#alias ls='ls --color=auto' -alias ls='lsd' -alias grep='grep --color=auto' +# Source global definitions +test -r /etc/bashrc && . /etc/bashrc + +test -r ~/.shell-env && . ~/.shell-env +test -r ~/.shell-aliases && . ~/.shell-aliases +test -r ~/.shell-common && . ~/.shell-common + PS1='[\u@\h \W]\$ ' +test -r ~/.bashrc.local && . ~/.bashrc.local -if [[ "$XDG_CURRENT_DESKTOP" = "KDE" ]]; then - export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR:-/run/user/$UID}/ssh-agent.socket" - export SSH_ASKPASS="/usr/bin/ksshaskpass" -else - export SSH_AUTH_SOCK="${XDG_RUNTIME_DIR:-/run/user/$UID}/gcr/ssh" +if command -v fzf-share >/dev/null; then + source "$(fzf-share)/key-bindings.bash" + source "$(fzf-share)/completion.bash" fi +## Load External Components + +eval "$(direnv hook bash)" eval "$(starship init bash)" - -if [[ ! -r "$HOME/.local/share/blesh/ble.sh" ]]; then - git clone --recursive --depth 1 --shallow-submodules https://github.com/akinomyoga/ble.sh.github - make -C ble.sh install PREFIX="$HOME/.local" - rm -rf ble.sh -fi - source ~/.local/share/blesh/ble.sh eval "$(atuin init bash)" +#eval "$(keychain --eval --quiet --eval --systemd id_ed25519 id_rsa)" + diff --git a/.shell-aliases b/.shell-aliases new file mode 100644 index 0000000..b3fa4c8 --- /dev/null +++ b/.shell-aliases @@ -0,0 +1,29 @@ +# vim: set ft=sh sw=2 et : +alias dos2unix='sed "s/%//"' + +alias tmux='tmux -2' + +if command -v vim >/dev/null 2>&1; then + alias vi=vim +fi +if command -v nvim >/dev/null 2>&1; then + alias vim=nvim + alias vi=nvim +fi + +alias ls='ls --color=auto' +alias ll='\ls -l' +alias lla='\ls -la' +alias lt='\ls --color=auto -lhFart' +if command -v lsd >/dev/null 2>&1; then + alias ls='lsd' + alias ll='lsd -l' + alias lla='lsd -la' +fi + +alias grep='grep --color=auto' + +if [[ -n "$TMUX" ]]; then + alias fzf='fzf-tmux' +fi + diff --git a/.shell-common b/.shell-common new file mode 100644 index 0000000..7af654d --- /dev/null +++ b/.shell-common @@ -0,0 +1,12 @@ +# vim: set ft=sh sw=2 et : + +# make less more friendly for non-text input files, see lesspipe(1) +command -v lesspipe.sh >/dev/null 2>&1 && eval "$(SHELL=/bin/sh lesspipe.sh)" + +# enable color support of ls and also add handy aliases +if command -v dircolors >/dev/null 2>&1; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" +fi + +test -r ~/.shell-common.local && source ~/.shell-common.local + diff --git a/.shell-env b/.shell-env new file mode 100644 index 0000000..8470bbb --- /dev/null +++ b/.shell-env @@ -0,0 +1,31 @@ +# vim: set ft=sh sw=2 et : + +## +## Editors +## +if [ -x "$(command -v nvim")" ]; then + export EDITOR=nvim + export MANPAGER='nvim +Man!' +elif [ -x "$(command -v micro)" ]; then + export EDITOR=micro + export MANPAGER=less +else + export EDITOR=vim + export MANPAGER=less +fi + +export GIT_EDITOR="$EDITOR" +export USE_EDITOR="$EDITOR" +export VISUAL=$EDITOR + +## +## Pager +## +export PAGER=less +export LESS='-iFMRSX -x4' + +if [ -f "$HOME/.shell-env.local" ]; then + . "$HOME/.shell-env.local" +fi + +umask 022