Skip to content

Commit

Permalink
Latest
Browse files Browse the repository at this point in the history
  • Loading branch information
dubiousdavid committed Dec 13, 2017
1 parent bc76d99 commit 6829943
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 132 deletions.
6 changes: 2 additions & 4 deletions .gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
email = [email protected]
[core]
editor = nvim
excludesfile = /Users/dsargeant/.gitignore_global
excludesfile = /Users/davidsargeant/.gitignore_global
autocrlf = input
pager = diff-so-fancy | less --tabs=4 -RFX
pager = diff-so-fancy | less --tabs=4 -RFX
[push]
default = current
[filter "lfs"]
Expand All @@ -36,5 +36,3 @@
tool = Kaleidoscope
[branch]
autoSetupMerge = always
[commit]
template = /Users/dsargeant/.stCommitMsg
2 changes: 2 additions & 0 deletions .gitignore_global
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ Thumbs.db
.ensime_cache
*.iml
.agignore
.ignore
.tern-port
.idea
.flowconfig
131 changes: 15 additions & 116 deletions .zshrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Path to your oh-my-zsh installation.
export ZSH=/Users/dsargeant/.oh-my-zsh
export ZSH=$HOME/.oh-my-zsh
# Theme
ZSH_THEME="david"
# Plugins
plugins=(urltools aws docker)
# Path
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dsargeant/bin:/usr/local/sbin
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/bin:/usr/local/sbin
export NODE_PATH=/usr/local/lib/node_modules

source $ZSH/oh-my-zsh.sh
Expand All @@ -16,32 +16,27 @@ export BROWSER="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
# Aliases
alias c=clear
alias g=git
alias magit="emacs -nw --load='~/.emacs.d/magit-init.el' --no-splash"
alias v=nvim
alias e="emacs -nw"
alias dk=docker
alias reload="source ~/.zshrc"
alias sed="sed -E"
alias qa="AWS_PROFILE=qa"
alias ports="lsof -iTCP -sTCP:LISTEN -n -P"
alias b=bible
alias jpp="jq '.'"
alias saml="python $PROJ/BoomTownROI/saml-setup.py"
alias dcomp=docker-compose
alias sp="cd $PROJ/SmartProcure"
# alias mongo="mongo --shell $PROJ/lodash.min.js"
alias n=node
# Paging via Vim
export MANPAGER="nvim -c 'set ft=man' -"
# export PAGER="nvim -c PAGER -"
# Go
export GOPATH=$PROJ/Go
export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin
# Swift
export PATH=$PATH:/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin
# FZF
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND="ag -f -U --hidden -g ''"
export FZF_DEFAULT_COMMAND='rg --no-ignore-vcs --hidden --files'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# export FZF_DEFAULT_OPTS="--reverse"
# Private Boomtown commands
source ~/Projects/boomtown.sh
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# z (nice autocompletion of frequently used directories)
source ~/Projects/z/z.sh

Expand Down Expand Up @@ -70,10 +65,6 @@ proj() {
cd $PROJ/$1
}

bt() {
proj BoomTownROI
}

# Change to root directory of current git repo
gr() {
cd "$(git rev-parse --show-cdup)"
Expand Down Expand Up @@ -124,92 +115,6 @@ findContainerId() {
docker ps --filter ancestor=$1 | awk 'NR!=1 {print $1}'
}

# Build API docs
build-docs() {
local containerId
containerId=$(findContainerId boomtown/api-docs)
[ $containerId ] && echo "Stopping api-docs ($containerId)" && docker stop $containerId 1>/dev/null
cd "$PROJ/BoomTownROI/api-docs"
docker build -t boomtown/api-docs .
start-docs
}

# Start API docs
start-docs() {
local containerId
containerId=$(findContainerId boomtown/api-docs)

if [[ -z $containerId ]]; then
echo "Starting api-docs..."
docker run -d -p 4567:4567 -v $PROJ/BoomTownROI/api-docs/source:/app/source boomtown/api-docs
else
echo "api-docs already running ($containerId)"
fi
}

# Open API docs
open-docs() {
open "http://localhost:4567"
}

docs() {
case $1 in
open) open-docs ;;
build) build-docs ;;
start) start-docs ;;
*) start-docs ;;
esac
}

# Start Redis
redis-start() {
local containerId
containerId=$(findContainerId redis)

if [[ -z $containerId ]]; then
echo "Starting redis..."
docker run -d -p 6379:6379 -v ~/data/redis:/data redis redis-server --appendonly yes
else
echo "redis already running ($containerId)"
fi
}

# Stop redis
redis-stop() {
local containerId
containerId=$(findContainerId redis)
docker kill $containerId
}

redis() {
case $1 in
stop) redis-stop ;;
restart)
redis-stop
redis-start
;;
*) redis-start ;;
esac
}

