diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2c257d4 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.tags diff --git a/aliases.local b/aliases.local index b1d3b73..b1d8cb0 100644 --- a/aliases.local +++ b/aliases.local @@ -5,17 +5,20 @@ alias c="clear" alias ll="ls -alh" # bdt -alias cdp="cd ~/bdt/prism/" -alias bdt="cd ~/bdt/prism/ && tat" +alias cdp="cd ~/code/prism/" +alias code="cd ~/code/ && tat" +alias bdt="echo 'use code alias instead'" # git -alias gs="git status" +# alias gs="git status" # gets in the way of ghostscript alias gd="git diff" alias gb="git branch" alias gbs="git branch --remote | ag" alias gco='git checkout $(git branch | cut -c 3- | fzf-tmux)' alias gco-="git checkout -" alias gf="git fetch" +alias gfd="git fetch origin develop:develop" # updates develop without leaving current branch +alias gfm="git fetch origin master:master" # updates master without leaving current branch alias gc="git commit -v" alias ga="git add" alias gaa="git add ." @@ -25,8 +28,10 @@ alias gpu="git push -u" alias gpl="git pull" alias gl="git log" alias glg="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative" +alias glgfp="glg --first-parent" alias gm-="git merge -" alias gup="git up" +alias gfl="git flow" # bundler alias bi="bundle install" @@ -40,12 +45,88 @@ alias agl="ag --pager \"less -R\"" # fzf (fuzzy finder) alias f="fzf-tmux" +alias ef='vim $(fzf-tmux)' # sshrc -alias l="sshrc" +# alias l="sshrc" # ssh to multiple servers at once! -alias lm="ssh-multi" -alias lp="ssh-multi {pa,md,nyc,co,sc,nc,ct}.prism.local" -alias lt="ssh-multi {pa,md,nyc,co,sc,nc,ct}-training.betaprism.local" +# alias lm="ssh-multi" +# alias lp="ssh-multi {pa,md,nyc,co,sc,nc,ct}.prism.local" +# alias lt="ssh-multi {pa,md,nyc,co,sc,nc,ct}-training.betaprism.local" + +# Don't save commands to history that are prefixed with a space +# https://superuser.com/questions/352788/how-to-prevent-a-command-in-the-zshell-from-being-saved-into-history +# setopt HIST_IGNORE_SPACE + +# todo.txt +# todotxt () { +# if [[ $# -gt 0 ]] +# then +# "/usr/local/opt/todo-txt/bin/todo.sh" "$@" +# else +# "/usr/local/opt/todo-txt/bin/todo.sh" ls | head -n1 +# fi +# } +# alias t=" /usr/local/opt/todo-txt/bin/todo.sh" # doesn't save to history +# # alias t=" todotxt" # doesn't save to history +# # compdef t="/usr/local/opt/todo-txt/bin/todo.sh" +# alias ta="t add" +# alias tli='t ls | ag "^[0-9]" | ag -v ".*(\@|\+)"' +# alias ti='tli | head -n1' +# alias trm='t del' +# alias tdo='t do' +# alias tls='t ls' +# alias tlsp='t lsprj' +# alias tlsc='t lsc' +# +# journal ... expects stdin as the entry +# append-to-journal='xargs -0 printf "\n## $(date "+%Y-%m-%d-%H-%M-%S")\n%s\n" >> /Users/pcabe/Dropbox/Documents/journal/Journal-$(date "+%Y-%m").txt' + + if [ $commands[kubectl] ]; then + # FIXME: wish this would lazy load automatically when tabbing only, like it + # does with kubectl itself + if ! type __start_kubectl >/dev/null 2>&1; then + # source <(kubectl completion zsh) + # kubectl completion; use cache if updated within 24h + if [[ -n $HOME/.helmcompdump(#qN.mh+24) ]]; then + kubectl completion zsh > $HOME/.kubectlcompdump; + else + source $HOME/.kubectlcompdump; + fi; + + compdef k=kubectl + fi + + k() { + + if [[ $# -gt 0 ]] + then + kubectl "$@" + else + local con=$(kubectl config current-context) + local ns=$(kubectl config view -o "jsonpath={.contexts[?(@.name==\"$(kubectl config current-context)\")].context.namespace}") + + echo "Kubernetes" + echo " Context: $con" + echo " Namespace: $ns" + fi + } + + kn() { + kubectl config set-context $(kubectl config current-context) --namespace="$@" + } + + # alias ke="kubectl exec -it" + ke() { + local podname=$(kubectl get pods | grep -m1 "$@" | cut -f 1 -d ' ') + kubectl exec -it "$podname" bash + } + fi + + +# FIXME: I put this here because it doesn't work if I put it earlier in the +# sourcing chain... but why? +# use fzf for fuzzy file finding +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh diff --git a/bin/pick-an-are b/bin/pick-an-are new file mode 100755 index 0000000..10e88f2 --- /dev/null +++ b/bin/pick-an-are @@ -0,0 +1,3 @@ +#!/usr/bin/env zsh + +echo kamal michelle ciacci preston matt afia | xargs shuf -n1 -e diff --git a/bin/tail-build-log b/bin/tail-build-log new file mode 100755 index 0000000..5a5c0f0 --- /dev/null +++ b/bin/tail-build-log @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +SHA=`git rev-parse HEAD` +BUILD_ID=`gcloud container builds list --format json | jq --arg SHA "$SHA" '.[] | select(.sourceProvenance.resolvedRepoSource.commitSha == $SHA) | .id' | tr -d '"'` +gcloud container builds log $BUILD_ID --stream diff --git a/fzf.zsh b/fzf.zsh index 1113a24..67e3fb4 100644 --- a/fzf.zsh +++ b/fzf.zsh @@ -1,13 +1,7 @@ # Setup fzf # --------- if [[ ! "$PATH" == */Users/pcabe/.fzf/bin* ]]; then - export PATH="$PATH:/Users/pcabe/.fzf/bin" -fi - -# Man path -# -------- -if [[ ! "$MANPATH" == */Users/pcabe/.fzf/man* && -d "/Users/pcabe/.fzf/man" ]]; then - export MANPATH="$MANPATH:/Users/pcabe/.fzf/man" + export PATH="${PATH:+${PATH}:}/Users/pcabe/.fzf/bin" fi # Auto-completion @@ -16,5 +10,4 @@ fi # Key bindings # ------------ -# source "/Users/pcabe/.fzf/shell/key-bindings.zsh" - +source "/Users/pcabe/.fzf/shell/key-bindings.zsh" diff --git a/gitconfig.local b/gitconfig.local index 56af727..8f3fd41 100644 --- a/gitconfig.local +++ b/gitconfig.local @@ -1,7 +1,26 @@ [user] name = Preston Cabe - email = prestoncabe@gmail.com + email = pcabe@bdtrust.org [core] trustctime = false [push] followTags = true +[http] + cookiefile = /Users/pcabe/.gitcookies +[gitflow "feature.finish"] + keep = true + push = true +[gitflow "feature.delete"] + remote = true +# [gitflow "init"] +# defaults = true +[gitflow "hotfix.finish"] + keep = true + push = true +[gitflow "hotfix.delete"] + remote = true +[gitflow "release.finish"] + keep = true + push = true +[gitflow "release.delete"] + remote = true diff --git a/mackup.cfg b/mackup.cfg index f650604..9df5c51 100644 --- a/mackup.cfg +++ b/mackup.cfg @@ -1,9 +1,5 @@ [applications_to_sync] -adium -atom bettertouchtool hazel -mailplane -omnifocus -sequel-pro -ssh +[storage] +engine = icloud diff --git a/psqlrc.local b/psqlrc.local new file mode 100644 index 0000000..e69de29 diff --git a/rcrc b/rcrc deleted file mode 100644 index f7f996c..0000000 --- a/rcrc +++ /dev/null @@ -1,2 +0,0 @@ -EXCLUDES="README.md LICENSE" -DOTFILES_DIRS="$HOME/dotfiles-local $HOME/thoughtbot/dotfiles" diff --git a/tmux.conf.local b/tmux.conf.local index 706f6c9..f6e7d02 100644 --- a/tmux.conf.local +++ b/tmux.conf.local @@ -5,7 +5,7 @@ bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" -bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" +bind -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" bind-key l last-window @@ -15,7 +15,7 @@ bind % split-window -h -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" # look and feel -set -g pane-active-border-fg magenta +set -g pane-active-border-style fg=magenta set -g status-right '#{session_name} ' setw -g clock-mode-style 12 diff --git a/vimrc.bundles.local b/vimrc.bundles.local index c661a89..9ad994f 100644 --- a/vimrc.bundles.local +++ b/vimrc.bundles.local @@ -1,6 +1,3 @@ -UnPlug 'ctrlp.vim' - -Plug 'vim-scripts/ZoomWin' Plug 'altercation/vim-colors-solarized' Plug 'itchyny/lightline.vim' Plug 'tpope/vim-unimpaired' @@ -9,9 +6,6 @@ Plug 'skwp/greplace.vim' Plug 'airblade/vim-gitgutter' Plug 'ConradIrwin/vim-bracketed-paste' Plug 'tpope/vim-vinegar' -Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } -Plug 'junegunn/fzf.vim' -Plug 'pangloss/vim-javascript' Plug 'mxw/vim-jsx' Plug 'alvan/vim-closetag' Plug 'jiangmiao/auto-pairs' diff --git a/vimrc.local b/vimrc.local index fddfb39..fdb58d4 100644 --- a/vimrc.local +++ b/vimrc.local @@ -1,6 +1,11 @@ " Basic look 'n feel syntax enable set background=dark +if !has('gui_running') + " fixes colors over ssh ¯\_(ツ)_/¯ + " https://github.com/altercation/solarized/issues/107 + let g:solarized_termtrans=1 +endif colorscheme solarized set cursorline @@ -34,6 +39,10 @@ inoremap " Speed up switching back to normal mode set timeoutlen=1000 ttimeoutlen=0 +" Speed up ALE linting for large files +let g:ale_cache_executable_check_failures = 1 +let g:ale_lint_on_text_changed = 'never' +let g:ale_lint_on_insert_leave = 0 " Change cursor in insert mode " (assumes iTerm2 on OS X): @@ -101,7 +110,6 @@ nnoremap ga :Gwrite nnoremap gc :Gcommit -v nnoremap gd :Gdiff - " Grep stuff from https://robots.thoughtbot.com/faster-grepping-in-vim nnoremap K :grep! "\b\b":cw @@ -112,7 +120,7 @@ nnoremap k :Ag let test#ruby#rspec#options = { \ 'nearest': '--format documentation', \ 'file': '--format documentation', - \ 'suite': '--tag ~slow', + \ 'suite': '--fail-fast', \} @@ -127,10 +135,12 @@ augroup vimrc.localEx autocmd WinLeave * call WinLeaveUnHighlight() function WinEnterHighlight() - set relativenumber + " set relativenumber + set cursorline endfunction function WinLeaveUnHighlight() - set norelativenumber + " set norelativenumber + set nocursorline endfunction augroup END diff --git a/zshrc.local b/zshrc.local index a81b3e4..03525f0 100644 --- a/zshrc.local +++ b/zshrc.local @@ -1,15 +1,54 @@ -# use pick to quickly find file to edit in vim -function pe { - vim $(ag -l | pick) -} - -# use ssh tab completion for sshrc +# use ssh tab completion for sshrc and ssh-multi compdef sshrc=ssh -[[ -f ~/.fzf.zsh ]] && source ~/.fzf.zsh +# so we get UTF-8 when SSHing from iPad?? +export LC_ALL=en_US.UTF-8 +export LANG=en_US.UTF-8 + +export PATH="/usr/local/opt/go@1.11/bin:$PATH" +export GOPATH="${HOME}/.go" +export GOROOT="/usr/local/Cellar/go/1.13.7/libexec" +export PATH="$PATH:${GOPATH}/bin:${GOROOT}/bin" + +# an alternative way to the "e" alias that I'm still not sure about +# e () { +# if [[ $# -gt 0 ]] +# then +# $EDITOR "$@" +# else +# $EDITOR "$(fzf-tmux)" +# fi +# } # Enable Ctrl-x-e to edit command line autoload -z edit-command-line zle -N edit-command-line bindkey "^X^E" edit-command-line +export CLOUDSDK_PYTHON="/usr/local/opt/python@3.8/bin/python3" +source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc" +source "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc" + +# source ~/.git-flow-completion.zsh +source '/usr/local/share/zsh/site-functions/git-flow-completion.zsh' + +# source <(helm completion zsh) +# helm completion; use cache if updated within 24h +if [[ -n $HOME/.helmcompdump(#qN.mh+24) ]]; then + helm completion zsh > $HOME/.helmcompdump; + source $HOME/.helmcompdump; +else + source $HOME/.helmcompdump; +fi; + +set -o emacs + +# show vi mode in shell prompt +# function zle-line-init zle-keymap-select { +# RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}" +# RPS2=$RPS1 +# zle reset-prompt +# } +# +# zle -N zle-line-init +# zle -N zle-keymap-select