-[[ -f ~/.profile ]] && . ~/.profile
-[[ -f ~/.bashrc ]] && . ~/.bashrc
+include () {
+ [[ -f "$1" && -r "$1" ]] && source "$1"
+}
+
+include ~/.profile
+include ~/.nix-profile/etc/profile.d/nix.sh
+include ~/.bashrc
+# If not running interactively, don't do anything else
+[[ $- != *i* ]] && return
+
+# i-beam cursor
+# echo -e "\033[5 q" # blinking
+echo -e "\033[6 q" # non-blinking
+
# various bash tweaks
shopt -s histappend
shopt -s cmdhist
HISTSIZE=
HISTFILESIZE=
HISTCONTROL=ignoreboth
-HISTIGNORE='ls:l:s:bg:fg:history'
+HISTIGNORE='ls:l:s:g:[bf]g:history'
HISTTIMEFORMAT='%F %T '
stty stop ""
# aliases
alias ls='ls --color=auto'
+alias l='ls -lh' # long format and human-readable sizes
+alias ll='l -A' # long format, all files
+alias g='git'
+include /usr/share/bash-completion/completions/git && __git_complete g _git
alias mpv="mpv --ytdl-format mp4"
alias mv="mv -iv"
alias cp="cp -iv"
cd ${1}
}
-# i-beam cursor
-# echo -e "\033[5 q" # blinking
-echo -e "\033[6 q" # non-blinking
-
-
-# If not running interactively, don't do anything else
-[[ $- != *i* ]] && return
+# fzf
+include /usr/share/fzf/key-bindings.bash
+include /usr/share/fzf/completion.bash
+# from https://unix.stackexchange.com/a/55935
a_prompt() {
- cwd=$(pwd | sed -e "s!$HOME!~!" | sed -re "s!([^/])[^/]+/!\1/!g")
+ cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD)
printf $cwd
}
PS1="\u@\h \$(a_prompt)> "
+export VISUAL="emacsclient -c"
+
export PATH="$HOME/.local/bin:$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin${PATH:+:}$PATH"
export XDG_CONFIG_HOME="$HOME/.config"
export MAILDIR="$HOME/mail"
export CVS_RSH="ssh"
-export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
-export PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
-export SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
-export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
-export GIT_SSL_CAINFO="$SSL_CERT_FILE"
+if [ -x "$(command -v guix)" ]; then
+ export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
+ export PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
+ export SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
+ export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
+ export GIT_SSL_CAINFO="$SSL_CERT_FILE"
+fi
export NIXPKGS="$HOME/src/git/nixpkgs"
-if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi