diff options
author | Nicholas <nbnoll@eml.cc> | 2021-12-10 12:34:31 -0800 |
---|---|---|
committer | Nicholas <nbnoll@eml.cc> | 2021-12-10 12:34:31 -0800 |
commit | 1e8edd2927934029d943edf107a7505ba83cdf9c (patch) | |
tree | b6d6d97282ce9ffc8af3714252e04fd3ca221609 | |
parent | 4a24aea754f058b913ca2d98343df23e25970a54 (diff) |
merge bashrc
-rw-r--r-- | .bash_profile | 4 | ||||
-rw-r--r-- | .bashrc | 98 |
2 files changed, 69 insertions, 33 deletions
diff --git a/.bash_profile b/.bash_profile index b39e740..c4b4855 100644 --- a/.bash_profile +++ b/.bash_profile @@ -2,7 +2,7 @@ export LC_CTYPE=en_US.UTF-8 # Setup environment -export PATH="$HOME/u/bin:$HOME/.local/bin:$PATH:$HOME/src/pangraph/bin" +export PATH="$HOME/u/bin":"$HOME/.local/bin":$PATH export SHELL=/bin/bash export MAILCAPS="$HOME/.config/mutt/mailcap" @@ -33,5 +33,7 @@ export QT_QPA_PLATFORMTHEME=qt5ct sed -i 's/echo Agent pid [0-9]*;$//g' $HOME/.ssh/ssh-agent.env source $HOME/.ssh/ssh-agent.env +set -o vi + # Get the aliases and functions [ -f $HOME/.bashrc ] && . $HOME/.bashrc @@ -50,39 +50,40 @@ pkg() query | q) xbps-query "$@" ;; + remove | r) + doas xbps-remove "$@" + ;; configure | c) - xbps-reconfigure "$@" + doas xbps-reconfigure "$@" + ;; + update | up | u) + doas xbps-install -Su "$@" ;; src | s) - subcmd="$1" - case $subcmd in + subsubcmd="$1" + case $subsubcmd in install | i) shift 1 ( - cd "$HOME/opt/void-packages"; - xi "$@" + cd $HOME/opt/void-packages; + xi "$@" ) ;; *) ( - cd "$HOME/opt/void-packages"; - ./xbps-src "$@" + cd $HOME/opt/void-packages; + ./xbps-src "$@" ) ;; esac ;; - remove | r) - doas xbps-remove "$@" - ;; - update | up | u) - doas xbps-install -Su "$@" - ;; find | f) xlocate "$@" ;; *) warn "$subcmd" "unknown subcommand" ;; + esac } export -f pkg @@ -98,15 +99,21 @@ g() branch | b) git branch "$@" ;; - checkout | co) - git checkout "$@" - ;; commit | c) git commit "$@" ;; + clone | cl) + git clone "$@" + ;; + checkout | co) + git checkout "$@" + ;; tag | t) git tag "$@" ;; + init | i) + git init "$@" + ;; mv) git mv "$@" ;; @@ -125,9 +132,18 @@ g() rebase | r) git rebase "$@" ;; + reflog | ref) + git reflog "$@" + ;; add | a) git add "$@" ;; + new | n) + ssh git@nbnoll.xyz mkrepo "$@" + ;; + remote | rem) + git remote "$@" + ;; *) warn "$subcmd" "unknown subcommand" ;; @@ -137,21 +153,28 @@ g() export -f g # su -su() { +su() +{ PS1="(root)>" command su } -export su +export -f su + +# fzf +source "$HOME/.local/share/fzf.sh" # prompt -prompt_path() { +prompt_path() +{ echo "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)/$(basename "${BASH_SOURCE[0]}")" } -prompt_os() { +prompt_os() +{ uname -s | tr '[:upper:]' '[:lower:]' } -prompt_configure_completion() { +prompt_configure_completion() +{ bind 'set colored-stats on' bind 'set colored-completion-prefix on' bind 'set completion-ignore-case on' @@ -167,7 +190,8 @@ prompt_configure_completion() { shopt -s 'dirspell' } -prompt_configure_dircolors() { +prompt_configure_dircolors() +{ if [ -x "$(command -v dircolors)" ]; then if [ -r "$HOME/.dircolors" ]; then eval "$(dircolors -b "$HOME/.dircolors")" @@ -177,19 +201,22 @@ prompt_configure_dircolors() { fi } -prompt_configure_history() { +prompt_configure_history() +{ export HISTCONTROL='ignoreboth:erasedups' export HISTTIMEFORMAT='[%Y-%m-%d %T] ' shopt -s 'histappend' } -prompt_configure_variables() { +prompt_configure_variables() +{ export prompt_git_bin prompt_git_bin="$(command -v git)" } # load all configuration files -prompt_configure() { +prompt_configure() +{ export prompt_PS1_last_exit export prompt_PS1_prefix export prompt_PS1_content @@ -202,7 +229,8 @@ prompt_configure() { } # prepares the prompt variables -prompt_reset_prompt() { +prompt_reset_prompt() +{ export prompt_PS1_last_exit="$?" export prompt_PS1_prefix='' prompt_PS1_prefix='\[\e]0;\w\a\]' @@ -211,12 +239,14 @@ prompt_reset_prompt() { } # make prompt_PS1_suffix red if the previous command failed -prompt_add_exit_code_to_prompt() { +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() { +prompt_add_git_to_prompt() +{ local prompt local branch local status_count @@ -242,7 +272,8 @@ prompt_add_git_to_prompt() { } # prepend user@hostname to prompt, if connected via ssh -prompt_add_ssh_to_prompt() { +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}" @@ -250,7 +281,8 @@ prompt_add_ssh_to_prompt() { } # set the prompt -do_prompt() { +do_prompt() +{ prompt_reset_prompt prompt_add_exit_code_to_prompt prompt_add_ssh_to_prompt @@ -261,7 +293,8 @@ do_prompt() { } # clean up shared prompt variables -prompt_cleanup() { +prompt_cleanup() +{ unset prompt_PS1_prefix \ prompt_PS1_content \ prompt_PS1_suffix \ @@ -269,7 +302,8 @@ prompt_cleanup() { } # do the thing! -prompt_init() { +prompt_init() +{ if [[ "$-" == *i* ]]; then prompt_configure if [[ "$PROMPT_COMMAND" != *do_prompt* ]]; then |