archuro/stow/dot-bashrc

93 lines
3.0 KiB
Plaintext

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
#
# Copyright (C) 2019, 2022 VHS <vhsdev@tutanota.com>
#
# This file is part of Archuro.
#
# Archuro is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Archuro is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
HISTFILESIZE=20000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
#shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# Use gpg-agent for SSH auth
# https://blogs.gentoo.org/mgorny/2018/05/12/on-openpgp-gnupg-key-management/
# https://wiki.archlinux.org/title/GnuPG#Using_a_PGP_key_for_SSH_authentication
# https://wiki.archlinux.org/title/GnuPG#SSH_agent
# https://opensource.com/article/19/4/gpg-subkeys-ssh
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi
# gpgconf --launch gpg-agent
export GPG_TTY=$(tty)
gpg-connect-agent updatestartuptty /bye >/dev/null
# Configure default editor
export EDITOR=vim
# Initialize Starship cross-shell prompt for bash
# see https://starship.rs/guide for more info
eval "$(starship init bash)"
# Colorize output of ls command on GNU/Linux
[[ "$OSTYPE" == linux-gnu* ]] && alias ls='ls --color=auto'
# Quickly find files (or use fzf)
ff() {
find . -iname "*${1:-}*"
}
# Load Bourne shell profile if exists
[[ -e ~/.profile ]] && sh -c 'source ~/.profile'
# Jump around
# @see [command] .. in `dot-profile`
[[ -r /usr/local/bin/z.sh ]] && . /usr/local/bin/z.sh
# Bind Ctrl+p so that it starts an Archruo tty
# @see https://askubuntu.com/a/749017/401660
# bind -x '"\C-p":archuro tty'
# Command completions for Bash 4.1+ (Homebrew compatabile)
[[ $PS1 && -f "/usr/local/etc/profile.d/bash_completion.sh" ]] &&
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" &&
. "/usr/local/etc/profile.d/bash_completion.sh"
# Command completions for NVM
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
. "$HOME/.cargo/env"