aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2023-08-22 19:31:08 +0100
committerJustine Smithies <justine@smithies.me.uk>2023-08-22 19:31:08 +0100
commit87a4d7f18bf1089a27fdc587529d252997128850 (patch)
treed2dafcb81ad1d06a763a0178e29bf2c321b88cef /.bashrc
parent049cbc199c66b30c2ec293efb6949194ecab14b1 (diff)
Initial commit
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc96
1 files changed, 96 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
new file mode 100644
index 0000000..98c0279
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,96 @@
+#!/bin/bash
+# ~/.bashrc
+# shellcheck disable=SC2034,SC1090,SC1094
+
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
+# Use bash-completion, if available
+[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
+ . /usr/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
+# ===============
+
+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/bin/btop ] && alias top="/usr/bin/btop"
+alias ls='ls --color=auto -hv --group-directories-first'
+alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
+
+# Only use aliases according to the TERM we are in
+case $TERM in
+ xterm*|konsole*|foot*)
+ alias vim='nvim';;
+ linux)
+ alias vim="nvim";;
+ *)
+esac
+
+command -v bat > /dev/null && alias cat='bat --paging=never'
+alias wanip='dig +short myip.opendns.com @resolver1.opendns.com'
+
+export EDITOR="nvim"
+export VISUAL="nvim"
+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 XDG_CURRENT_DESKTOP=qtile
+# 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/ssh-askpass
+export TERMINAL="foot"
+
+# 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/tty1" ]; then
+ #exec dbus-run-session river
+ exec dbus-run-session qtile start -b wayland
+fi
+
+# If not in xterm don't start starship
+case $TERM in
+ xterm*|konsole*|foot*)
+ eval "$(starship init bash)";;
+ *)
+ export PS1="\[$(tput bold)\]\[$(tput setaf 2)\][\u@\h \w] \\[$(tput sgr0)\]";;
+esac