aboutsummaryrefslogtreecommitdiff
path: root/.bashrc
blob: d7a6d3c10f44dfdaaee01b53efa40ec1959eabc8 (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
107
108
109
110
111
#!/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 ls='ls --color=auto -hv'
alias config='/usr/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/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