From 96452c841afde37ebd223c89358d694fa647983f Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 1 Mar 2023 23:03:36 +0100 Subject: bash: group settings, add separators --- %HOME%/.bashrc | 29 +++++++++++++++++++++++++++-- %HOME%/.profile | 23 +++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/%HOME%/.bashrc b/%HOME%/.bashrc index 71872c5..532ee05 100644 --- a/%HOME%/.bashrc +++ b/%HOME%/.bashrc @@ -13,6 +13,9 @@ esac # Solarized (light): PS1="\[\e[1;35m\]\h\[\e[m\] \[\e[1;36m\]\W\[\e[m\] # \[$(tput sgr0)\]" +# ----------------------------------------------------------------------------- +# Command history +# ----------------------------------------------------------------------------- # `echo "!)"` doesn't work otherwise (namely, in third-party scripts): set +o histexpand @@ -20,6 +23,10 @@ export HISTCONTROL=ignoredups export HISTFILESIZE=20000 export HISTSIZE=20000 +# ----------------------------------------------------------------------------- +# Shell options +# ----------------------------------------------------------------------------- + # Too many third-party scripts stop working w/ nounset enabled :-( #set -o nounset @@ -31,6 +38,10 @@ shopt -s histappend shopt -s nullglob shopt -s nocaseglob +# ----------------------------------------------------------------------------- +# Aliases +# ----------------------------------------------------------------------------- + alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' @@ -66,6 +77,10 @@ alias coredumpctl='coredumpctl --debugger-arguments="-q"' # Group by 1 byte only with xxd: alias xxd='xxd -groupsize 1' +# ----------------------------------------------------------------------------- +# GnuPG +# ----------------------------------------------------------------------------- + # This doc says that "you should always add the following lines to your # .bashrc": # @@ -76,6 +91,10 @@ alias xxd='xxd -groupsize 1' GPG_TTY="$( tty )" export GPG_TTY +# ----------------------------------------------------------------------------- +# Includes +# ----------------------------------------------------------------------------- + [ -r "$HOME/.bash_utils/file.sh" ] && source "$HOME/.bash_utils/file.sh" [ -r "$HOME/.bash_utils/text.sh" ] && source "$HOME/.bash_utils/text.sh" @@ -88,6 +107,10 @@ export GPG_TTY [ -r "$HOME/.bashrc_local" ] && source "$HOME/.bashrc_local" +# ----------------------------------------------------------------------------- +# More shell options +# ----------------------------------------------------------------------------- + os_is_cygwin && set -o igncr os_is_cygwin || complete -r @@ -102,8 +125,9 @@ os_is_cygwin \ || command -v stty > /dev/null 2>&1 \ && stty -ixon +# ----------------------------------------------------------------------------- # nnn -# --- +# ----------------------------------------------------------------------------- inside_nnn() { [ -n "$NNNLVL" ] && [ "${NNNLVL:-0}" -ge 1 ] @@ -130,8 +154,9 @@ nnn() { n "$@" } +# ----------------------------------------------------------------------------- # tmux -# ---- +# ----------------------------------------------------------------------------- remote_terminal() { test -n "$SSH_CONNECTION" diff --git a/%HOME%/.profile b/%HOME%/.profile index 02146b4..b4a72a2 100644 --- a/%HOME%/.profile +++ b/%HOME%/.profile @@ -28,7 +28,9 @@ path_export() { path_export "$HOME/.local/bin" -# Homebrew-specific stuff +# ----------------------------------------------------------------------------- +# Homebrew +# ----------------------------------------------------------------------------- brew_setup() { [ -x /opt/homebrew/bin/brew ] && \ @@ -43,7 +45,9 @@ brew_setup() { brew_setup -# Ruby-specific stuff +# ----------------------------------------------------------------------------- +# Ruby +# ----------------------------------------------------------------------------- # This is a half-assed way to automatically add your user's gem binary # directory to $PATH (also setting GEM_HOME). @@ -82,7 +86,9 @@ rbenv_setup() { rbenv_setup -# Python-specific stuff +# ----------------------------------------------------------------------------- +# Python +# ----------------------------------------------------------------------------- # This is a half-assed way to automatically add your user's pip binary # directory to $PATH. @@ -111,7 +117,9 @@ pyenv_setup() { pyenv_setup +# ----------------------------------------------------------------------------- # ssh-agent +# ----------------------------------------------------------------------------- kill_ssh_agent() { [ -n "${SSH_AGENT_PID:+x}" ] && kill "$SSH_AGENT_PID" @@ -135,11 +143,15 @@ spawn_ssh_agent() { # manager. command -v systemctl > /dev/null 2>&1 || spawn_ssh_agent -# Rust-specific stuff: +# ----------------------------------------------------------------------------- +# Rust +# ----------------------------------------------------------------------------- path_export "$HOME/.cargo/bin" +# ----------------------------------------------------------------------------- # fzf +# ----------------------------------------------------------------------------- # Search directories and hidden files by default. export FZF_DEFAULT_COMMAND='find -L . -\( -fstype dev -o -fstype proc -\) -prune -o -print 2> /dev/null' @@ -147,7 +159,10 @@ export FZF_DEFAULT_COMMAND='find -L . -\( -fstype dev -o -fstype proc -\) -prune command -v fd > /dev/null 2>&1 \ && export FZF_DEFAULT_COMMAND='fd --follow --show-errors --hidden --no-ignore-vcs 2> /dev/null' +# ----------------------------------------------------------------------------- # nnn +# ----------------------------------------------------------------------------- + # -A Don't auto-enter directories. # -e Open text files in $EDITOR. # -o Only open on Enter, not on l. -- cgit v1.2.3