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
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 \

View file

@ -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

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')
" 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 <Leader>sz :so ~/.vimrc<cr>
" 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

View file

@ -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"

View file

@ -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
}

View file

@ -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

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)
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