From bf26003ab3fe06f566c8793eb7b1d9af6a82a8ba Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 21 Dec 2021 13:19:10 -0500 Subject: [PATCH] Completely reset dotfiles (#2) --- .gitignore | 5 +- Makefile | 48 ++--- README.md | 25 --- .../.config/alacritty/alacritty-base.yml | 4 - alacritty/.config/alacritty/themes/dark.yml | 38 ++-- alacritty/.config/alacritty/themes/light.yml | 39 ++-- .../alacritty/themes/solarized-dark.yml | 28 --- .../alacritty/themes/solarized-light.yml | 28 --- atomaka/.config/atomaka/color.sample.yml | 1 - bin/bin/, | 25 --- bin/bin/colors | 99 --------- bin/bin/git-checkout-all | 3 - bin/bin/{cs => toggle-color-mode} | 8 +- .../git/gitignore_global} | 3 - git/.gitattributes_global | 1 - git/.gitconfig | 61 ++---- git/.gitconfig_work | 2 - remove-symlinks | 8 - tmux-256color.src | 67 ------ tmux/.config/tmux/tmux.conf | 35 +++ tmux/.tmux.conf | 70 ------ tmux/.tmux/dark.conf | 29 --- tmux/.tmux/light.conf | 29 --- tmux/.tmux/solarized-dark.conf | 29 --- tmux/.tmux/solarized-light.conf | 29 --- tmux/.tmux/startup | 5 - vim/.config/vim/undo/.gitinclude | 0 vim/.vimrc | 202 ++++++------------ zsh/.aliases-mac | 2 - zsh/.config/zsh/.zshrc | 32 +++ zsh/{.aliases => .config/zsh/aliases} | 47 +--- zsh/.config/zsh/functions | 78 +++++++ zsh/.config/zsh/prompt | 4 + zsh/.functions | 169 --------------- zsh/.zsh-completions/_comma | 17 -- zsh/.zsh/prompt | 30 --- zsh/.zshenv | 33 +-- zsh/.zshrc | 73 ------- 38 files changed, 305 insertions(+), 1101 deletions(-) delete mode 100644 README.md delete mode 100644 alacritty/.config/alacritty/themes/solarized-dark.yml delete mode 100644 alacritty/.config/alacritty/themes/solarized-light.yml delete mode 100644 atomaka/.config/atomaka/color.sample.yml delete mode 100755 bin/bin/, delete mode 100755 bin/bin/colors delete mode 100755 bin/bin/git-checkout-all rename bin/bin/{cs => toggle-color-mode} (83%) rename git/{.gitignore_global => .config/git/gitignore_global} (75%) delete mode 100644 git/.gitattributes_global delete mode 100644 git/.gitconfig_work delete mode 100755 remove-symlinks delete mode 100644 tmux-256color.src create mode 100644 tmux/.config/tmux/tmux.conf delete mode 100644 tmux/.tmux.conf delete mode 100644 tmux/.tmux/dark.conf delete mode 100644 tmux/.tmux/light.conf delete mode 100644 tmux/.tmux/solarized-dark.conf delete mode 100644 tmux/.tmux/solarized-light.conf delete mode 100755 tmux/.tmux/startup create mode 100644 vim/.config/vim/undo/.gitinclude delete mode 100644 zsh/.aliases-mac create mode 100644 zsh/.config/zsh/.zshrc rename zsh/{.aliases => .config/zsh/aliases} (55%) create mode 100644 zsh/.config/zsh/functions create mode 100644 zsh/.config/zsh/prompt delete mode 100644 zsh/.functions delete mode 100644 zsh/.zsh-completions/_comma delete mode 100644 zsh/.zsh/prompt delete mode 100644 zsh/.zshrc diff --git a/.gitignore b/.gitignore index 4b2051d..18a6a4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ +*.swp + alacritty/.config/alacritty/alacritty.yml -atomaka/.config/atomaka/color.yml +zsh/.config/zsh/.zcompdump + diff --git a/Makefile b/Makefile index 93808fa..0c0f598 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,24 @@ -STOWED = bin git ruby tmux vim zsh alacritty atomaka +STOWED = alacritty bin git ruby tmux vim zsh all: install -install: vim-setup initialize-colors +install: stow $(STOWED) -uninstall: - stow -D $(STOWED) +alacritty: + curl -fLo /tmp/alacritty.info https://raw.githubusercontent.com/alacritty/alacritty/master/extra/alacritty.info + sudo tic -xe alacritty,alacritty-direct /tmp/alacritty.info + toggle-color-bin -vim-setup: - mkdir -p $$HOME/.vim/undo - if test ! -f ~/.vim/autoload/plug.vim ; then \ - curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim ; \ - fi +javascript: nodenv-base nodenv-build -initialize-colors: - cat alacritty/.config/alacritty/alacritty-base.yml alacritty/.config/alacritty/themes/dark.yml > alacritty/.config/alacritty/alacritty.yml - cp atomaka/.config/atomaka/color.sample.yml atomaka/.config/atomaka/color.yml +linux: + sudo apt-get install direnv fzf silversearcher-ag stow tmux vim zsh -rbenv: rbenv-base rbenv-build +ruby: rbenv-base rbenv-build + +vim: + curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim rbenv-base: if test ! -d ~/.rbenv ; then \ @@ -31,17 +30,12 @@ rbenv-build: git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build ; \ fi -update: update-repo +nodenv-base: + if test ! -d ~/.nodenv ; then \ + git clone https://github.com/nodenv/nodenv.git ~/.nodenv ; \ + fi -update-repo: - git pull --rebase - -clean: - rm -f $$HOME/bin/, - bash remove-symlinks - -mac: - sudo mv /etc/{zprofile,zprofile.old} - infocmp -x tmux-256color > ~/tmux-256color.src - sed -i "" -e "s/pairs#0x10000/pairs#0x1000/" ~/tmux-256color.src - /usr/bin/tic -x ~/tmux-256color.src +nodenv-build: + if test ! -d ~/.nodenv ; then \ + git clone https://github.com/nodenv/node-build.git ~/.nodenv/plugins/node-build ; \ + fi diff --git a/README.md b/README.md deleted file mode 100644 index c44b6aa..0000000 --- a/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# dotfiles - - -## Dependencies - -* [stow](https://www.gnu.org/software/stow/) -* [tmux](https://github.com/tmux/tmux) -* [zsh](https://github.com/zsh-users/zsh) -* [neovim](https://github.com/neovim/neovim) -* [fzf](https://github.com/junegunn/fzf) -* [ag](https://github.com/ggreer/the_silver_searcher) - -## Setup - -* Install dependencies -* Clone this repository -* Run `make` - * Uses GNU stow to generate symlinks - * Config files must already exist -* Install vim plugins - -``` -nvim -,pi -``` diff --git a/alacritty/.config/alacritty/alacritty-base.yml b/alacritty/.config/alacritty/alacritty-base.yml index 96b5d9e..34838fc 100644 --- a/alacritty/.config/alacritty/alacritty-base.yml +++ b/alacritty/.config/alacritty/alacritty-base.yml @@ -1,7 +1,3 @@ background_opacity: 0.9 -key_bindings: - - { key: Return, mods: Command, action: ToggleFullscreen } font: size: 14 -env: - TERM: xterm-256color diff --git a/alacritty/.config/alacritty/themes/dark.yml b/alacritty/.config/alacritty/themes/dark.yml index 15407b9..7c59efb 100644 --- a/alacritty/.config/alacritty/themes/dark.yml +++ b/alacritty/.config/alacritty/themes/dark.yml @@ -1,28 +1,28 @@ -# Colors (One Dark) +# Colors (Ayu Mirage) colors: # Default colors primary: - background: '0x1e2127' - foreground: '0xabb2bf' + background: '#202734' + foreground: '#CBCCC6' # Normal colors normal: - black: '0x1e2127' - red: '0xe06c75' - green: '0x98c379' - yellow: '0xd19a66' - blue: '0x61afef' - magenta: '0xc678dd' - cyan: '0x56b6c2' - white: '0xabb2bf' + black: '#191E2A' + red: '#FF3333' + green: '#BAE67E' + yellow: '#FFA759' + blue: '#73D0FF' + magenta: '#FFD580' + cyan: '#95E6CB' + white: '#C7C7C7' # Bright colors bright: - black: '0x5c6370' - red: '0xe06c75' - green: '0x98c379' - yellow: '0xd19a66' - blue: '0x61afef' - magenta: '0xc678dd' - cyan: '0x56b6c2' - white: '0xffffff' + black: '#686868' + red: '#F27983' + green: '#A6CC70' + yellow: '#FFCC66' + blue: '#5CCFE6' + magenta: '#FFEE99' + cyan: '#95E6CB' + white: '#FFFFFF' diff --git a/alacritty/.config/alacritty/themes/light.yml b/alacritty/.config/alacritty/themes/light.yml index 1718fd9..f0ecac8 100644 --- a/alacritty/.config/alacritty/themes/light.yml +++ b/alacritty/.config/alacritty/themes/light.yml @@ -1,24 +1,27 @@ +# ayu-light colors: primary: - background: '0xf8f8f8' - foreground: '0x2a2b33' + background: '0xfafafa' + foreground: '0x5b6672' + # Normal colors normal: - black: '0x000000' - red: '0xde3d35' - green: '0x3e953a' - yellow: '0xd2b67b' - blue: '0x2f5af3' - magenta: '0xa00095' - cyan: '0x3e953a' - white: '0xbbbbbb' + black: '0x000000' #0 + red: '0xf2590b' #1 + green: '0x76cc00' #2 + yellow: '0xf29717' #3 + blue: '0x41a5d9' #4 + magenta: '0x9965cc' #5 + cyan: '0x4dbf98' #6 + white: '0xc7c7c7' #7 + # Bright colors bright: - black: '0x000000' - red: '0xde3d35' - green: '0x3e953a' - yellow: '0xd2b67b' - blue: '0x2f5af3' - magenta: '0xa00095' - cyan: '0x3e953a' - white: '0xffffff' + black: '0x676767' + red: '0xd6646a' #9 + green: '0xa3d900' #10 + yellow: '0xe7c446' #11 + blue: '0x6871ff' #12 + magenta: '0xa37acc' #13 + cyan: '0x56d9ad' #14 + white: '0xfeffff' #15 diff --git a/alacritty/.config/alacritty/themes/solarized-dark.yml b/alacritty/.config/alacritty/themes/solarized-dark.yml deleted file mode 100644 index 36aebf9..0000000 --- a/alacritty/.config/alacritty/themes/solarized-dark.yml +++ /dev/null @@ -1,28 +0,0 @@ - # Colors (Solarized Dark) -colors: - # Default colors - primary: - background: '0x002b36' - foreground: '0x839496' - - # Normal colors - normal: - black: '0x073642' - red: '0xdc322f' - green: '0x859900' - yellow: '0xb58900' - blue: '0x268bd2' - magenta: '0xd33682' - cyan: '0x2aa198' - white: '0xeee8d5' - - # Bright colors - bright: - black: '0x002b36' - red: '0xcb4b16' - green: '0x586e75' - yellow: '0x657b83' - blue: '0x839496' - magenta: '0x6c71c4' - cyan: '0x93a1a1' - white: '0xfdf6e3' diff --git a/alacritty/.config/alacritty/themes/solarized-light.yml b/alacritty/.config/alacritty/themes/solarized-light.yml deleted file mode 100644 index f111ab1..0000000 --- a/alacritty/.config/alacritty/themes/solarized-light.yml +++ /dev/null @@ -1,28 +0,0 @@ - # Colors (Solarized Light) -colors: - # Default colors - primary: - background: '0xfdf6e3' - foreground: '0x586e75' - - # Normal colors - normal: - black: '0x073642' - red: '0xdc322f' - green: '0x859900' - yellow: '0xb58900' - blue: '0x268bd2' - magenta: '0xd33682' - cyan: '0x2aa198' - white: '0xeee8d5' - - # Bright colors - bright: - black: '0x002b36' - red: '0xcb4b16' - green: '0x586e75' - yellow: '0x657b83' - blue: '0x839496' - magenta: '0x6c71c4' - cyan: '0x93a1a1' - white: '0xfdf6e3' diff --git a/atomaka/.config/atomaka/color.sample.yml b/atomaka/.config/atomaka/color.sample.yml deleted file mode 100644 index 4520e2f..0000000 --- a/atomaka/.config/atomaka/color.sample.yml +++ /dev/null @@ -1 +0,0 @@ -dark diff --git a/bin/bin/, b/bin/bin/, deleted file mode 100755 index 785848e..0000000 --- a/bin/bin/, +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -function find-local-bin { - local readonly prefix=$1; shift - local bin_dir="$prefix-bin" - local found_bin_dir="" - - current_dir=$(pwd) - found_bin_dir=$current_dir/$bin_dir - while [ ! -d $found_bin_dir ]; do - if [[ $current_dir == $HOME ]]; then - found_bin_dir=$HOME/bin - break - fi - - current_dir=$(realpath "$current_dir/..") - found_bin_dir=$current_dir/$bin_dir - done - - echo $found_bin_dir -} - -dir=$(find-local-bin aet) - -exec $dir/$@ diff --git a/bin/bin/colors b/bin/bin/colors deleted file mode 100755 index 81db6af..0000000 --- a/bin/bin/colors +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash -# -# This file echoes a bunch of 24-bit color codes -# to the terminal to demonstrate its functionality. -# The foreground escape sequence is ^[38;2;;;m -# The background escape sequence is ^[48;2;;;m -# range from 0 to 255 inclusive. -# The escape sequence ^[0m returns output to default - -setBackgroundColor() -{ - echo -en "\x1b[48;2;$1;$2;$3""m" -} - -resetOutput() -{ - echo -en "\x1b[0m\n" -} - -# Gives a color $1/255 % along HSV -# Who knows what happens when $1 is outside 0-255 -# Echoes "$red $green $blue" where -# $red $green and $blue are integers -# ranging between 0 and 255 inclusive -rainbowColor() -{ - let h=$1/43 - let f=$1-43*$h - let t=$f*255/43 - let q=255-t - - if [ $h -eq 0 ] - then - echo "255 $t 0" - elif [ $h -eq 1 ] - then - echo "$q 255 0" - elif [ $h -eq 2 ] - then - echo "0 255 $t" - elif [ $h -eq 3 ] - then - echo "0 $q 255" - elif [ $h -eq 4 ] - then - echo "$t 0 255" - elif [ $h -eq 5 ] - then - echo "255 0 $q" - else - # execution should never reach here - echo "0 0 0" - fi -} - -for i in `seq 0 127`; do - setBackgroundColor $i 0 0 - echo -en " " -done -resetOutput -for i in `seq 255 128`; do - setBackgroundColor $i 0 0 - echo -en " " -done -resetOutput - -for i in `seq 0 127`; do - setBackgroundColor 0 $i 0 - echo -n " " -done -resetOutput -for i in `seq 255 128`; do - setBackgroundColor 0 $i 0 - echo -n " " -done -resetOutput - -for i in `seq 0 127`; do - setBackgroundColor 0 0 $i - echo -n " " -done -resetOutput -for i in `seq 255 128`; do - setBackgroundColor 0 0 $i - echo -n " " -done -resetOutput - -for i in `seq 0 127`; do - setBackgroundColor `rainbowColor $i` - echo -n " " -done -resetOutput -for i in `seq 255 128`; do - setBackgroundColor `rainbowColor $i` - echo -n " " -done -resetOutput - diff --git a/bin/bin/git-checkout-all b/bin/bin/git-checkout-all deleted file mode 100755 index 4523e45..0000000 --- a/bin/bin/git-checkout-all +++ /dev/null @@ -1,3 +0,0 @@ -for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do - git branch --track "${branch##*/}" "$branch" -done diff --git a/bin/bin/cs b/bin/bin/toggle-color-mode similarity index 83% rename from bin/bin/cs rename to bin/bin/toggle-color-mode index b908a54..c3ed4c5 100755 --- a/bin/bin/cs +++ b/bin/bin/toggle-color-mode @@ -1,6 +1,10 @@ #!/bin/bash color_file=$HOME/.config/atomaka/color.yml +if ! test -f $color_file; then + mkdir -p $HOME/.config/atomaka + echo light > $color_file +fi old_color=$(cat $color_file) if [[ $old_color == "dark" ]]; then @@ -16,7 +20,3 @@ echo $alacritty_header > $alacritty/alacritty.yml cat $alacritty/alacritty-base.yml $alacritty/themes/$new_color.yml >> $alacritty/alacritty.yml echo $new_color > $color_file - -if [[ $TMUX ]]; then - tmux source-file $HOME/.tmux/${new_color}.conf -fi diff --git a/git/.gitignore_global b/git/.config/git/gitignore_global similarity index 75% rename from git/.gitignore_global rename to git/.config/git/gitignore_global index 6461d43..fdf20ce 100644 --- a/git/.gitignore_global +++ b/git/.config/git/gitignore_global @@ -1,8 +1,5 @@ *.sw? -*.o *.exe -*.stackdump -*.out *.DS_Store .envrc diff --git a/git/.gitattributes_global b/git/.gitattributes_global deleted file mode 100644 index e2118f8..0000000 --- a/git/.gitattributes_global +++ /dev/null @@ -1 +0,0 @@ -*.yml.enc diff=enc diff --git a/git/.gitconfig b/git/.gitconfig index 4acde3f..00c5bfc 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -1,60 +1,33 @@ -[user] - email = atomaka@gmail.com - name = Andrew Tomaka - signingkey = 61209BF70A5B18BE -[github] - user = atomaka - -[includeIf "gitdir:~/Source/benefitbay/"] - path = ~/.gitconfig_work - -[apply] - whitespace = fix [alias] fancy-graph = log --graph --decorate --pretty=oneline --abbrev-commit hist = log --graph --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative hist-details = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat hist-tags = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative most-recent-by-branch = for-each-ref --sort=committerdate refs/heads/ --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))' - undo = reset --soft HEAD^ -[color] - ui = auto -[color "branch"] - current = yellow reverse - local = yellow - remote = green -[color "diff"] - frag = magenta - new = green - old = red - meta = yellow bold -[color "status"] - added = yellow - changed = green - untracked = cyan + [commit] gpgsign = true + [core] autocrlf = input - excludesfile = ~/.gitignore_global - attributesfile = ~/.gitattributes_global - filemode = false + excludesfile = ~/.config/git/gitignore_global + +[github] + username = atomaka + [gpg] program = gpg + [merge] tool = vimdiff -[push] - default = upstream + +[pull] + rebase = false + [status] showUntrackedFiles = all - # show all files instead of just directories -[transfer] - fsckobjects = false - # https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0 -[diff "enc"] - textconv = bundle exec rails encrypted:show - cachetextconv = false -[pull] - rebase = false -[init] - defaultBranch = master + +[user] + email = atomaka@gmail.com + name = Andrew Tomaka + signingkey = 61209BF70A5B18BE diff --git a/git/.gitconfig_work b/git/.gitconfig_work deleted file mode 100644 index b9215a5..0000000 --- a/git/.gitconfig_work +++ /dev/null @@ -1,2 +0,0 @@ -[user] - email = andrew.tomaka@benefitbay.com diff --git a/remove-symlinks b/remove-symlinks deleted file mode 100755 index 8de0cdf..0000000 --- a/remove-symlinks +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -find $HOME -maxdepth 1 -type l | while IFS= read -r symlink; do - if readlink "$symlink" | grep -q 'dotfiles'; then - echo "removing $symlink" - rm "$symlink" - fi -done diff --git a/tmux-256color.src b/tmux-256color.src deleted file mode 100644 index c86d433..0000000 --- a/tmux-256color.src +++ /dev/null @@ -1,67 +0,0 @@ -# Reconstructed via infocmp from file: /Users/atomaka/.terminfo/74/tmux-256color -tmux-256color|tmux with 256 colors, - OTbs, OTpt, am, hs, km, mir, msgr, xenl, AX, G0, - colors#256, cols#80, it#8, lines#24, pairs#4096, U8#1, - acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, - clear=\E[H\E[J, cnorm=\E[34h\E[?25h, cr=^M, - csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, - cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, - cvvis=\E[34l, dch=\E[%p1%dP, dch1=\E[P, dim=\E[2m, - dl=\E[%p1%dM, dl1=\E[M, dsl=\E]0;\007, ed=\E[J, el=\E[K, - el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, fsl=^G, home=\E[H, - hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, - il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, - invis=\E[8m, is2=\E)0, kDC=\E[3;2~, kEND=\E[1;2F, - kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, - kPRV=\E[5;2~, kRIT=\E[1;2C, kbs=^H, kcbt=\E[Z, kcub1=\EOD, - kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, - kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[1;2P, kf14=\E[1;2Q, kf15=\E[1;2R, - kf16=\E[1;2S, kf17=\E[15;2~, kf18=\E[17;2~, - kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, - kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, - kf25=\E[1;5P, kf26=\E[1;5Q, kf27=\E[1;5R, kf28=\E[1;5S, - kf29=\E[15;5~, kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, - kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, - kf35=\E[23;5~, kf36=\E[24;5~, kf37=\E[1;6P, kf38=\E[1;6Q, - kf39=\E[1;6R, kf4=\EOS, kf40=\E[1;6S, kf41=\E[15;6~, - kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, - kf45=\E[20;6~, kf46=\E[21;6~, kf47=\E[23;6~, - kf48=\E[24;6~, kf49=\E[1;3P, kf5=\E[15~, kf50=\E[1;3Q, - kf51=\E[1;3R, kf52=\E[1;3S, kf53=\E[15;3~, kf54=\E[17;3~, - kf55=\E[18;3~, kf56=\E[19;3~, kf57=\E[20;3~, - kf58=\E[21;3~, kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, - kf61=\E[1;4P, kf62=\E[1;4Q, kf63=\E[1;4R, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, - kind=\E[1;2B, kmous=\E[M, knp=\E[6~, kpp=\E[5~, - kri=\E[1;2A, nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, - ri=\EM, ritm=\E[23m, rmacs=^O, rmcup=\E[?1049l, rmir=\E[4l, - rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, - rs2=\Ec\E[?1000l\E[?25h, sc=\E7, - setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, - setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, sitm=\E[3m, smacs=^N, smcup=\E[?1049h, - smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - tbc=\E[3g, tsl=\E]0;, vpa=\E[%i%p1%dd, Cr=\E]112\007, - Cs=\E]12;%p1%s\007, E0=\E(B, E3=\E[3J, - Ms=\E]52;%p1%s;%p2%s\007, S0=\E(%p1%c, Se=\E[2 q, - Smulx=\E[4\:%p1%dm, Ss=\E[%p1%d q, TS=\E]0;, - kDC3=\E[3;3~, kDC4=\E[3;4~, kDC5=\E[3;5~, kDC6=\E[3;6~, - kDC7=\E[3;7~, kDN=\E[1;2B, kDN3=\E[1;3B, kDN4=\E[1;4B, - kDN5=\E[1;5B, kDN6=\E[1;6B, kDN7=\E[1;7B, kEND3=\E[1;3F, - kEND4=\E[1;4F, kEND5=\E[1;5F, kEND6=\E[1;6F, - kEND7=\E[1;7F, kHOM3=\E[1;3H, kHOM4=\E[1;4H, - kHOM5=\E[1;5H, kHOM6=\E[1;6H, kHOM7=\E[1;7H, - kIC3=\E[2;3~, kIC4=\E[2;4~, kIC5=\E[2;5~, kIC6=\E[2;6~, - kIC7=\E[2;7~, kLFT3=\E[1;3D, kLFT4=\E[1;4D, - kLFT5=\E[1;5D, kLFT6=\E[1;6D, kLFT7=\E[1;7D, - kNXT3=\E[6;3~, kNXT4=\E[6;4~, kNXT5=\E[6;5~, - kNXT6=\E[6;6~, kNXT7=\E[6;7~, kPRV3=\E[5;3~, - kPRV4=\E[5;4~, kPRV5=\E[5;5~, kPRV6=\E[5;6~, - kPRV7=\E[5;7~, kRIT3=\E[1;3C, kRIT4=\E[1;4C, - kRIT5=\E[1;5C, kRIT6=\E[1;6C, kRIT7=\E[1;7C, kUP=\E[1;2A, - kUP3=\E[1;3A, kUP4=\E[1;4A, kUP5=\E[1;5A, kUP6=\E[1;6A, - kUP7=\E[1;7A, rmxx=\E[29m, smxx=\E[9m, diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf new file mode 100644 index 0000000..39826a8 --- /dev/null +++ b/tmux/.config/tmux/tmux.conf @@ -0,0 +1,35 @@ +bind-key r source-file ~/.config/tmux/tmux.conf \; display-message " ✱ tmux.conf is reloaded" + +# for muxception +bind-key b send-prefix + +set -g automatic-rename off +set -g renumber-windows on +set-option -sg escape-time 10 +set-option -g base-index 1 +set-window-option -g monitor-activity off +set-window-option -g pane-base-index 1 + +bind-key C-b last-window + +bind < resize-pane -L 10 +bind > resize-pane -R 10 +bind - resize-pane -D 10 +bind + resize-pane -U 10 + +# status bar stuff +set -g status on +set -g status-left '#H ' +set-option -g status-right '%Y-%m-%d @ %k:%M' + +# be more like vim +set-window-option -g mode-keys vi + +unbind c; bind c new-window -c "#{pane_current_path}" +bind s split-window -v -c "#{pane_current_path}" +bind v split-window -h -c "#{pane_current_path}" + +bind h select-pane -L # left pane +bind j select-pane -D # bottom pane +bind k select-pane -U # top pane +bind l select-pane -R # right pane diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf deleted file mode 100644 index 4ac8957..0000000 --- a/tmux/.tmux.conf +++ /dev/null @@ -1,70 +0,0 @@ -# for setting up -bind-key r source-file ~/.tmux.conf \; display-message " ✱ ~/.tmux.conf is reloaded" - -# fixup some colors -set -g default-terminal "tmux-256color" -set -ag terminal-overrides ",xterm-256color:RGB" - -set-option -g default-shell /opt/homebrew/bin/zsh - -# faster escaping? From neovim CheckHealth -set-option -sg escape-time 10 - -# double tap for back and forth -bind-key C-b last-window - -# for muxception -bind-key b send-prefix - -# close window -bind q confirm kill-window - -# clear history -bind -n C-g clear-history - -# 0 is way over there -set-option -g base-index 1 -setw -g pane-base-index 1 - -# history should be longer -set -g history-limit 100000 - -# no autorename -set -g automatic-rename off - -# renumber windows -set -g renumber-windows on - -# move windows around -bind H swap-window -t -1 -bind L swap-window -t +1 - -# activity stuff -set-window-option -g monitor-activity off - -# copy mode stuff -set-window-option -g mode-keys vi # emulate vim movement in copy mode - -# be more like vim -bind h select-pane -L # left pane -bind j select-pane -D # bottom pane -bind k select-pane -U # top pane -bind l select-pane -R # right pane - -bind < resize-pane -L 10 -bind > resize-pane -R 10 -bind - resize-pane -D 10 -bind + resize-pane -U 10 - -# status bar stuff -set -g status on -set -g status-left '#[fg=green]#H' -set-option -g status-right '%Y-%m-%d @ %k:%M' - -# 1.9 stuff moved in here -unbind c; bind c new-window -c "#{pane_current_path}" -bind s split-window -v -c "#{pane_current_path}" -bind v split-window -h -c "#{pane_current_path}" - -# load current scheme -run-shell "bash ~/.tmux/startup" diff --git a/tmux/.tmux/dark.conf b/tmux/.tmux/dark.conf deleted file mode 100644 index 294b012..0000000 --- a/tmux/.tmux/dark.conf +++ /dev/null @@ -1,29 +0,0 @@ -#### COLOUR (Solarized dark) - -# default statusbar colors -set-option -g status-style fg=yellow,bg=black #yellow and base02 - -# default window title colors -set-window-option -g window-status-style fg=brightblue,bg=default #base0 and default -#set-window-option -g window-status-style dim - -# active window title colors -set-window-option -g window-status-current-style fg=brightred,bg=default #orange and default -#set-window-option -g window-status-current-style bright - -# pane border -set-option -g pane-border-style fg=black #base02 -set-option -g pane-active-border-style fg=brightgreen #base01 - -# message text -set-option -g message-style fg=brightred,bg=black #orange and base01 - -# pane number display -set-option -g display-panes-active-colour blue #blue -set-option -g display-panes-colour brightred #orange - -# clock -set-window-option -g clock-mode-colour green #green - -# bell -set-window-option -g window-status-bell-style fg=black,bg=red #base02, red diff --git a/tmux/.tmux/light.conf b/tmux/.tmux/light.conf deleted file mode 100644 index 7e710e7..0000000 --- a/tmux/.tmux/light.conf +++ /dev/null @@ -1,29 +0,0 @@ -#### COLOUR (Solarized light) - -# default statusbar colors -set-option -g status-style fg=yellow,bg=white #yellow and base2 - -# default window title colors -set-window-option -g window-status-style fg=brightyellow,bg=default #base0 and default -#set-window-option -g window-status-style dim - -# active window title colors -set-window-option -g window-status-current-style fg=brightred,bg=default #orange and default -#set-window-option -g window-status-current-style bright - -# pane border -set-option -g pane-border-style fg=white #base2 -set-option -g pane-active-border-style fg=brightcyan #base1 - -# message text -set-option -g message-style fg=brightred,bg=white #orange and base2 - -# pane number display -set-option -g display-panes-active-colour blue #blue -set-option -g display-panes-colour brightred #orange - -# clock -set-window-option -g clock-mode-colour green #green - -# bell -set-window-option -g window-status-bell-style fg=white,bg=red #base2, red diff --git a/tmux/.tmux/solarized-dark.conf b/tmux/.tmux/solarized-dark.conf deleted file mode 100644 index 294b012..0000000 --- a/tmux/.tmux/solarized-dark.conf +++ /dev/null @@ -1,29 +0,0 @@ -#### COLOUR (Solarized dark) - -# default statusbar colors -set-option -g status-style fg=yellow,bg=black #yellow and base02 - -# default window title colors -set-window-option -g window-status-style fg=brightblue,bg=default #base0 and default -#set-window-option -g window-status-style dim - -# active window title colors -set-window-option -g window-status-current-style fg=brightred,bg=default #orange and default -#set-window-option -g window-status-current-style bright - -# pane border -set-option -g pane-border-style fg=black #base02 -set-option -g pane-active-border-style fg=brightgreen #base01 - -# message text -set-option -g message-style fg=brightred,bg=black #orange and base01 - -# pane number display -set-option -g display-panes-active-colour blue #blue -set-option -g display-panes-colour brightred #orange - -# clock -set-window-option -g clock-mode-colour green #green - -# bell -set-window-option -g window-status-bell-style fg=black,bg=red #base02, red diff --git a/tmux/.tmux/solarized-light.conf b/tmux/.tmux/solarized-light.conf deleted file mode 100644 index 7e710e7..0000000 --- a/tmux/.tmux/solarized-light.conf +++ /dev/null @@ -1,29 +0,0 @@ -#### COLOUR (Solarized light) - -# default statusbar colors -set-option -g status-style fg=yellow,bg=white #yellow and base2 - -# default window title colors -set-window-option -g window-status-style fg=brightyellow,bg=default #base0 and default -#set-window-option -g window-status-style dim - -# active window title colors -set-window-option -g window-status-current-style fg=brightred,bg=default #orange and default -#set-window-option -g window-status-current-style bright - -# pane border -set-option -g pane-border-style fg=white #base2 -set-option -g pane-active-border-style fg=brightcyan #base1 - -# message text -set-option -g message-style fg=brightred,bg=white #orange and base2 - -# pane number display -set-option -g display-panes-active-colour blue #blue -set-option -g display-panes-colour brightred #orange - -# clock -set-window-option -g clock-mode-colour green #green - -# bell -set-window-option -g window-status-bell-style fg=white,bg=red #base2, red diff --git a/tmux/.tmux/startup b/tmux/.tmux/startup deleted file mode 100755 index ddeaa8f..0000000 --- a/tmux/.tmux/startup +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -startup_color=$(cat $HOME/.config/atomaka/color.yml) - -tmux source-file $HOME/.tmux/$startup_color.conf diff --git a/vim/.config/vim/undo/.gitinclude b/vim/.config/vim/undo/.gitinclude new file mode 100644 index 0000000..e69de29 diff --git a/vim/.vimrc b/vim/.vimrc index 4ccbbe8..26de0ca 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -1,112 +1,51 @@ -" PLUGINS call plug#begin('~/.vim/plugged') -" colors -Plug 'altercation/vim-colors-solarized' -Plug 'rakr/vim-one' - -" keepers -Plug 'airblade/vim-gitgutter' -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' -Plug 'ntpeters/vim-better-whitespace' +Plug 'chrisbra/matchit' +Plug 'junegunn/fzf' Plug 'moll/vim-bbye' -Plug 'tpope/vim-eunuch' " move files -Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-fugitive' +Plug 'ntpeters/vim-better-whitespace' +Plug 'tpope/vim-eunuch' Plug 'tpope/vim-surround' Plug 'troydm/zoomwintab.vim' -Plug 'chrisbra/matchit' " languages -Plug 'leafgarland/typescript-vim' -Plug 'tpope/vim-markdown' Plug 'tpope/vim-rails' Plug 'vim-ruby/vim-ruby' -Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' } -Plug 'hashivim/vim-terraform' - -" Testing call plug#end() + +" SETTINGS filetype plugin indent on -" STATUS LINE -set statusline= -set statusline+=%<\ %f%{ZoomState()} -set statusline+=\ %m%r%y%w%= " what am i doing here -set statusline+=\ Line:\ %l\/%L\ [%p%%] -set statusline+=\ Col:\ %v -set statusline+=\ Buf:\ #%n -set statusline+=\ " trailing space is with purpose - -" OPTIONS -set fileformats=unix,mac,dos " File format prefer unix endings -set endofline " Add newline at end of file -set shellslash " Forward slashes -set nobackup " No backup files -set noswapfile " Hope for the best -set formatoptions=crq -set textwidth=80 -set cpoptions+=$ " delimit end of change text -set laststatus=2 " Always show status line -set showmode " Show current mode -set history=100 " History length -set nowrap " Disable wrapping by default set backspace=2 " Backspace over indent, eol, start of insert -set hlsearch " Search highlights -set wrapscan " Wrapped search -set incsearch " Search as you type -set ignorecase " Ignore case with search -set smartcase " Search will not ignore uppercase -set showcmd " Show command as you type -set ruler " Show cursor position -set autoindent " autoindent AND be smart about it -set smartindent -set colorcolumn=80,120 " Ruler at line 80, 120 -set nomodeline -set relativenumber " Relative line numbers -set number -set virtualedit=all " Cursor can go anywhere +set cpoptions+=$ " delimit end of change text +set endofline " Add newline to end of file +set nobackup +set noswapfile +set nowrap " Disable wrapping by default set scrolloff=3 " Keep cursor from touching edges +set showmode " Show current mode set timeoutlen=500 " Don't wait too long (ambiguous leaders) -set showmatch " Show matching brackets -set hidden " Allow unsaved buffers to be hidden -set wildcharm= " Allow use of tab in macros -set wildmenu " Command line completion -set wildmode=list:longest,full " Better file completion -set infercase " Adjust completions to match case -set wildignorecase " Ignore case on commandline -set autowrite " Save file when focus is lost -set updatetime=250 " Make gitgutter autoupdate +set virtualedit=all " Cursor can go anywhere + +set hlsearch " Search highlights +set ignorecase " Ignore case with search +set incsearch " Search as you type +set smartcase " Search will not ignore uppercase +set wrapscan " Wrapped search + +set number +set relativenumber " Relative line numbers + +set textwidth=80 +set colorcolumn=80,120 " Ruler at line 80, 120 + " Tabs are 2 spaces set tabstop=2 set softtabstop=2 set shiftwidth=2 set expandtab set shiftround " make >> go to next tab -" some performance stuff -set lazyredraw -set ttyfast -set synmaxcol=256 -" Show whitespace markers before cursor in insert mode -set list listchars=tab:\ \ ,trail:· -" Ignore stuff -set wildignore+=*/\.git/* -" Java -" set wildignore+=*/build/*,*/grade/*,*\.class -" Frontend -set wildignore+=*/node_modules/*,*/bower_components/*,*/dist/* -" Persistent undo stuff -if has('persistent_undo') - set undolevels=5000 - set undodir=$HOME/.vim/undo - set undofile -endif - -" KEYBINDS -" quick replaceement -nmap S :%s//g " consistency is key - Y should act like C, D map Y y$ @@ -115,70 +54,51 @@ map Y y$ vnoremap > >gv vnoremap < :Files +" typo-city +:command W w +:command Wq wq -" ZoomWin -nnoremap z :ZoomWinTabToggle -nnoremap :ZoomWinTabToggle - -" Fugitive -autocmd FileType fugitiveblame nmap q gq -command! Gblame :G blame +" quick replaceement +nmap S :%s//g " LEADERS let mapleader = "," -" tab swaps -map 2 :set tabstop=2 softtabstop=2 shiftwidth=2 expandtab -map 4 :set tabstop=4 softtabstop=4 shiftwidth=4 expandtab -map a :set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab +map sz :so ~/.vimrc -" plugin +" copy/paste (system buffer) +map cp "+y +map pa "+p + +" clear search +map cs :let @/ = "" + +" github +map gg :exe "!hub gist create -o %:p" + +" PLUGIN CONFIGURATION +" fzf +let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' +noremap :FZF + +" vim-bbye +nnoremap bd :Bdelete + +" vim-better-whitespace +highlight ExtraWhitespace ctermbg=red +map fw :StripWhitespace + +" vim-eunuch +map sa :Move % + +" vim-plug map pc :PlugClean map pi :PlugInstall map pu :PlugUpdate -" clear search -map cs :let @/ = "" -" bclose -nnoremap bd :Bdelete - -" other -map cp "+y -map pa "+p -map fj :%!python -m json.tool -map fw :StripWhitespace -map gg :exe "!hub gist create -o %:p" -map gi :GoImports -map pm :set paste! -map sa :Move % -map sb :exe "!code --goto %:p:" . line(".") -map se :e ~/.vimrc -map sc :pclose -map sw :SudoWrite -map sz :so ~/.vimrc - -" PLUGIN CONFIGURATION -set cursorline " Highlight current line -set cursorcolumn " Highlight current column - -let &t_8f = "\[38:2:%lu:%lu:%lum" -let &t_8b = "\[48:2:%lu:%lu:%lum" -set termguicolors -syntax enable -colorscheme one - -highlight ExtraWhitespace ctermbg=196 - -" fzf -let $FZF_DEFAULT_COMMAND = 'ag --hidden --ignore .git -g ""' -let g:fzf_preview_window = [] - -" terraform -let g:terraform_align=1 - -" ZoomWin +" zoomwintab +nnoremap z :ZoomWinTabToggle +nnoremap :ZoomWinTabToggle function! ZoomState() if exists('t:zoomwintab') return 'Z' diff --git a/zsh/.aliases-mac b/zsh/.aliases-mac deleted file mode 100644 index 026c0b0..0000000 --- a/zsh/.aliases-mac +++ /dev/null @@ -1,2 +0,0 @@ -alias google-chrome="open -a Google\ Chrome" -alias fixbar="killall ControlStrip" diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..ffb757e --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,32 @@ +typeset -U PATH + +source $ZDOTDIR/aliases +source $ZDOTDIR/functions + +source $ZDOTDIR/prompt + +# Larger history +HISTSIZE=20000 +HISTFILE=~/.zsh_history +SAVEHIST=20000 + +# be like vim +bindkey -v + +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' + +setopt auto_cd + +if which direnv > /dev/null; then + eval "$(direnv hook zsh)" +fi + +if which rbenv > /dev/null; then + eval "$(rbenv init --no-rehash -)" + (rbenv rehash &) 2> /dev/null +fi + +if which nodenv > /dev/null; then + eval "$(nodenv init --no-rehash -)" + (nodenv rehash &) 2> /dev/null +fi diff --git a/zsh/.aliases b/zsh/.config/zsh/aliases similarity index 55% rename from zsh/.aliases rename to zsh/.config/zsh/aliases index 017e698..b798bc4 100644 --- a/zsh/.aliases +++ b/zsh/.config/zsh/aliases @@ -1,9 +1,4 @@ -alias zbm="/usr/bin/time zsh -i -c exit" - alias ..="cd .." -alias ...="cd ../.." -alias ....="cd ../../.." -alias .....="cd ../../../.." alias a="ls -l --human-readable --all --color=auto" alias agc="ag-count" alias agh="ag --hidden" @@ -14,21 +9,16 @@ alias be="bundle exec" alias bea="bundle exec rails" alias ber="bundle exec rake" alias bet="test-rails" -alias betd="bundle exec rspec --format documentation" alias c="clear" -alias dc="docker compose" -alias dft="docker run --rm --privileged alpine hwclock -s" -alias g="g" # overwrite g alias in git plugin so function will work +alias cs="toggle-color-mode" +alias dc="docker-compose-call" +alias g="g" # overwrite g alias alias ga="git add" alias gaa="git add --all" alias gap="git add --patch" alias gb="git branch" -alias gbc="git-branch-cleanup" -alias gbda="git branch | grep -v master | xargs git branch -D" -alias gbdm="git-branch-delete-merged" alias gc="git commit" alias gca="git commit --amend" -alias gcm="echo Do not specify message at command line. Use gc" alias gcn="git commit --allow-empty --message 'noop'" alias gco="git checkout" alias gcp="git cherry-pick" @@ -37,11 +27,7 @@ alias gct="git commit -m '( ͡° ͜ʖ ͡°)'" alias gd="git diff" alias gdc="git diff --cached" alias gds="git diff --stat" -alias gdss="git diff --shortstat" alias gfa="git-date-added" -alias gfl="git log --patch" -alias gg="hub gist create --browse" -alias gi="gitignore-io" alias gl="git fancy-graph" alias ghi="git hist" alias ghd="git hist-details" @@ -63,40 +49,19 @@ alias grbi="git rebase --interactive" alias grc="git rm --cached" alias grh="git reset --hard" alias grm="git rm" -alias gs="git status" -alias gu="git undo" alias gup="git-branch-delete-merged" -alias gw="git diff --check" alias Grep='grep' alias l="ls" alias ll="ls -lv --human-readable --color=auto" alias ls="ls --color=auto" alias m="more" -alias md="cd ~/dotfiles > /dev/null 2>&1; make; cd -1 > /dev/null 2>&1" alias mf="mkdir" -alias mw="tmux new-session -A -s work" -alias ne="npm-exec" -alias pf="port-forward" +alias mw="tmux attach || tmux -f $HOME/.config/tmux/tmux.conf" alias pwdgen="password-generator" -alias r="ssh" -alias rd="popd" alias s="cd ~/Source" -alias sci="ssh-copy-id -i .ssh/id_rsa.pub" -alias sd="pwd | pushd" -alias subl="code" -alias sw="stopwatch" -alias sz="source ~/.zshrc" -alias pf="port-forward" -alias t="tmux new-session -A -s" +alias sz="source $ZDOTDIR/.zshrc" alias tf="terraform" -alias tls="tmux list-sessions" -alias ts="tmuxinator start" alias v="$EDITOR" -alias w="ruby -rwebrick -e'WEBrick::HTTPServer.new(:Port => 8000, :DocumentRoot => Dir.pwd).start'" +alias w="ruby -rwebrick -e'WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: Dir.pwd).start'" alias wo="curl 'http://wttr.in/48823'" -alias y="yarn" -alias ya="yarn add" -alias yad="yarn add --dev" -alias ye="yarn-exec" -alias yi="yarn-install-like-bundle" alias x="exit" diff --git a/zsh/.config/zsh/functions b/zsh/.config/zsh/functions new file mode 100644 index 0000000..d6bacc7 --- /dev/null +++ b/zsh/.config/zsh/functions @@ -0,0 +1,78 @@ +function ag-count { + if [ $# -lt 1 ]; then + echo Usage: ag-count SEARCHTERM + else + searchterm=$1; shift + + ag --stats $searchterm | tail -n5 + fi +} + +function aws-profile { + if [ $# -eq 0 ]; then + echo Current AWS Profile: $AWS_DEFAULT_PROFILE + else + export AWS_DEFAULT_PROFILE=$1 + export AWS_PROFILE=$1 + fi +} + +function docker-compose-call { + if docker compose > /dev/null 2>&1; then + docker compose $@ + else + docker-compose $@ + fi +} + +function g { + if [[ $# > 0 ]]; then + git $@ + else + git status + fi +} + +function git-date-added { + if [ $# -eq 0 ]; then + echo Usage: git-date-added FILENAME + else + git log --format=%aD $1 | tail -1 + fi +} + +function password-generator { + if [ -x "$(command -v openssl)" ]; then + password=$( + openssl rand -base64 32 \ + | head -c 32 + ) + else + password=$( + date +%s \ + | sha256sum \ + | base64 \ + | head -c 32 + ) + fi + + echo $password +} + +function test-rails { + if bundle exec rspec --help > /dev/null 2>&1; then + if [ -d spec ]; then + bundle exec rspec $@ + else + ruby *_test.rb + fi + elif bundle exec rails version > /dev/null 2>&1; then + bundle exec rails test $@ + else + if [[ $# > 0 ]]; then + ruby $@ + else + ruby *_test.rb + fi + fi +} diff --git a/zsh/.config/zsh/prompt b/zsh/.config/zsh/prompt new file mode 100644 index 0000000..f21419d --- /dev/null +++ b/zsh/.config/zsh/prompt @@ -0,0 +1,4 @@ +local current_dir='%~%f' +local result="%B%(?.%F{green}✓%b.%F{red}✗)%b%f" + +PROMPT="${current_dir} ${result} " diff --git a/zsh/.functions b/zsh/.functions deleted file mode 100644 index 7020e35..0000000 --- a/zsh/.functions +++ /dev/null @@ -1,169 +0,0 @@ -function ag-count { - if [ $# -lt 1 ]; then - echo Usage: ag-count SEARCHTERM - else - searchterm=$1; shift - - ag --stats $searchterm | tail -n5 - fi -} - -function aet-bin-exec { - local readonly script=$1; shift - - ./aet-bin/$script $@ -} - -function aws-profile { - if [ $# -eq 0 ]; then - echo Current AWS Profile: $AWS_DEFAULT_PROFILE - else - export AWS_DEFAULT_PROFILE=$1 - export AWS_PROFILE=$1 - fi -} - -function fix-permissions { - find . -type d -print0 | xargs -0 chmod 0755 - find . -type f -print0 | xargs -0 chmod 0644 -} - -function g { - if [[ $# > 0 ]]; then - git $@ - else - git status - fi -} - -function git-branch-cleanup { - if [ $# -eq 0 ]; then - branch=master - else - branch=$1 - fi - - git branch --merged $branch | grep -v $branch | xargs git branch -d -} - -function git-branch-delete-merged { - git branch --merged \ - | grep -v "\*" \ - | grep -v master \ - | grep -v staging \ - | grep -v development \ - | xargs -n 1 git branch -d -} - -function git-date-added { - if [ $# -eq 0 ]; then - echo Usage: git-date-added FILENAME - else - git log --format=%aD $1 | tail -1 - fi -} - -function gitignore-io { - curl https://www.gitignore.io/api/$@ -} - -function insert-sudo { - zle beginning-of-line - zle -U "sudo " -} - -function npm-exec { - (PATH=$(npm bin):$PATH; eval $@;) -} - -function password-generator { - if [ -x "$(command -v openssl)" ]; then - password=$( - openssl rand -base64 32 \ - | head -c 32 - ) - else - password=$( - date +%s \ - | sha256sum \ - | base64 \ - | head -c 32 - ) - fi - - echo $password -} - -function port-forward { - if [ $# -lt 2 ]; then - echo Usage: port-forward HOST LOCAL_PORT \[REMOTE_PORT\] - else - ssh $1 -R ${3:-$2}":localhost:"$2 -g - fi -} - -function run { - if [ $# -lt 2 ]; then - echo Usage: run NUMBER COMMAND - else - number=$1; shift - - for i in `seq $number`; do - eval "$@" - done - fi -} - -function stopwatch { - date1=`date +%s` - while true; do - echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r" - sleep 0.1 - done -} - -function test-rails { - if bundle exec rspec --help > /dev/null 2>&1; then - if [ -d spec ]; then - bundle exec rspec $@ - else - ruby *_test.rb - fi - elif bundle exec rails version > /dev/null 2>&1; then - bundle exec rails test $@ - else - if [[ $# > 0 ]]; then - ruby $@ - else - ruby *_test.rb - fi - fi -} - -function true-colors { - awk 'BEGIN{ - s="/\\/\\/\\/\\/\\"; s=s s s s s s s s; - for (colnum = 0; colnum<77; colnum++) { - r = 255-(colnum*255/76); - g = (colnum*510/76); - b = (colnum*255/76); - if (g>255) g = 510-g; - printf "\033[48;2;%d;%d;%dm", r,g,b; - printf "\033[38;2;%d;%d;%dm", 255-r,255-g,255-b; - printf "%s\033[0m", substr(s,colnum+1,1); - } - printf "\n"; - }' -} - -function yarn-exec { - (PATH=$(yarn bin):$PATH; eval $@;) -} - -function yarn-install-like-bundle { - if [ -f yarn.lock ]; then - yarn install --pure-lockfile - else - yarn install - fi -} diff --git a/zsh/.zsh-completions/_comma b/zsh/.zsh-completions/_comma deleted file mode 100644 index a2b1beb..0000000 --- a/zsh/.zsh-completions/_comma +++ /dev/null @@ -1,17 +0,0 @@ -#compdef , -local bin_dir="aet-bin" -local found_bin_dir="" - -current_dir=$(pwd) -found_bin_dir=$current_dir/$bin_dir -while [ ! -d $found_bin_dir ]; do - if [[ $current_dir == $HOME ]]; then - found_bin_dir=$HOME/bin - break - fi - - current_dir=$(realpath "$current_dir/..") - found_bin_dir=$current_dir/$bin_dir -done - -_files -g "^," -W $found_bin_dir diff --git a/zsh/.zsh/prompt b/zsh/.zsh/prompt deleted file mode 100644 index 33ede65..0000000 --- a/zsh/.zsh/prompt +++ /dev/null @@ -1,30 +0,0 @@ -local current_time="[%B%D{%T}%b]" -local current_dir='%B%F{blue}%~%f%b' - -# user -local user="%F{green}%n%f" - -# host -local host="" -if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then - host='%F{yellow}%M%f' #SSH -else - host='%F{green}%M%f' # no SSH -fi - -# vcs -precmd() { - setopt promptsubst - autoload -Uz vcs_info - - zstyle ':vcs_info:*' enable git hg svn - zstyle ':vcs_info:*:prompt:*' nvcsformats "" - zstyle ':vcs_info:*:prompt:*' formats "[%F{cyan}%b%f%u%c]" - vcs_info 'prompt' -} -local vcs='${vcs_info_msg_0_}' - -local prompt="%B%(?.%F{green}✓%b.%F{red}✗)%b%f" - -PROMPT="${current_time} ${user}@${host} ${current_dir} ${vcs} - $prompt " diff --git a/zsh/.zshenv b/zsh/.zshenv index f052ceb..5eb83e0 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,40 +1,13 @@ +PERSONAL_BIN_PATH="$HOME/bin" + NODENV_PATH="$HOME/.nodenv/bin" RBENV_PATH="$HOME/.rbenv/bin" -LOCAL_HOME_BIN_PATH="$HOME/.local/bin" -PERSONAL_BIN_PATH="$HOME/bin" -PERSONAL_COMPLETIONS_PATH="$HOME/.zsh-completions" +ZDOTDIR=$HOME/.config/zsh -GNU_TOOLS_PATH="/opt/homebrew/opt/coreutils/libexec/gnubin" -GNU_TOOLS_MAN_PATH="/opt/homebrew/opt/coreutils/libexec/gnuman" - -if [[ "$OSTYPE" == darwin* ]]; then - HOMEBREW_PREFIX="/opt/homebrew"; - HOMEBREW_CELLAR="/opt/homebrew/Cellar"; - HOMEBREW_REPOSITORY="/opt/homebrew"; - - # Added by .zprofile that we've moved - PATH="/usr/local/bin:/Library/Apple/usr/bin:$PATH" - - PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"; - MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"; - INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; - - [[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH" - [[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH" - - GO_DIR="/usr/local/opt/go/libexec" -else - GO_DIR="/usr/local/go/bin" -fi - -# BIN [[ -d "$RBENV_PATH" ]] && PATH="$RBENV_PATH:$PATH" [[ -d "$NODENV_PATH" ]] && PATH="$NODENV_PATH:$PATH" - -[[ -d "$LOCAL_HOME_BIN_PATH" ]] && PATH="$LOCAL_HOME_BIN_PATH:$PATH" [[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH" -[[ -d "$PERSONAL_COMPLETIONS_PATH" ]] && FPATH="$PERSONAL_COMPLETIONS_PATH:$FPATH" # EDITOR EDITOR=vim diff --git a/zsh/.zshrc b/zsh/.zshrc deleted file mode 100644 index 8ccb947..0000000 --- a/zsh/.zshrc +++ /dev/null @@ -1,73 +0,0 @@ -GPG_TTY=$(tty) -export GPG_TTY - -# clean up duplicate paths -typeset -U PATH - -# Larger history -HISTSIZE=20000 -HISTFILE=~/.zsh_history -SAVEHIST=20000 - -# Make sure C-s works in vim -stty start undef -stty stop undef - -# Aliases/Functions files -source $HOME/.aliases -source $HOME/.functions - -source $HOME/.zsh/prompt - -if [[ "$OSTYPE" == darwin* ]]; then - source $HOME/.aliases-mac -fi - -# vim mode -bindkey -v - -# Bind insert_sudo function -zle -N insert-sudo -bindkey "^z" insert-sudo - -# init rbenv -if which rbenv > /dev/null; then - eval "$(rbenv init --no-rehash -)" - (rbenv rehash &) 2> /dev/null -fi - -# init nodenv -if which nodenv > /dev/null; then - eval "$(nodenv init --no-rehash -)" - (nodenv rehash &) 2> /dev/null -fi - -# init direnv -if which direnv > /dev/null; then - eval "$(direnv hook zsh)" -fi - -# completion -autoload -U compinit -autoload bashcompinit && bashcompinit - -autoload compinit -Uz -setopt EXTENDEDGLOB -if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then - compinit -else - compinit -C -fi -unsetopt EXTENDEDGLOB - -setopt completeinword -zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' - -# directory -setopt auto_cd - -# better word definition -autoload -U select-word-style -select-word-style bash - -[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh