# /etc/skel/.bashrc # # This file is sourced by all *interactive* bash shells on startup, # including some apparently interactive shells such as scp and rcp # that can't tolerate any output. So make sure this doesn't display # anything or bad things will happen ! safe_load() { sh="$1" [ -r "$sh" ] && . "$sh" unset sh } # Test for an interactive shell. There is no need to set anything # past this point for scp and rcp, and it's important to refrain from # outputting anything in those cases. if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return fi # Make sure to also load ~/.profile for non-login shells safe_load ~/.profile # Spawn sway, if we are on tty1 #if [[ "$(tty)" = "/dev/tty1" ]] ; then # safe_load $HOME/.config/sway/env # exec dbus-launch --exit-with-session sway -Ddamage=rerender #fi # Enable fzf integration # safe_load /etc/profile.d/fzf.sh # safe_load "$HOME"/devel/upstream/github.com/lincheney/fzf-tab-completion/bash/fzf-bash-completion.sh # bind -x '"\t": fzf_bash_completion' # Append to history file shopt -s histappend HISTSIZE=50000 HISTFILESIZE=500000 # enable direnv eval "$(direnv hook bash)" # enable z.lua if [ -d /usr/libexec/z_lua ]; then eval "$(luajit /usr/libexec/z_lua/z.lua --init bash enhanced once fzf)" safe_load /usr/libexec/z_lua/czmod/czmod.bash fi # enable navi eval "$(navi widget bash)" # Use keychain to reuse the ssh-agent and gpg-agent between logins keychain --agents ssh,gpg -q id_rsa # AF6AB8C8B10436B9F61293632143BD2AAB94BCC4 safe_load "$HOME/.keychain/$(hostname)-sh" safe_load "$HOME/.keychain/$(hostname)-sh-gpg" # Set prompt # export PS1="$(prompt)" if ! [[ "${PROMPT_COMMAND:-}" =~ _prompt_hook ]]; then PROMPT_COMMAND="_prompt_hook${PROMPT_COMMAND:+;$PROMPT_COMMAND}" fi _prompt_hook() { if [ "$?" != 0 ]; then PS1=$(prompt err) else PS1=$(prompt) fi } # Alias shell commands # alias logout='dbus-send --session --type=method_call --print-reply --dest=' alias vim=nvim alias v=nvim alias rm=$HOME/bin/rm alias l='exa --long --classify --group --header --group-directories-first' alias lt='exa --classify --group-directories-first -T' alias ..='cd ..' alias grep='grep --color=auto' alias cat=bat alias ssh='TERM=xterm-256color ssh' alias balssh='ssh -p 22222 -o User=root -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' alias balscp='scp -P 22222 -o User=root -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' alias k=kubectl alias zk='f() { nvim +cd\ ~/.zk +lua\ "require(\"neuron/telescope\").find_zettels({ default_text = \"$1\" })"; }; f'