diff options
author | Nicholas <nbnoll@eml.cc> | 2021-12-01 15:55:26 -0800 |
---|---|---|
committer | Nicholas <nbnoll@eml.cc> | 2021-12-01 15:55:26 -0800 |
commit | 7772bd8d27e06522dbf3c5e53f3efa95ea0552c8 (patch) | |
tree | 4b7aa2d013f908b50b4459bcbb7511805f997162 | |
parent | b129659aaca6efbd61278b630cab7a4e858e33fe (diff) |
added xresources
-rw-r--r-- | .Xresources | 8 | ||||
-rw-r--r-- | .bash_profile | 37 | ||||
-rw-r--r-- | .bashrc | 256 | ||||
-rw-r--r-- | .profile | 24 |
4 files changed, 301 insertions, 24 deletions
diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..6d478e9 --- /dev/null +++ b/.Xresources @@ -0,0 +1,8 @@ +!Xft.autohint: 0 +!Xft.antialias: 1 +!Xft.hinting: 1 +!Xft.hintstyle: hintslight +!Xft.rgba: rgba + +Xcursor.theme: Adwaita +Xcursor.size: 32 diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..4e397a4 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,37 @@ +# .bash_profile +export LC_CTYPE=en_US.UTF-8 + +# Setup environment +export PATH="$HOME/u/bin":"$HOME/.local/bin":$PATH +export SHELL=/bin/bash +export MAILCAPS="$HOME/.config/mutt/mailcap" + +export TEXINPUTS=".:$HOME/docs/career//:" + +export XDG_DOCUMENTS_DIR="$HOME/docs" +export XDG_DOWNLOAD_DIR="$HOME/pulls" +export XDG_PICTURES_DIR="$HOME/media/pics" +export XDG_VIDEOS_DIR="$HOME/media/vids" + +export EDITOR=nvim +export VISUAL=$EDITOR +export BROWSER=qutebrowser +export PAGER="less -R" +export MANWIDTH=80 + +export LESS_TERMCAP_mb=$(printf "\e[01;34m") +export LESS_TERMCAP_md=$(printf "\e[01;34m") +export LESS_TERMCAP_me=$(printf "\e[0m") +export LESS_TERMCAP_se=$(printf "\e[0m") +export LESS_TERMCAP_so=$(printf "\e[01;100;33m") +export LESS_TERMCAP_ue=$(printf "\e[0m") +export LESS_TERMCAP_us=$(printf "\e[01;4;32m") + +export QT_QPA_PLATFORMTHEME=qt5ct + +# ssh agent +sed -i 's/echo Agent pid [0-9]*;$//g' $HOME/.ssh/ssh-agent.env +source $HOME/.ssh/ssh-agent.env + +# Get the aliases and functions +[ -f $HOME/.bashrc ] && . $HOME/.bashrc @@ -0,0 +1,256 @@ +# .bashrc + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +GPG_TTY=$(tty); export GPG_TTY + +# aliases +alias ls='ls --color=auto --group-directories-first' +alias ll='ls -ahlF' +alias la='ls -A' +alias l='ls -CF' + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' + +alias dots='git --git-dir=$HOME/.dots --work-tree=$HOME' +alias lofi="mpv 'https://www.youtube.com/watch?v=5qap5aO4i9A' --no-video" +alias tmux='tmux -f $HOME/.config/tmux/config' +alias mail='neomutt' + +dbg() { + command gdb -q "$@" +} +export dbg + +# xbps aliasing +log() { + printf '%b%s %b%s%b %s\n' \ + "$c1" "${3:-->}" "${c3}${2:+$c2}" "$1" "$c3" "$2" >&2 +} + +warn() { + log "$1" "$2" "${3:-ERROR}" +} + +pkg() { + subcmd="$1" + shift 1 # pop off first argument + case $subcmd in + install | i) + doas xbps-install "$@" + ;; + query | q) + xbps-query "$@" + ;; + remove | r) + doas xbps-remove "$@" + ;; + update | up | u) + doas xbps-install -Su "$@" + ;; + find | f) + xlocate "$@" + ;; + *) + warn "$subcmd" "unknown subcommand" + ;; + + esac +} +export -f pkg + +g() +{ + subcmd="$1" + shift 1 # pop off first argument + case $subcmd in + status | s) + git status "$@" + ;; + branch | b) + git branch "$@" + ;; + checkout | c) + git checkout "$@" + ;; + tag | t) + git tag "$@" + ;; + mv) + git mv "$@" + ;; + rm) + git rm "$@" + ;; + log | l) + git log "$@" + ;; + push | P) + git push "$@" + ;; + pull | p) + git pull "$@" + ;; + rebase | r) + git rebase "$@" + ;; + add | a) + git add "$@" + ;; + *) + warn "$subcmd" "unknown subcommand" + ;; + + esac +} +export -f g + +# su +su() { + PS1="(root)>" command su +} +export su + +# prompt +prompt_path() { + echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)/$(basename "${BASH_SOURCE[0]}")" +} + +prompt_os() { + uname -s | tr '[:upper:]' '[:lower:]' +} + +prompt_configure_completion() { + bind 'set colored-stats on' + bind 'set colored-completion-prefix on' + bind 'set completion-ignore-case on' + bind 'set completion-map-case on' + bind 'set expand-tilde on' + bind 'set mark-directories on' + bind 'set mark-symlinked-directories on' + bind 'set show-all-if-ambiguous on' + bind 'set show-all-if-unmodified on' + bind 'set skip-completed-text on' + shopt -s 'cdspell' + shopt -s 'checkwinsize' + shopt -s 'dirspell' +} + +prompt_configure_dircolors() { + if [ -x "$(command -v dircolors)" ]; then + if [ -r "$HOME/.dircolors" ]; then + eval "$(dircolors -b "$HOME/.dircolors")" + else + eval "$(dircolors -b)" + fi + fi +} + +prompt_configure_history() { + export HISTCONTROL='ignoreboth:erasedups' + export HISTTIMEFORMAT='[%Y-%m-%d %T] ' + shopt -s 'histappend' +} + +prompt_configure_variables() { + export prompt_git_bin + prompt_git_bin="$(command -v git)" +} + +# load all configuration files +prompt_configure() { + export prompt_PS1_last_exit + export prompt_PS1_prefix + export prompt_PS1_content + export prompt_PS1_suffix + + prompt_configure_completion + prompt_configure_dircolors + prompt_configure_history + prompt_configure_variables +} + +# prepares the prompt variables +prompt_reset_prompt() { + export prompt_PS1_last_exit="$?" + export prompt_PS1_prefix='' + prompt_PS1_prefix='\[\e]0;\w\a\]' + export prompt_PS1_content='\[\e[34;1m\]\w\[\e[0m\]' + export prompt_PS1_suffix=' \[\e[1m\]>\[\e[0m\] ' +} + +# make prompt_PS1_suffix red if the previous command failed +prompt_add_exit_code_to_prompt() { + [ "$prompt_PS1_last_exit" -ne 0 ] && prompt_PS1_suffix="\[\e[31m\]${prompt_PS1_suffix}\[\e[0m\]" +} + +# display git branch and repo state asterisk after path, if inside of a repository +prompt_add_git_to_prompt() { + local prompt + local branch + local status_count + + if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = 'true' ] || [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" = 'true' ]; then + branch="$(git rev-parse --abbrev-ref HEAD 2>/dev/null)" + [ -z "$branch" ] && branch='(no branch)' + if [ "$(git rev-parse --is-inside-git-dir 2>/dev/null)" != 'true' ]; then + status_count="$(git status --porcelain | wc -l)" + fi + elif [ "$(git rev-parse --is-bare-repository 2>/dev/null)" = 'true' ]; then + branch='(bare repo)' + fi + + if [ -n "$branch" ]; then + if [ "${status_count:-0}" -gt 0 ]; then + prompt="\[\e[1;33m\]${branch}*\[\e[0m\]" + else + prompt="\[\e[36m\]${branch}\[\e[0m\]" + fi + prompt_PS1_content="${prompt_PS1_content:-} ${prompt}" + fi +} + +# prepend user@hostname to prompt, if connected via ssh +prompt_add_ssh_to_prompt() { + if [ -n "$SSH_CONNECTION" ]; then + prompt_PS1_prefix='\[\e]0;\u@\h \w\a\]' + prompt_PS1_content="\[\e[2m\]\u@\h\[\e[0m\] ${prompt_PS1_content}" + fi +} + +# set the prompt +do_prompt() { + prompt_reset_prompt + prompt_add_exit_code_to_prompt + prompt_add_ssh_to_prompt + [ -n "$prompt_git_bin" ] && prompt_add_git_to_prompt + export PS1="${prompt_PS1_prefix:-}${prompt_PS1_content:-}${prompt_PS1_suffix:-}" + history -a + prompt_cleanup +} + +# clean up shared prompt variables +prompt_cleanup() { + unset prompt_PS1_prefix \ + prompt_PS1_content \ + prompt_PS1_suffix \ + prompt_PS1_last_exit +} + +# do the thing! +prompt_init() { + if [[ "$-" == *i* ]]; then + prompt_configure + if [[ "$PROMPT_COMMAND" != *do_prompt* ]]; then + export PROMPT_COMMAND="do_prompt;$PROMPT_COMMAND" + fi + fi +} + +if [ -z "${prompt_skip_init:-}" ]; then + prompt_init +fi diff --git a/.profile b/.profile deleted file mode 100644 index 5ee121e..0000000 --- a/.profile +++ /dev/null @@ -1,24 +0,0 @@ -# encoding -export LC_CTYPE=en_US.UTF-8 - -# paths -export PATH=~/root/bin:~/code/bio/pangraph/bin:~/.local/bin:$PATH -export SHELL=/bin/mksh - -export MAILCAPS=~/.config/mutt/mailcap -export TEXINPUTS=.:/home/nolln/docs//:/usr/share/texmf-dist/tex// - -export XDG_DOCUMENTS_DIR="$HOME/docs" -export XDG_DOWNLOAD_DIR="$HOME/pulls" -export XDG_PICTURES_DIR="$HOME/media/pics" -export XDG_VIDEOS_DIR="$HOME/media/vids" - -# bins -export EDITOR=nvim -export VISUAL=$EDITOR -export BROWSER=qutebrowser -export PAGER="less -R" -export MANWIDTH=80 - -# misc -set -o vi |