Do some spring cleaning

This commit is contained in:
Andrew Tomaka 2021-11-02 20:14:26 -04:00
parent d9067797a5
commit 019f27d538
Signed by: atomaka
GPG key ID: 61209BF70A5B18BE
8 changed files with 108 additions and 114 deletions

View file

@ -1,7 +1,12 @@
STOWED = bin git ruby tmux vim zsh
all: install all: install
install: plug-vim install: plug-vim
stow bin git nvim ruby tmux vim zsh stow $(STOWED)
uninstall:
stow -D $(STOWED)
plug-vim: plug-vim:
if test ! -f ~/.vim/autoload/plug.vim ; then \ if test ! -f ~/.vim/autoload/plug.vim ; then \

View file

@ -37,7 +37,7 @@
attributesfile = ~/.gitattributes_global attributesfile = ~/.gitattributes_global
filemode = false filemode = false
[gpg] [gpg]
program = gpg program = gpg
[merge] [merge]
tool = vimdiff tool = vimdiff
[push] [push]
@ -52,6 +52,6 @@
textconv = bundle exec rails encrypted:show textconv = bundle exec rails encrypted:show
cachetextconv = false cachetextconv = false
[pull] [pull]
ff = only rebase = false
[init] [init]
defaultBranch = master defaultBranch = master

View file

@ -1,3 +0,0 @@
set runtimepath+=~/.vim,~/.vim/after
set packpath+=~/.vim
source ~/.vimrc

View file

