aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
blob: 9c7bf725e2909e4289b925d110b37bf28433b85b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/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
# ===============

# 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/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'

# alias to stop foot terminal confusing ssh
if [[ $TERM = "foot" ]]; then
  alias ssh='TERM=linux ssh'
fi

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 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"
export SAL_USE_VCLPLUGIN=gtk3

# Path to Zig binary 
export PATH=$PATH:~/Downloads/zig/zig-linux-x86_64-0.11.0/

# 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
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