From 019f27d538916ec731fb54a08927861d79fa8b1f Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 2 Nov 2021 20:14:26 -0400 Subject: [PATCH] Do some spring cleaning --- Makefile | 7 ++- git/.gitconfig | 6 +-- nvim/.config/init.vim | 3 -- vim/.vimrc | 21 +++----- zsh/.aliases | 17 +++--- zsh/.functions | 121 ++++++++++++++++++++++++------------------ zsh/.zshenv | 43 +++++---------- zsh/.zshrc | 4 -- 8 files changed, 108 insertions(+), 114 deletions(-) delete mode 100644 nvim/.config/init.vim diff --git a/Makefile b/Makefile index 721fa01..513ed44 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ +STOWED = bin git ruby tmux vim zsh + all: install install: plug-vim - stow bin git nvim ruby tmux vim zsh + stow $(STOWED) + +uninstall: + stow -D $(STOWED) plug-vim: if test ! -f ~/.vim/autoload/plug.vim ; then \ diff --git a/git/.gitconfig b/git/.gitconfig index b8f4106..252218e 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -37,7 +37,7 @@ attributesfile = ~/.gitattributes_global filemode = false [gpg] - program = gpg + program = gpg [merge] tool = vimdiff [push] @@ -52,6 +52,6 @@ textconv = bundle exec rails encrypted:show cachetextconv = false [pull] - ff = only + rebase = false [init] - defaultBranch = master + defaultBranch = master diff --git a/nvim/.config/init.vim b/nvim/.config/init.vim deleted file mode 100644 index 0716b3f..0000000 --- a/nvim/.config/init.vim +++ /dev/null @@ -1,3 +0,0 @@ -set runtimepath+=~/.vim,~/.vim/after -set packpath+=~/.vim -source ~/.vimrc diff --git a/vim/.vimrc b/vim/.vimrc index a8f7f76..a84606c 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -2,7 +2,6 @@ call plug#begin('~/.vim/plugged') " colors -Plug 'nanotech/jellybeans.vim' Plug 'joshdick/onedark.vim' " keepers @@ -11,17 +10,15 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } Plug 'junegunn/fzf.vim' Plug 'ntpeters/vim-better-whitespace' Plug 'moll/vim-bbye' -Plug 'ruanyl/vim-gh-line' -Plug 'tpope/vim-endwise' Plug 'tpope/vim-eunuch' " move files Plug 'tpope/vim-fugitive' -Plug 'tpope/vim-git' +Plug 'tpope/vim-fugitive' Plug 'tpope/vim-surround' Plug 'troydm/zoomwintab.vim' +Plug 'chrisbra/matchit' " languages Plug 'leafgarland/typescript-vim' -Plug 'posva/vim-vue' Plug 'tpope/vim-markdown' Plug 'tpope/vim-rails' Plug 'vim-ruby/vim-ruby' @@ -165,14 +162,12 @@ map sz :so ~/.vimrc " style set t_8f=[38;2;%lu;%lu;%lum set t_8b=[48;2;%lu;%lu;%lum -if has('nvim') - set cursorline " Highlight current line - set cursorcolumn " Highlight current column - set termguicolors - colorscheme onedark -else - colorscheme jellybeans -endif + +set cursorline " Highlight current line +set cursorcolumn " Highlight current column + +set termguicolors +colorscheme onedark syntax enable highlight ExtraWhitespace ctermbg=196 diff --git a/zsh/.aliases b/zsh/.aliases index 3d73ef1..f738a85 100644 --- a/zsh/.aliases +++ b/zsh/.aliases @@ -1,3 +1,5 @@ +alias zbm="/usr/bin/time zsh -i -c exit" + alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." @@ -20,9 +22,9 @@ alias ga="git add" alias gaa="git add --all" alias gap="git add --patch" alias gb="git branch" -alias gbc="git branch --merged master | grep -v master | xargs git branch -d" +alias gbc="git-branch-cleanup" alias gbda="git branch | grep -v master | xargs git branch -D" -alias gbdm='git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 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" @@ -43,6 +45,9 @@ alias gl="git fancy-graph" alias ghi="git hist" alias ghd="git hist-details" alias ght="git hist-tags" +alias gm="git merge" +alias gma="git merge --abort" +alias gmc="git merge --continue" alias gmr="git most-recent-by-branch" alias gp="git push" alias gpf="git push --force" @@ -59,26 +64,20 @@ alias grh="git reset --hard" alias grm="git rm" alias gs="git status" alias gu="git undo" -alias gup="git branch --merged | egrep -v '(^\*|master|dev)' | xargs git branch -d" +alias gup="git-branch-delete-merged" alias gw="git diff --check" alias Grep='grep' -alias h='heroku' -alias hp='git push heroku master' -alias hip='heroku logs -n 1500 | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" | sort | uniq' 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 mh="tmux new-session -A -s home" -alias mt="tmuxinator" alias mw="tmux new-session -A -s work" alias ne="npm-exec" alias pf="port-forward" alias pwdgen="password-generator" alias r="ssh" -alias rc="bin/ctrl" alias rd="popd" alias s="cd ~/Source" alias sci="ssh-copy-id -i .ssh/id_rsa.pub" diff --git a/zsh/.functions b/zsh/.functions index 3891b7c..7020e35 100644 --- a/zsh/.functions +++ b/zsh/.functions @@ -1,9 +1,10 @@ -function aws-profile { - if [ $# -eq 0 ]; then - echo Current AWS Profile: $AWS_DEFAULT_PROFILE +function ag-count { + if [ $# -lt 1 ]; then + echo Usage: ag-count SEARCHTERM else - export AWS_DEFAULT_PROFILE=$1 - export AWS_PROFILE=$1 + searchterm=$1; shift + + ag --stats $searchterm | tail -n5 fi } @@ -13,6 +14,15 @@ function aet-bin-exec { ./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 @@ -26,37 +36,23 @@ function g { fi } -function insert-sudo { - zle beginning-of-line - zle -U "sudo " -} - -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 port-forward { - if [ $# -lt 2 ]; then - echo Usage: port-forward HOST LOCAL_PORT \[REMOTE_PORT\] +function git-branch-cleanup { + if [ $# -eq 0 ]; then + branch=master else - ssh $1 -R ${3:-$2}":localhost:"$2 -g + branch=$1 fi + + git branch --merged $branch | grep -v $branch | xargs git branch -d } -function gitignore-io { - curl https://www.gitignore.io/api/$@ +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 { @@ -67,16 +63,13 @@ function git-date-added { fi } -function run { - if [ $# -lt 2 ]; then - echo Usage: run NUMBER COMMAND - else - number=$1; shift +function gitignore-io { + curl https://www.gitignore.io/api/$@ +} - for i in `seq $number`; do - eval "$@" - done - fi +function insert-sudo { + zle beginning-of-line + zle -U "sudo " } function npm-exec { @@ -101,6 +94,26 @@ function password-generator { 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 @@ -127,6 +140,22 @@ function test-rails { 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 $@;) } @@ -138,13 +167,3 @@ function yarn-install-like-bundle { yarn install fi } - -function ag-count { - if [ $# -lt 1 ]; then - echo Usage: ag-count SEARCHTERM - else - searchterm=$1; shift - - ag --stats $searchterm | tail -n5 - fi -} diff --git a/zsh/.zshenv b/zsh/.zshenv index 5f339c4..e649e6f 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1,54 +1,37 @@ -LOCAL_SBIN_PATH="/usr/local/sbin" -PERSONAL_BIN_PATH="$HOME/bin" -LOCAL_HOME_BIN_PATH="$HOME/.local/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" + GNU_TOOLS_PATH="/opt/homebrew/opt/coreutils/libexec/gnubin" GNU_TOOLS_MAN_PATH="/opt/homebrew/opt/coreutils/libexec/gnuman" -APACHE_MAVEN_PATH="$HOME/bin/apache-maven-3.3.9/bin" -GO_HOME_PATH="$HOME/go-workspace/bin" -NODENV_PATH="$HOME/.nodenv/bin" if [[ "$OSTYPE" == darwin* ]]; then export HOMEBREW_PREFIX="/opt/homebrew"; export HOMEBREW_CELLAR="/opt/homebrew/Cellar"; export HOMEBREW_REPOSITORY="/opt/homebrew"; + export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"; export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"; export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; -fi -if [[ "$OSTYPE" == darwin* ]]; then GO_DIR="/usr/local/opt/go/libexec" else GO_DIR="/usr/local/go/bin" fi -if [[ "$OSTYPE" == darwin* ]]; then - NVM_DIR="/usr/local/opt/nvm" -else - NVM_DIR="/home/atomaka/.nvm" -fi - # BIN -[[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH" [[ -d "$RBENV_PATH" ]] && PATH="$RBENV_PATH:$PATH" -[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH" -[[ -d "$APACHE_MAVEN_PATH" ]] && PATH="$APACHE_MAVEN_PATH:$PATH" -[[ -d "$GO_DIR" ]] && PATH="$GO_DIR:$PATH" -[[ -d "$LOCAL_SBIN_PATH" ]] && PATH="$LOCAL_SBIN_PATH:$PATH" -[[ -d "$GO_HOME_PATH" ]] && PATH="$GO_HOME_PATH:$PATH" -[[ -d "$LOCAL_HOME_BIN_PATH" ]] && PATH="$LOCAL_HOME_BIN_PATH:$PATH" [[ -d "$NODENV_PATH" ]] && PATH="$NODENV_PATH:$PATH" -# MAN +[[ -d "$LOCAL_HOME_BIN_PATH" ]] && PATH="$LOCAL_HOME_BIN_PATH:$PATH" +[[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH" + +[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH" [[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH" +[[ -d "$PERSONAL_COMPLETIONS_PATH" ]] && fpath=($PERSONAL_COMPLETIONS_PATH $fpath) # EDITOR -if [[ -x "$(command -v nvim)" ]]; then - export {EDITOR,GIT_EDITOR}=nvim -else - export {EDITOR,GIT_EDITOR}=vim -fi - - -export GOPATH="$HOME/go-workspace/" +export {EDITOR,GIT_EDITOR}=vim diff --git a/zsh/.zshrc b/zsh/.zshrc index bb4c2df..2977c93 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -1,6 +1,3 @@ -[[ -d "$GNU_TOOLS_PATH" ]] && PATH="$GNU_TOOLS_PATH:$PATH" -[[ -d "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH" - GPG_TTY=$(tty) export GPG_TTY @@ -48,7 +45,6 @@ if which direnv > /dev/null; then fi # completion -fpath=($HOME/.zsh-completions $fpath) autoload -U compinit autoload bashcompinit && bashcompinit compinit