@ -2,7 +2,6 @@
call plug#begin('~/.vim/plugged') call plug#begin('~/.vim/plugged')
" colors " colors
Plug 'nanotech/jellybeans.vim'
Plug 'joshdick/onedark.vim' Plug 'joshdick/onedark.vim'
" keepers " keepers
@ -11,17 +10,15 @@ Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim' Plug 'junegunn/fzf.vim'
Plug 'ntpeters/vim-better-whitespace' Plug 'ntpeters/vim-better-whitespace'
Plug 'moll/vim-bbye' Plug 'moll/vim-bbye'
Plug 'ruanyl/vim-gh-line'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-eunuch' " move files Plug 'tpope/vim-eunuch' " move files
Plug 'tpope/vim-fugitive' Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-git' Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-surround' Plug 'tpope/vim-surround'
Plug 'troydm/zoomwintab.vim' Plug 'troydm/zoomwintab.vim'
Plug 'chrisbra/matchit'
" languages " languages
Plug 'leafgarland/typescript-vim' Plug 'leafgarland/typescript-vim'
Plug 'posva/vim-vue'
Plug 'tpope/vim-markdown' Plug 'tpope/vim-markdown'
Plug 'tpope/vim-rails' Plug 'tpope/vim-rails'
Plug 'vim-ruby/vim-ruby' Plug 'vim-ruby/vim-ruby'
@ -165,14 +162,12 @@ map <Leader>sz :so ~/.vimrc<cr>
" style " style
set t_8f=[38;2;%lu;%lu;%lum set t_8f=[38;2;%lu;%lu;%lum
set t_8b=[48;2;%lu;%lu;%lum set t_8b=[48;2;%lu;%lu;%lum
if has('nvim')
set cursorline " Highlight current line set cursorline " Highlight current line
set cursorcolumn " Highlight current column set cursorcolumn " Highlight current column
set termguicolors
colorscheme onedark set termguicolors
else colorscheme onedark
colorscheme jellybeans
endif
syntax enable syntax enable
highlight ExtraWhitespace ctermbg=196 highlight ExtraWhitespace ctermbg=196

View file

@ -1,3 +1,5 @@
alias zbm="/usr/bin/time zsh -i -c exit"
alias ..="cd .." alias ..="cd .."
alias ...="cd ../.." alias ...="cd ../.."
alias ....="cd ../../.." alias ....="cd ../../.."
@ -20,9 +22,9 @@ alias ga="git add"
alias gaa="git add --all" alias gaa="git add --all"
alias gap="git add --patch" alias gap="git add --patch"
alias gb="git branch" 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 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 gc="git commit"
alias gca="git commit --amend" alias gca="git commit --amend"
alias gcm="echo Do not specify message at command line. Use gc" 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 ghi="git hist"
alias ghd="git hist-details" alias ghd="git hist-details"
alias ght="git hist-tags" 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 gmr="git most-recent-by-branch"
alias gp="git push" alias gp="git push"
alias gpf="git push --force" alias gpf="git push --force"
@ -59,26 +64,20 @@ alias grh="git reset --hard"
alias grm="git rm" alias grm="git rm"
alias gs="git status" alias gs="git status"
alias gu="git undo" 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 gw="git diff --check"
alias Grep='grep' 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 l="ls"
alias ll="ls -lv --human-readable --color=auto" alias ll="ls -lv --human-readable --color=auto"
alias ls="ls --color=auto" alias ls="ls --color=auto"
alias m="more" alias m="more"
alias md="cd ~/dotfiles > /dev/null 2>&1; make; cd -1 > /dev/null 2>&1" alias md="cd ~/dotfiles > /dev/null 2>&1; make; cd -1 > /dev/null 2>&1"
alias mf="mkdir" alias mf="mkdir"
alias mh="tmux new-session -A -s home"
alias mt="tmuxinator"
alias mw="tmux new-session -A -s work" alias mw="tmux new-session -A -s work"
alias ne="npm-exec" alias ne="npm-exec"
alias pf="port-forward" alias pf="port-forward"
alias pwdgen="password-generator" alias pwdgen="password-generator"
alias r="ssh" alias r="ssh"
alias rc="bin/ctrl"
alias rd="popd" alias rd="popd"
alias s="cd ~/Source" alias s="cd ~/Source"
alias sci="ssh-copy-id -i .ssh/id_rsa.pub" alias sci="ssh-copy-id -i .ssh/id_rsa.pub"

View file

@ -1,9 +1,10 @@
function aws-profile { function ag-count {
if [ $# -eq 0 ]; then if [ $# -lt 1 ]; then
echo Current AWS Profile: $AWS_DEFAULT_PROFILE echo Usage: ag-count SEARCHTERM
else else
export AWS_DEFAULT_PROFILE=$1 searchterm=$1; shift
export AWS_PROFILE=$1
ag --stats $searchterm | tail -n5
fi fi
} }
@ -13,6 +14,15 @@ function aet-bin-exec {
./aet-bin/$script $@ ./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 { function fix-permissions {
find . -type d -print0 | xargs -0 chmod 0755 find . -type d -print0 | xargs -0 chmod 0755
find . -type f -print0 | xargs -0 chmod 0644 find . -type f -print0 | xargs -0 chmod 0644
@ -26,37 +36,23 @@ function g {
fi fi
} }
function insert-sudo { function git-branch-cleanup {
zle beginning-of-line if [ $# -eq 0 ]; then
zle -U "sudo " branch=master
}
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\]
else else
ssh $1 -R ${3:-$2}":localhost:"$2 -g branch=$1
fi fi
git branch --merged $branch | grep -v $branch | xargs git branch -d
} }
function gitignore-io { function git-branch-delete-merged {
curl https://www.gitignore.io/api/$@ git branch --merged \
| grep -v "\*" \
| grep -v master \
| grep -v staging \
| grep -v development \
| xargs -n 1 git branch -d
} }
function git-date-added { function git-date-added {
@ -67,16 +63,13 @@ function git-date-added {
fi fi
} }
function run { function gitignore-io {
if [ $# -lt 2 ]; then curl https://www.gitignore.io/api/$@
echo Usage: run NUMBER COMMAND }
else
number=$1; shift
for i in `seq $number`; do function insert-sudo {
eval "$@" zle beginning-of-line
done zle -U "sudo "
fi
} }
function npm-exec { function npm-exec {
@ -101,6 +94,26 @@ function password-generator {
echo $password 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 { function stopwatch {
date1=`date +%s` date1=`date +%s`
while true; do while true; do
@ -127,6 +140,22 @@ function test-rails {
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 { function yarn-exec {
(PATH=$(yarn bin):$PATH; eval $@;) (PATH=$(yarn bin):$PATH; eval $@;)
} }
@ -138,13 +167,3 @@ function yarn-install-like-bundle {
yarn install yarn install
fi fi
} }
function ag-count {
if [ $# -lt 1 ]; then
echo Usage: ag-count SEARCHTERM
else
searchterm=$1; shift
ag --stats $searchterm | tail -n5
fi
}

View file

@ -1,54 +1,37 @@
LOCAL_SBIN_PATH="/usr/local/sbin" NODENV_PATH="$HOME/.nodenv/bin"
PERSONAL_BIN_PATH="$HOME/bin"
LOCAL_HOME_BIN_PATH="$HOME/.local/bin"
RBENV_PATH="$HOME/.rbenv/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_PATH="/opt/homebrew/opt/coreutils/libexec/gnubin"
GNU_TOOLS_MAN_PATH="/opt/homebrew/opt/coreutils/libexec/gnuman" 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 if [[ "$OSTYPE" == darwin* ]]; then
export HOMEBREW_PREFIX="/opt/homebrew"; export HOMEBREW_PREFIX="/opt/homebrew";
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"; export HOMEBREW_CELLAR="/opt/homebrew/Cellar";
export HOMEBREW_REPOSITORY="/opt/homebrew"; export HOMEBREW_REPOSITORY="/opt/homebrew";
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"; export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";
export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"; export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";
export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";
fi
if [[ "$OSTYPE" == darwin* ]]; then
GO_DIR="/usr/local/opt/go/libexec" GO_DIR="/usr/local/opt/go/libexec"
else else
GO_DIR="/usr/local/go/bin" GO_DIR="/usr/local/go/bin"
fi fi
if [[ "$OSTYPE" == darwin* ]]; then
NVM_DIR="/usr/local/opt/nvm"
else
NVM_DIR="/home/atomaka/.nvm"
fi
# BIN # BIN
[[ -d "$PERSONAL_BIN_PATH" ]] && PATH="$PERSONAL_BIN_PATH:$PATH"
[[ -d "$RBENV_PATH" ]] && PATH="$RBENV_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" [[ -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 "$GNU_TOOLS_MAN_PATH" ]] && MANPATH="$GNU_TOOLS_MAN_PATH:$MANPATH"
[[ -d "$PERSONAL_COMPLETIONS_PATH" ]] && fpath=($PERSONAL_COMPLETIONS_PATH $fpath)
# EDITOR # EDITOR
if [[ -x "$(command -v nvim)" ]]; then export {EDITOR,GIT_EDITOR}=vim
export {EDITOR,GIT_EDITOR}=nvim
else
export {EDITOR,GIT_EDITOR}=vim
fi
export GOPATH="$HOME/go-workspace/"

View file

@ -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) GPG_TTY=$(tty)
export GPG_TTY export GPG_TTY
@ -48,7 +45,6 @@ if which direnv > /dev/null; then
fi fi
# completion # completion
fpath=($HOME/.zsh-completions $fpath)
autoload -U compinit autoload -U compinit
autoload bashcompinit && bashcompinit autoload bashcompinit && bashcompinit
compinit compinit