Skip to content

Commit

Permalink
A bunch of recent changes that I want to break out
Browse files Browse the repository at this point in the history
  • Loading branch information
prestoncabe committed Dec 14, 2020
1 parent 9c8b4fd commit d9479a8
Show file tree
Hide file tree
Showing 13 changed files with 183 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.tags
95 changes: 88 additions & 7 deletions aliases.local
Original file line number Diff line number Diff line change
Expand Up @@ -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 ."
Expand All @@ -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"
Expand All @@ -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

3 changes: 3 additions & 0 deletions bin/pick-an-are
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env zsh

echo kamal michelle ciacci preston matt afia | xargs shuf -n1 -e
5 changes: 5 additions & 0 deletions bin/tail-build-log
Original file line number Diff line number Diff line change
@@ -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
11 changes: 2 additions & 9 deletions fzf.zsh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -16,5 +10,4 @@ fi

# Key bindings
# ------------
# source "/Users/pcabe/.fzf/shell/key-bindings.zsh"

source "/Users/pcabe/.fzf/shell/key-bindings.zsh"
21 changes: 20 additions & 1 deletion gitconfig.local
Original file line number Diff line number Diff line change
@@ -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
8 changes: 2 additions & 6 deletions mackup.cfg
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
[applications_to_sync]
adium
atom
bettertouchtool
hazel
mailplane
omnifocus
sequel-pro
ssh
[storage]
engine = icloud
Empty file added psqlrc.local
Empty file.
2 changes: 0 additions & 2 deletions rcrc

This file was deleted.

4 changes: 2 additions & 2 deletions tmux.conf.local
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

Expand Down
6 changes: 0 additions & 6 deletions vimrc.bundles.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
UnPlug 'ctrlp.vim'

Plug 'vim-scripts/ZoomWin'
Plug 'altercation/vim-colors-solarized'
Plug 'itchyny/lightline.vim'
Plug 'tpope/vim-unimpaired'
Expand All @@ -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'
18 changes: 14 additions & 4 deletions vimrc.local
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -34,6 +39,10 @@ inoremap <C-e> <End>
" 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):
Expand Down Expand Up @@ -101,7 +110,6 @@ nnoremap <Leader>ga :Gwrite<CR>
nnoremap <Leader>gc :Gcommit -v<CR>
nnoremap <Leader>gd :Gdiff<CR>


" Grep stuff from https://robots.thoughtbot.com/faster-grepping-in-vim
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>

Expand All @@ -112,7 +120,7 @@ nnoremap <Leader>k :Ag<SPACE>
let test#ruby#rspec#options = {
\ 'nearest': '--format documentation',
\ 'file': '--format documentation',
\ 'suite': '--tag ~slow',
\ 'suite': '--fail-fast',
\}


Expand All @@ -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
53 changes: 46 additions & 7 deletions zshrc.local
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d9479a8

Please sign in to comment.