diff options
Diffstat (limited to '.bashrc')
-rw-r--r-- | .bashrc | 114 |
1 files changed, 114 insertions, 0 deletions
@@ -0,0 +1,114 @@ +#!/usr/bin/env bash +# ~/.bashrc +# shellcheck disable=SC2034,SC1090,SC1094 + +# If not running interactively, don't do anything +if [[ $- != *i* ]] ; then + return +fi + +# Use bash-completion, if available +[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion ]] && \ + . /usr/local/share/bash-completion/bash_completion + +# Check window size after each command, and if necessary +# update the values of LINES and COLUMNS +shopt -s checkwinsize + +# If there are multiple matches for completion, Tab should cycle through them +bind 'TAB':menu-complete + +# Colour autocomplete suggestions +bind "set colored-stats on" + +# Use up and down arrows to search command history +bind '"\e[A":history-search-backward' +bind '"\e[B":history-search-forward' + +# =============== +# HISTORY CONTROL +# =============== + +# Default if not set is 1000 +export HISTSIZE=10000 + +shopt -s histappend + +# Don't save duplicates +HISTCONTROL=ignoreboth:erasedups + +# Append to the history file immediately with history -a +# Clear the current history in the shell session with history -c +# Reload the updated history back into the shell session with -r command +export PROMPT_COMMAND="history -a; history -c; history -r $PROMPT_COMMAND" + +# If bpytop is installed then alias top to bpytop +[ -e /usr/local/bin/btop ] && alias top="/usr/local/bin/btop" +#alias ls='ls --color=auto -hv --group-directories-first' +alias ls='ls --color=auto -hv' +alias config='/usr/local/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' + +command -v bat > /dev/null && alias cat='bat --paging=never' +alias wanip='dig @resolver4.opendns.com myip.opendns.com +short' + +# alias to stop foot terminal confusing ssh +if [[ $TERM = "foot" ]]; then + alias ssh='TERM=linux ssh' +fi + +export COLORTERM="truecolor" +export EDITOR="hx" +export VISUAL="hx" +export MANPATH=$HOME/.local/share/man/:$MANPATH +export PATH=$PATH:~/.local/bin +export STARSHIP_CONFIG=~/.config/starship/config.toml +export BROWSER="qutebrowser" +export XDG_CONFIG_HOME="$HOME/.config" +export WEECHAT_HOME="$XDG_CONFIG_HOME/weechat" +export MOZ_ENABLE_WAYLAND=1 +export XDG_SESSION_TYPE=wayland +export GDK_BACKEND=wayland +# export QT_QPA_PLATFORM=wayland +# export XKB_DEFAULT_LAYOUT=us +# export LANG="en_US.UTF-8" +# export LC_ALL="en_US.UTF-8" +# export SSH_ASKPASS=~/.local/bin/wayprompt-ssh-askpass +export SSH_ASKPASS='/home/justine/.local/bin/ssh-askpass' +export SSH_ASKPASS_REQUIRE=prefer +export TERMINAL="foot" +export SAL_USE_VCLPLUGIN=gtk3 + +# Path to Zig binary +# export PATH=$PATH:~/Downloads/zig/zig-linux-x86_64-0.13.0/ + +# Path to Helix binary +# export PATH=$PATH:~/.cargo/bin/ +# I cloned Helix master in ~/Git and setup a link to the runtime instead of +# using export as below. +# export HELIX_RUNTIME=~/Git/helix/runtime +# This is the command I ran after building: ln -s ~/Git/helix/runtime ~/.config/helix/runtime + +# If using musl then set this variable to ensure tree-sitter grammars can be loaded correctly +# export RUSTFLAGS="-C target-feature=-crt-static" + +# Enable the use of ssh-agent +if ! pgrep -u "$USER" ssh-agent > /dev/null; then + ssh-agent -t 1h > "$XDG_RUNTIME_DIR/ssh-agent.env" +fi +if [[ ! -f "$SSH_AUTH_SOCK" ]]; then + source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null +fi + +# If on matching tty start the WM +if [ "$(tty)" = "/dev/ttyv0" ]; then + exec dbus-run-session river +fi + +# If not in xterm don't start starship +case $TERM in + konsole*|foot*) + # xterm*|konsole*|foot*) + eval "$(starship init bash)";; + *) + export PS1="\[$(tput bold)\]\[$(tput setaf 2)\][\u@\h \w] \\[$(tput sgr0)\]";; +esac |