From f7a7898c58fac7f90209d020be4755c8948fa9f7 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Tue, 22 Mar 2022 00:04:49 -0600 Subject: reorganized bash configs --- alacritty/.alacritty.yml | 2 + bash/.bash/00-global.bash | 14 ++++++ bash/.bash/01-aliases.bash | 42 ++++++++++++++++++ bash/.bash/02-prompt.bash | 105 +++++++++++++++++++++++++++++++++++++++++++++ bash/.bash/03-boot.bash | 31 +++++++++++++ bash/.bash/04-other.bash | 0 bash/.bashrc | 4 +- vim/.vimrc | 1 + x/.xinitrc | 4 +- x/.xinitrc-not-docked | 6 ++- 10 files changed, 204 insertions(+), 5 deletions(-) create mode 100644 bash/.bash/00-global.bash create mode 100644 bash/.bash/01-aliases.bash create mode 100644 bash/.bash/02-prompt.bash create mode 100644 bash/.bash/03-boot.bash create mode 100644 bash/.bash/04-other.bash diff --git a/alacritty/.alacritty.yml b/alacritty/.alacritty.yml index 2eba706..d575aa3 100644 --- a/alacritty/.alacritty.yml +++ b/alacritty/.alacritty.yml @@ -20,9 +20,11 @@ window: y: 10 opacity: 0.9 +# Gruvbox dark colors: primary: background: '#282828' + foreground: '#fbf1c7' normal: black: '#282828' diff --git a/bash/.bash/00-global.bash b/bash/.bash/00-global.bash new file mode 100644 index 0000000..38718fb --- /dev/null +++ b/bash/.bash/00-global.bash @@ -0,0 +1,14 @@ +#!/bin/sh +# +# 00-global.bash +# define global bash things +# + +# expand history size +export HISTSIZE=5000 + +# source global definitions +if [ -f /etc/bashrc ]; then + . /etc/bashrc +fi + diff --git a/bash/.bash/01-aliases.bash b/bash/.bash/01-aliases.bash new file mode 100644 index 0000000..767e425 --- /dev/null +++ b/bash/.bash/01-aliases.bash @@ -0,0 +1,42 @@ +#!/bin/sh +# +# 01-aliases.bash +# bryson's bash aliases +# + +shopt -s expand_aliases + +# grep colors +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' + +# ls color and shortcuts +alias ls='ls --color=auto' +alias la='ls -a' +alias lsd='ls -lh' + +# copy an entire file +alias copy='xclip -sel c <' + +# cd shortcuts +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' + +# binary renames +alias java='/usr/java/jdk-17.0.1/bin/java' +alias java8='/usr/java/jre1.8.0_291/bin/java' +alias java12='/usr/java/jdk-12.0.2/bin/java' +alias python='python3' + +# quick important file edits +alias todo='vim ~/TODO.md' + +# go to directory with files from iPhone +alias iPhone='cd /home/bryson/Downloads/from-iPhone' + +# common combinations when programming +alias gs='gs -dNOSAFER' +alias django='python manage.py' +alias smci='sudo make clean install' diff --git a/bash/.bash/02-prompt.bash b/bash/.bash/02-prompt.bash new file mode 100644 index 0000000..51b7972 --- /dev/null +++ b/bash/.bash/02-prompt.bash @@ -0,0 +1,105 @@ +#!/bin/sh +# +# 02-prompt.bash +# bryson's gnarly bash prompt config +# + +# color definitions +black='\e[0;30m' +BLACK='\e[1;30m' +dgray='\e[0;90m' +DGRAY='\e[1;90m' +red='\e[0;31m' +RED='\e[1;31m' +lred='\e[0;91m' +LRED='\e[1;91m' +green='\e[0;32m' +GREEN='\e[1;32m' +lgreen='\e[0;92m' +LGREEN='\e[1;92m' +yellow='\e[0;33m' +YELLOW='\e[1;33m' +lyellow='\e[0;93m' +LYELLOW='\e[1;93m' +blue='\e[0;34m' +BLUE='\e[1;34m' +lblue='\e[0;94m' +LBLUE='\e[1;94m' +magenta='\e[0;35m' +MAGENTA='\e[1;35m' +lmagenta='\e[0;95m' +LMAGENTA='\e[1;95m' +cyan='\e[0;36m' +CYAN='\e[1;36m' +lcyan='\e[0;96m' +LCYAN='\e[1;96m' +lgray='\e[0;37m' +LGRAY='\e[1;37m' +NC='\e[0m' # No Color + +# 256color prompt variables +color1='\e[38;5;39m' +color2='\e[38;5;81m' +color3='\e[38;5;77m' +color4='\e[38;5;226m' + +# return exit code of last program if not 0 +function exit_code() { + local ERROR="$?" + if [[ ERROR -ne 0 ]]; then + echo -n ' \['"$RED"'\]'"$ERROR"'' + fi +} + +# get current git branch and status +# http://www.opinionatedprogrammer.com/2011/01/colorful-bash-prompt-reflecting-git-status/ +function _git_prompt() { + local git_status="`git status -unormal 2>&1`" + if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then + if [[ "$git_status" =~ nothing\ to\ commit ]]; then + local ansi="" + local color="$lgreen" + elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then + local ansi="!" + local color="$lred" + else + local ansi="*" + local color="$lyellow" + fi + if [[ "$git_status" =~ On\ branch\ ([^[:space:]]+) ]]; then + branch=${BASH_REMATCH[1]} + else + # Detached HEAD. (branch=HEAD is a faster alternative.) + branch="`git describe --all --contains --abbrev=4 HEAD 2> /dev/null || + echo local`" + fi + if ! [[ "$branch" =~ local ]]; then + echo -n '\['"$color"'\] { git: '"$ansi"''"$branch"' } ' + fi + fi +} + +# prompt building +# (2 unicode)[ bryson@hostname ] { /current/path } +# (unicode) $ +#export _PS1="\[$dgray\]╭─[ \[$LGREEN\]\u\[$lgray\]@\[$YELLOW\]\h\[$dgray\] ] {\[$LBLUE\] \w\[$dgray\] } " +#export _PS2="\[$dgray\]╰ " + +# same as above, no unicode +#export _PS1="\[$dgray\][ \[$GREEN\]\u\[$lgray\]@\[$LRED\]\h\[$dgray\] ] { \[$LCYAN\]\w\[$dgray\] } " + +# bryson@hostname /current/path/ bash 10:00:00 PM +#export _PS1="\[\e[1m$color1\]\u\[$color2\]@\[$color3\]\h \[$color4\]\w \[$color3\]\@ \[$color2\]\s " + +# [ bryson@hostname /current/path ] +# $ +#export _PS1="\[$lgray\][ \[\e[1m$color1\]\u\[$color2\]@\[$color3\]\h \[$color4\]\w \[\e[0m$lgray\]]" +export _PS1="\[\e[$lgray\][ \[$LBLUE\]\u\[$lcyan\]@\[$GREEN\]\h \[$LYELLOW\]\w \[$lgray\]]" +export _PS2="\[$dgray\]" + +# define x titlebar +TITLEBAR='\[\033]0;\u@\h:\w ($(history 1 | cut -c 8-))\]' + +# apply prompt and functions +export PROMPT_COMMAND='export PS1="$TITLEBAR${_status}${_PS1}$(exit_code)$(_git_prompt)\n${_PS2}\[$NC\]\$ "' + diff --git a/bash/.bash/03-boot.bash b/bash/.bash/03-boot.bash new file mode 100644 index 0000000..34f1d9c --- /dev/null +++ b/bash/.bash/03-boot.bash @@ -0,0 +1,31 @@ +#!/bin/sh +# +# 03-boot.bash +# startup scripts for systems +# + +# run startup script if tty +# for dingo +if [[ $TERM == 'linux' && $(hostname) == 'dingo' ]]; then + cat ~/bin/house.txt + printf "\n${CYAN}Welcome back Bryson :)\n\n" + USAGE="${blue}\td:start-docked\n\tn:start-not-docked\n\tq:shutdown\n\tr:reboot\n\tb:bash\n\n${NC}" + printf "${LGREEN}What should dingo do?\n" + printf "%b" $USAGE + + while read -rs -N 1 key; do + case $key in + d) startx ;; + n) nstartx.sh ;; + q) echo "Are you sure you want to shutdown? (y/n)"; + read -rs -N 1 key2; case $key2 in y) shutdown now ;; esac; ;; + r) echo "Are you sure you want to reboot? (y/n)"; + read -rs -N 1 key3; case $key3 in y) reboot ;; esac; ;; + b) break ;; + [h?]) echo "$USAGE";; + esac + printf "${LGREEN}What should dingo do now?\n" + printf "%b" $USAGE + done +fi + diff --git a/bash/.bash/04-other.bash b/bash/.bash/04-other.bash new file mode 100644 index 0000000..e69de29 diff --git a/bash/.bashrc b/bash/.bashrc index 6a536d5..9bbb1ef 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -23,6 +23,8 @@ alias ls='ls --color=auto' alias la='ls -a' alias lsd='ls -lh' +alias copy='xclip -sel c <' + alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' @@ -163,7 +165,7 @@ function get_random_ps1() { # xterm color thing #export _PS1="\[\e[1m$color1\]\u\[$color2\]@\[$color3\]\h \[$color4\]\w \[$color3\]\@ \[$color2\]\s " #export _PS1="\[$lgray\][ \[\e[1m$color1\]\u\[$color2\]@\[$color3\]\h \[$color4\]\w \[\e[0m$lgray\]]" -export _PS1="\[$lgray\][ \[$LBLUE\]\u\[$lcyan\]@\[$GREEN\]\h \[$LYELLOW\]\w \[$lgray\]]" +export _PS1="\[\e[$lgray\][ \[$LBLUE\]\u\[$lcyan\]@\[$GREEN\]\h \[$LYELLOW\]\w \[$lgray\]]" export _PS2="\[$dgray\]" #export _PS1=" \u \`pwd\`" #export _PS2="" diff --git a/vim/.vimrc b/vim/.vimrc index 503c5d0..3947b90 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -14,6 +14,7 @@ set scrolloff=5 set incsearch set relativenumber set ttimeout ttimeoutlen=25 +set clipboard=unnamedplus " turn on spell checker for all markdown files autocmd FileType markdown setlocal spell diff --git a/x/.xinitrc b/x/.xinitrc index 9e54f9e..0bb74a5 100644 --- a/x/.xinitrc +++ b/x/.xinitrc @@ -69,6 +69,6 @@ numlockx & nmcli radio wifi off & # start dwm -xset r rate 300 50; exec dwm -#exec /home/bryson/bin/startdwm +#xset r rate 300 50; exec dwm +xset r rate 300 50; exec /home/bryson/bin/startdwm.sh diff --git a/x/.xinitrc-not-docked b/x/.xinitrc-not-docked index 8ad754c..efae816 100644 --- a/x/.xinitrc-not-docked +++ b/x/.xinitrc-not-docked @@ -51,7 +51,7 @@ pacmd set-default-sink alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink & pacmd set-sink-volume alsa_output.pci-0000_03_00.6.HiFi__hw_Generic_1__sink 0 & # set up wallpaper -nitrogen --head=0 --set-zoom-fill ~/Pictures/Wallpapers/white-yosemite-edit.jpg & +nitrogen --head=0 --set-zoom-fill ~/Pictures/Wallpapers/room.jpg & # start notifications daemon notification-daemon & @@ -69,4 +69,6 @@ xrandr --output eDP --auto --set TearFree on & nmcli radio wifi on & # start dwm -redshift -O3500; xset r rate 300 50; exec dwm +#redshift -O3500; xset r rate 300 50; exec dwm +xset r rate 300 50; exec /home/bryson/bin/startdwm.sh + -- cgit v1.2.3