truncate-alerts-visible() {
aws dynamodb scan --table-name UserAlertsVisible |
jq -c '.Items[] | {userId: .userId, userAlertId: .userAlertId}' |
sed "s/.*/'&'/" |
xargs -L1 aws dynamodb delete-item --table-name UserAlertsVisible --key
}

truncate-insights-visible() {
aws dynamodb scan --table-name InsightsVisible |
jq -c '.Items[] | {userId: .userId, insightId: .insightId}' |
sed "s/.*/'&'/" |
xargs -L1 aws dynamodb delete-item --table-name InsightsVisible --key
}

sbt-local() {
sbt publishLocal "-DLIB_VERSION=$1"
}

# Print the absolute path of the given files
path() { for f in "$@"; do echo ${f}(:A); done }

Expand All @@ -233,12 +138,6 @@ show-tabs() {
grep $'\t' $1
}

endpoint() {
local env=$1
gatewayIds=($(aws apigateway get-rest-apis --region us-east-1 --query "items[?contains(name, '$env') == \`true\`].id" --output text))
echo "https://$gatewayIds.execute-api.us-east-1.amazonaws.com/V1"
}

serve() {
if [[ -z $1 ]]; then
browser-sync start --server
Expand All @@ -247,10 +146,10 @@ serve() {
fi
}

mongo() {
docker run -d -p 27017:27017 mongo
}

reverse() {
echo $1 | rev
}

s() {
rg -M 100 -p -S --no-ignore-vcs --hidden "$@" | less -XFR
}
25 changes: 14 additions & 11 deletions init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Plug 'guns/vim-sexp', {'for': 'clojure'}
Plug 'clojure-vim/async-clj-omni', {'for': 'clojure'}
" Autocompletion
Plug 'roxma/nvim-completion-manager'
Plug 'calebeby/ncm-css', {'for': ['css', 'less', 'scss']}
" GraphQL
Plug 'jparise/vim-graphql', {'for': 'graphql'}
" Prettier
Expand Down Expand Up @@ -198,12 +199,15 @@ map <Leader>W <Plug>(easymotion-bd-W)
" FZF
nmap <Leader>f :Files<CR>
nmap <Leader>b :Buffers<CR>
" Ag
function! s:Ag(term)
execute 'te ag --pager=less ' . a:term
" Search
function! s:Search(term)
execute 'terminal rg -M 100 -p -S --no-ignore-vcs --hidden ' . a:term . ' | less -XFR'
endfunction
command! -nargs=1 Ag call s:Ag(<f-args>)
nmap <Leader>a :Ag<Space>
command! -nargs=1 Search call s:Search(<f-args>)
nmap <Leader>s :Search<Space>
" Set grep program to rg
set grepprg=rg\ --vimgrep
set grepformat^=%f:%l:%c:%m
" Git
nmap <Leader>gh :Gbrowse<CR>
vmap <Leader>gh :Gbrowse<CR>
Expand All @@ -215,7 +219,7 @@ nmap <Leader>gl :terminal git tree<CR>
nmap <Leader>gg :Ggrep<Space>
nmap <Leader>ge :Gedit<Space>
nmap <Leader>gf :!git fetch<CR>
nmap <Leader>gF :!git pull<CR>
nmap <Leader>gP :!git pull<CR>
nmap <Leader>gp :!git push<CR>
nmap <Leader>gup :!git push -u origin $(git rev-parse --abbrev-ref HEAD)<CR>
nmap <Leader>gn :GitGutterNextHunk<CR>
Expand Down Expand Up @@ -250,15 +254,11 @@ augroup quickfix
augroup END
" Scratch
let g:scratch_no_mappings = 1
nmap <leader>si <plug>(scratch-insert-reuse)
xmap <leader>si <plug>(scratch-selection-reuse)
nmap <leader>sp :ScratchPreview<CR>
nmap <leader>se :Scratch<CR>
" Javascript
let g:javascript_plugin_jsdoc=1
" Prettier
let g:prettier#autoformat = 0
autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql Prettier
" autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql Prettier
" max line length that prettier will wrap on
let g:prettier#config#print_width = 80
" number of spaces per indentation level
Expand All @@ -281,3 +281,6 @@ let g:prettier#config#parser = 'babylon'
let g:prettier#config#config_precedence = 'prefer-file'
" Flow
let g:flow#autoclose=1
" Ale
nmap <silent> <C-p> <Plug>(ale_previous_wrap)
nmap <silent> <C-n> <Plug>(ale_next_wrap)
1 change: 0 additions & 1 deletion update
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
cp ~/.config/nvim/init.vim .
cp ~/.zshrc .
cp ~/.config/nvim/colors/tir_black.vim colors/tir_black.vim
cp ~/.agignore .
cp ~/.gitignore_global .
cp ~/.gitconfig .

0 comments on commit 6829943

Please sign in to comment.