Merge branch 'develop'

This commit is contained in:
William Carroll 2016-11-16 15:13:00 -05:00
commit 338d3f7b44
12 changed files with 1118 additions and 35 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "usbify"]
path = usbify
url = https://github.com/wpcarro/usbify.git

View file

@ -1,26 +1,84 @@
ack
ansifilter
arpack
bash-completion
bind
chromedriver
cmake
cmatrix
coreutils
cowsay
ctags
elm
epstool
fftw
fltk
fontconfig
freetype
gcc
gd
gdbm
gettext
ghostscript
gl2ps
glpk
gmp
gnu-sed
gnupg
gnuplot
graphicsmagick
hdf5
hping
htop
httpie
imagemagick
isl
jpeg
jq
json-c
libevent
libmpc
libpng
libstfl
libtiff
libtool
little-cms2
lua
metis
mpfr
nethogs
newsbeuter
nmap
octave
oniguruma
openssl
pcre
phantomjs
pidof
pkg-config
plotutils
pstoedit
pup
python
python3
qhull
qrupdate
readline
recode
shc
sqlite
suite-sparse
szip
tbb
texinfo
the_silver_searcher
tig
tmux
transfig
tree
veclibfort
vim
webp
wget
xz
zsh-syntax-highlighting

89
configs/.ctags Normal file
View file

@ -0,0 +1,89 @@
--recurse=yes
--exclude=.git
--exclude=vendor/
--exclude=node_modules
--exclude=db
--exclude=log
--exclude=tmp
--regex-ruby=/.*alias(_method)?[[:space:]]+:([[:alnum:]_=!?]+),?[[:space:]]+:([[:alnum:]_=!]+)/\2/f,function/
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/
--regex-ruby=/(^|;)[ \t]*(has_many|belongs_to|has_one|has_and_belongs_to_many)\(? *:([[:alnum:]_]+)/\3/f,function,association/
--regex-ruby=/(^|;)[ \t]*(named_)?scope\(? *:([[:alnum:]_]+)/\3/f,function,named_scope/
--regex-ruby=/(^|;)[ \t]*expose\(? *:([[:alnum:]_]+)/\2/f,function,exposure/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2/f,function,aasm_event/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2!/f,function,aasm_event/
--regex-ruby=/(^|;)[ \t]*event\(? *:([[:alnum:]_]+)/\2?/f,function,aasm_event/
--langmap=Ruby:+(Rakefile)
--langdef=js
--langmap=js:.js
--langmap=js:+.jsx
--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/
--regex-js=/\.([A-Za-z0-9._$]+)[ \t]*=[ \t]*\{/\1/o,object/
--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*[ \t]*:[ \t]*\{/\1/o,object/
--regex-js=/([A-Za-z0-9._$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*\{/\1\.\2/o,object/
--regex-js=/([A-Za-z0-9._$]+)[ \t]*=[ \t]*\(function\(\)/\1/c,class/
--regex-js=/['"]*([A-Za-z0-9_$]+)['"]*:[ \t]*\(function\(\)/\1/c,class/
--regex-js=/class[ \t]+([A-Za-z0-9._$]+)[ \t]*/\1/c,class/
--regex-js=/([A-Za-z$][A-Za-z0-9_$()]+)[ \t]*=[ \t]*[Rr]eact.createClass[ \t]*\(/\1/c,class/
--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*=[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/
--regex-js=/([A-Z][A-Za-z0-9_$]+)[ \t]*:[ \t]*[A-Za-z0-9_$]*[ \t]*[{(]/\1/c,class/
--regex-js=/([A-Za-z$][A-Za-z0-9_$]+)[ \t]*=[ \t]*function[ \t]*\(/\1/f,function/
--regex-js=/(function)*[ \t]*([A-Za-z$_][A-Za-z0-9_$]+)[ \t]*\([^)]*\)[ \t]*\{/\2/f,function/
--regex-js=/['"]*([A-Za-z$][A-Za-z0-9_$]+)['"]*:[ \t]*function[ \t]*\(/\1/m,method/
--regex-js=/([A-Za-z0-9_$]+)\[["']([A-Za-z0-9_$]+)["']\][ \t]*=[ \t]*function[ \t]*\(/\2/m,method/
--langdef=haskell
--langmap=haskell:.hs
--regex-haskell=/^module[ \t]*([A-Z][a-zA-Z0-9'_.]*)/\1/m,module/
--regex-haskell=/^(new)?type[ \t]*([A-Z][a-zA-Z0-9'_]*)./\2/t,type/
--regex-haskell=/^class[ \t]*([A-Z][a-zA-Z0-9'_]*)/\1/c,class/
--regex-haskell=/^data[ \t]*([A-Z][a-zA-Z0-9'_]*)/\1/d,data/
--regex-haskell=/^([a-z_][a-zA-Z0-9'_]*).*=/\1/v,function/
--langmap=C++:+.mm
--langdef=golang
--langmap=golang:.go
--regex-golang=/func([ \t]+\([^)]+\))?[ \t]+([a-zA-Z0-9_]+)/\2/d,func/
--regex-golang=/var[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,var/
--regex-golang=/type[ \t]+([a-zA-Z_][a-zA-Z0-9_]+)/\1/d,type/
--langdef=Rust
--langmap=Rust:.rs
--regex-Rust=/^[ \t]*(#\[[^\]]\][ \t]*)*(pub[ \t]+)?(extern[ \t]+)?("[^"]+"[ \t]+)?(unsafe[ \t]+)?fn[ \t]+([a-zA-Z0-9_]+)/\6/f,functions,function definitions/
--regex-Rust=/^[ \t]*(pub[ \t]+)?type[ \t]+([a-zA-Z0-9_]+)/\2/T,types,type definitions/
--regex-Rust=/^[ \t]*(pub[ \t]+)?enum[ \t]+([a-zA-Z0-9_]+)/\2/g,enum,enumeration names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?struct[ \t]+([a-zA-Z0-9_]+)/\2/s,structure names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?mod[ \t]+([a-zA-Z0-9_]+)/\2/m,modules,module names/
--regex-Rust=/^[ \t]*(pub[ \t]+)?static[ \t]+([a-zA-Z0-9_]+)/\2/c,consts,static constants/
--regex-Rust=/^[ \t]*(pub[ \t]+)?trait[ \t]+([a-zA-Z0-9_]+)/\2/t,traits,traits/
--regex-Rust=/^[ \t]*(pub[ \t]+)?impl([ \t\n]*<[^>]*>)?[ \t]+(([a-zA-Z0-9_:]+)[ \t]*(<[^>]*>)?[ \t]+(for)[ \t]+)?([a-zA-Z0-9_]+)/\4 \6 \7/i,impls,trait implementations/
--regex-Rust=/^[ \t]*macro_rules![ \t]+([a-zA-Z0-9_]+)/\1/d,macros,macro definitions/
--langdef=typescript
--langmap=typescript:.ts
--regex-typescript=/^[ \t]*(export)?[ \t]*class[ \t]+([a-zA-Z0-9_]+)/\2/c,classes/
--regex-typescript=/^[ \t]*(export)?[ \t]*module[ \t]+([a-zA-Z0-9_]+)/\2/n,modules/
--regex-typescript=/^[ \t]*(export)?[ \t]*function[ \t]+([a-zA-Z0-9_]+)/\2/f,functions/
--regex-typescript=/^[ \t]*export[ \t]+var[ \t]+([a-zA-Z0-9_]+)/\1/v,variables/
--regex-typescript=/^[ \t]*var[ \t]+([a-zA-Z0-9_]+)[ \t]*=[ \t]*function[ \t]*\(\)/\1/v,varlambdas/
--regex-typescript=/^[ \t]*(export)?[ \t]*(public|private)[ \t]+(static)?[ \t]*([a-zA-Z0-9_]+)/\4/m,members/
--regex-typescript=/^[ \t]*(export)?[ \t]*interface[ \t]+([a-zA-Z0-9_]+)/\2/i,interfaces/
--regex-typescript=/^[ \t]*(export)?[ \t]*enum[ \t]+([a-zA-Z0-9_]+)/\2/e,enums/
--regex-typescript=/^[ \t]*import[ \t]+([a-zA-Z0-9_]+)/\1/I,imports/
--langdef=elm
--langmap=elm:.elm
--regex-elm=/^module[ \t]*([A-Z][a-zA-Z0-9'_.]*)/\1/m,module/
--regex-elm=/^type[ \t]*([A-Z][a-zA-Z0-9'_]*)./\1/t,type/
--regex-elm=/^([a-z_][a-zA-Z0-9'_]*).*=/\1/v,function/

View file

@ -1,17 +1,25 @@
set -g default-terminal "screen-256color"
set -g mouse on
source-file "${HOME}/makersquare/tmux-themepack/powerline/block/green.tmuxtheme"
unbind C-b
set -g prefix C-a
bind C-a send-prefix
bind-key -r -T prefix k select-pane -U
bind-key -r -T prefix j select-pane -D
bind-key -r -T prefix h select-pane -L
bind-key -r -T prefix l select-pane -R
bind-key -r -T prefix C-k resize-p -U 2
bind-key -r -T prefix C-j resize-p -D 2
bind-key -r -T prefix C-h resize-p -L 2
bind-key -r -T prefix C-l resize-p -R 2
bind % split-window -c "#{pane_current_path}"
bind '"' split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
set -g default-terminal "tmux"

423
configs/.vimrc Normal file
View file

@ -0,0 +1,423 @@
" -- BEGIN: Vundle config --
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" Displays git information in airline.
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
" Autocompletion
Plugin 'Valloric/YouCompleteMe'
" Displays git-tracked C*UD ops within gutter.
Plugin 'airblade/vim-gitgutter'
Plugin 'kien/ctrlp.vim'
Plugin 'mileszs/ack.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
" Syntax Highlighting Support
Plugin 'lambdatoast/elm.vim'
" Themes
Plugin 'sickill/vim-monokai'
Plugin 'altercation/vim-colors-solarized'
" Executes shell commands and pipes output into new Vim buffer.
Plugin 'sjl/clam.vim'
" Multiple cursors for simultaneous edits.
" NOTE: use <C-n> to run miltiple cursors not <C-d>
Plugin 'terryma/vim-multiple-cursors'
" Visualize buffers
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end() " required
filetype plugin indent on " required
" Put your non-Plugin stuff after this line
" -- END: Vundle config --
" Airline Settings
" Enables the list of buffers.
let g:airline#extensions#tabline#enabled = 1
" Shows the filename only.
let g:airline#extensions#tabline#fnamemod = ':t'
" Allow glyphs in airline
let g:airline_powerline_fonts = 1
" It's the twenty-first century...no swaps.
set noswapfile
" Allow visual tab completion in command mode
set wildmenu
" Show Vim commands as they're being input.
set showcmd
" Code folding
set foldmethod=indent
set foldnestmax=10
set nofoldenable
set foldlevel=4
" Use relative line numbers
set relativenumber
" Opens all folds within the buffer
nnoremap ZZ zR
" Closes all folds within the buffer
nnoremap zz zM
" Opens all folds beneath the cursor
" NOTE: j is the character to go down
nnoremap zJ zO
" Opens single fold beneath the cursor
" NOTE: j is the character to go down
nnoremap zj zo
" Opens single fold beneath the cursor
" NOTE: k is the character to go down
nnoremap zK zC
" Opens single fold beneath the cursor
" NOTE: k is the character to go down
nnoremap zk zc
" Changes <leader> to <space> character.
let mapleader = " "
" Supports mouse interaction.
set mouse=a
" Highlights matches during a search.
set hlsearch
nnoremap <leader>/ :set hlsearch!<CR>
" Use custom-made snippets.
nnoremap ,jsfn :-1read $HOME/.vim/function_skeleton.js<CR>o
" backspace settings
set backspace=2
set backspace=indent,eol,start
" Javascript specific variables
let g:javascript_plugin_jsdoc = 1
" GlobalListchars
set list
set listchars=eol,trail:~,nbsp:␣
" Keeps everything concealed at all times. Even when cursor is on the word.
set conceallevel=1
set concealcursor=nvic
" JavaScript thanks to pangloss/vim-javascript
" let g:javascript_conceal_function = "ƒ"
" match ErrorMsg /ƒ/
" Ultisnips
" Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-x>"
" let g:UltiSnipsJumpForwardTrigger="<c-j>"
" let g:UltiSnipsJumpBackwardTrigger="<c-k>"
" map jk to <Esc>
inoremap jk <Esc>
" Conventional Emacs line-editor defaults
inoremap <C-a> <Esc>I
inoremap <C-e> <Esc>A
" Manage Vertical and Horizontal splits
nnoremap vs <Esc>:vs<CR>
nnoremap vv <Esc>:vs<CR>
nnoremap sp <Esc>:sp<CR>
nnoremap ss <Esc>:sp<CR>
" Move around splits with <leader>
nnoremap <leader>h <C-w>h
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>l <C-w>l
nnoremap <leader>q <C-w>q
" Fuzzy-find open buffer via CtrlP
nnoremap <leader>bg :CtrlPBuffer<CR>
" Buffer creation and management
" Buffer movement
nnoremap <C-l> :1bnext<CR>
nnoremap <C-h> :1bprevious<CR>
" Buffer creation
nnoremap <C-t> :enew<CR>
" Buffer deletion
nnoremap <leader>bq :bp <BAR> bd #<CR>
" make Y do what is intuitive given:
" D: deletes until EOL
" C: changes until EOL
" Y: (should) yank until EOL
nnoremap Y y$
" flip number keys to their shift+ counterparts
nnoremap t1 t!
nnoremap t2 t@
nnoremap t3 t#
nnoremap t4 t$
nnoremap t5 t%
nnoremap t6 t^
nnoremap t7 t&
nnoremap t8 t*
nnoremap t9 t(
nnoremap t0 t)
nnoremap T1 T!
nnoremap T2 T@
nnoremap T3 T#
nnoremap T4 T$
nnoremap T5 T%
nnoremap T6 T^
nnoremap T7 T&
nnoremap T8 T*
nnoremap T9 T(
nnoremap T0 T)
nnoremap f1 f!
nnoremap f2 f@
nnoremap f3 f#
nnoremap f4 f$
nnoremap f5 f%
nnoremap f6 f^
nnoremap f7 f&
nnoremap f8 f*
nnoremap f9 f(
nnoremap f0 f)
nnoremap F1 F!
nnoremap F2 F@
nnoremap F3 F#
nnoremap F4 F$
nnoremap F5 F%
nnoremap F6 F^
nnoremap F7 F&
nnoremap F8 F*
nnoremap F9 F(
nnoremap F0 F)
" Karate edits
nnoremap ca9 ca(
nnoremap da9 da(
nnoremap va9 va(
nnoremap ca0 ca)
nnoremap da0 da)
nnoremap va0 va)
nnoremap ci9 ci(
nnoremap di9 di(
nnoremap vi9 vi(
nnoremap ci0 ci)
nnoremap di0 di)
nnoremap vi0 vi)
" scrolling and maintaing mouse position
nnoremap <C-j> j<C-e>
nnoremap <C-k> k<C-y>
" reload file after git changes
nnoremap <C-r> :e<CR>
" -- Syntastic Settings --
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers = ['gjslint']
" Basic settings
set number
set tabstop=2
set expandtab
set shiftwidth=2
syntax enable
set background=dark
colorscheme solarized
set t_Co=255
" Support italics
highlight Comment cterm=italic
" Define highlighting groups
" NOTE: The ANSII aliases for colors will change when iTerm2 settings are
" changed.
highlight InterestingWord1 ctermbg=Magenta ctermfg=Black
highlight InterestingWord2 ctermbg=Blue ctermfg=Black
" h1 highlighting
nnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>x1 :execute '2match none'<CR>
" h2 highlighting
nnoremap <silent> <leader>2 :execute '3match InterestingWord2 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>x2 :execute '3match none'<CR>
"clear all highlighted groups
nnoremap <silent> <leader>xx :execute '2match none'<CR> :execute '3match none'<CR> hh
" pasteboard copy & paste
nnoremap <C-c> V"+y
vnoremap <C-c> "+y
inoremap <C-v> <Esc>"+pa
nnoremap <C-v> o<Esc>"+p
vnoremap <C-v> "+p
" Manage 80 char line limits
highlight OverLength ctermbg=White ctermfg=Black
match OverLength /\%81v.\+/
set wrap!
" Toggle word-wrapping
nnoremap <leader>w :set wrap!<CR>
" Resize split to 10,20,...,100 chars
" Uncomment the next lines for support at those sizes.
" These bindings interfere with the highlight groups, however.
" Increases the width of a vertical split.
" nnoremap <leader>1 :vertical resize 10<CR>
" nnoremap <leader>2 :vertical resize 20<CR>
nnoremap <leader>3 :vertical resize 30<CR>
nnoremap <leader>4 :vertical resize 40<CR>
nnoremap <leader>5 :vertical resize 50<CR>
nnoremap <leader>6 :vertical resize 60<CR>
nnoremap <leader>7 :vertical resize 70<CR>
nnoremap <leader>8 :vertical resize 80<CR>
nnoremap <leader>9 :vertical resize 90<CR>
nnoremap <leader>0 :vertical resize 100<CR>
" Increases the height of a horizontal split.
nnoremap <leader>v1 :resize 5<CR>
nnoremap <leader>v2 :resize 10<CR>
nnoremap <leader>v3 :resize 15<CR>
nnoremap <leader>v4 :resize 20<CR>
nnoremap <leader>v5 :resize 25<CR>
nnoremap <leader>v6 :resize 30<CR>
nnoremap <leader>v7 :resize 35<CR>
nnoremap <leader>v8 :resize 40<CR>
" NERDTree settings
" Show hidden files by default. (Toggle with capital 'i')
let NERDTreeShowHidden=1
" View Directory tree with ctrl + \
nnoremap <C-\> :NERDTreeToggle<CR>
" View open buffer location in tree.
nnoremap <C-o> :NERDTreeFind<CR>
" BOL and EOL
nnoremap H ^
vnoremap H ^
nnoremap L $
vnoremap L $
" trim trailing whitespace on save
autocmd BufWritePre *.{js,py,tpl,less,html} :%s/\s\+$//e
" set default font and size
set guifont=Operator\ Mono:h16
" CtrlP Config.
set runtimepath^=~/.vim/bundle/ctrlp.vim
" let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Maps CtrlP to leader to future-proof config.
nnoremap <leader>p :CtrlP<CR>
" Fuzzy-finds files within cwd.
" nnoremap <leader>pf :CtrlP<CR>
" Ignores dirs and files
let g:ctrlp_custom_ignore = {
\ 'dir': 'node_modules',
\ 'file': '\v\.(exe|dll|png|jpg|jpeg)$'
\}

View file

@ -24,7 +24,7 @@ source $HOME/pc_settings/scripts/setup_keybindings.sh
# BEGIN: bindkeys
bindkey "^R" history-incremental-search-backward
bindkey -M viins 'jj' vi-cmd-mode
bindkey -M viins 'jk' vi-cmd-mode
# END: bindkeys
# export docker env variables
@ -39,3 +39,7 @@ bindkey -M viins 'jj' vi-cmd-mode
# brew install zsh-syntax-highlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Regain control of CLI <C- mappings for vim keybindings
# RE: http://superuser.com/questions/588846/cannot-get-vim-to-remap-ctrls-to-w
stty -ixon

View file

@ -1,39 +1,38 @@
#!/usr/bin/env bash
# .zsh_profile
if [ -f "$HOME"/.zsh_profile ] && [ ! -L "$HOME"/.zsh_profile ]; then
# backup .zsh_profile
echo -n "Backing up .zsh_profile ... " && \
mv "$HOME"/.zsh_profile "$HOME"/.zsh_profile.bak && \
echo "Done."
fi
if [ -L "$HOME"/.zsh_profile ]; then
# TODO: make sure that .zsh_profile is symlinked to the correct location.
echo ".zsh_profile is already symlinked."
else
# create symlink to pc_settings .zsh_profile
echo -n "Symlinking to pc_settings/configs/.zsh_profile ... " && \
ln -s "$HOME"/pc_settings/configs/.zsh_profile "$HOME"/.zsh_profile && \
echo "Done."
fi
pc_settings_path="$HOME/pc_settings"
# backup .tmux.conf
if [ -f "$HOME"/.tmux.conf ] && [ ! -L "$HOME"/.tmux.conf ]; then
echo -n "Backing up .tmux.conf ... " && \
mv "$HOME"/.tmux.conf "$HOME"/.tmux.conf.bak && \
echo "Done."
fi
config_files=( \
".zsh_profile" \
".tmux.conf" \
".ctags" \
".vimrc" \
)
if [ -L "$HOME"/.tmux.conf ]; then
# TODO: make sure that .tmux.conf is symlinked to the correct location.
echo ".tmux.conf is already symlinked."
else
# create symlink to pc_settings .tmux.conf
echo -n "Symlinking to pc_settings/configs/.tmux.conf ... " && \
ln -s "$HOME"/pc_settings/configs/.tmux.conf "$HOME"/.tmux.conf && \
echo "Done."
fi
for i in {0..3}; do
cf="${config_files[i]}"
echo "\"$cf\": "
if [ -f "$HOME/$cf" ] && [ ! -L "$HOME/$cf" ]; then
echo -n "Backing up $cf ... " && \
mv "$HOME/$cf" "$HOME/$cf.bak" && \
echo "Done."
fi
if [ -L "$HOME/$cf" ]; then
if [ $(readlink "$HOME/$cf") = "$pc_settings_path/configs/$cf" ]; then
echo "Already properly symlinked to \"$pc_settings_path/configs\"."
else
echo "Already symlinked but NOT to the proper location. Aborting..."
fi
else
echo -n "Symlinking to $pc_settings_path/configs/$cf ... " && \
ln -s "$pc_settings_path/configs/$cf" "$HOME/$cf" && \
echo "Done."
fi
echo ""
done

View file

@ -1,3 +1,15 @@
# fuzzily-find-file
function wgff {
echo $(find . -type f | fzf)
}
# fuzzily-find-branch
function wgfb {
echo $(git branch -a | fzf)
}
# download files to /tmp directory
function wdownload {
URL="$1"

2
usbify/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.DS_Store
*.swp

55
usbify/update.sh Executable file
View file

@ -0,0 +1,55 @@
#!/usr/bin/env bash
# This script is used to ensure the USB has the latest code from the repository.
# Update the following values to reflect the locations of each directory on your
# particular machine.
path_to_local_repo="$HOME/pc_settings" # path to git repo
path_to_ext_device="/Volumes/usb_vim" # path to USB device
if [ ! -d "$path_to_ext_device" ]; then
echo "No external device found at ${path_to_ext_device}." && \
echo "Make sure the values input within update.sh are correct." && \
echo "path_to_ext_device: $path_to_ext_device" && \
echo "Exiting." && return 1
fi
if [ ! -d "$path_to_local_repo" ]; then
echo "No repository found at ${path_to_local_repo}." && \
echo "Make sure the values input within update.sh are correct." && \
echo "path_to_local_repo: $path_to_local_repo" && \
echo "Exiting." && return 1
fi
# Update the local copy of the repo.
echo -n "Updating pc_settings..." && \
pushd "$path_to_local_repo" >/dev/null && \
git pull origin master >/dev/null
if [ ! "$?" -eq 0 ]; then
echo "Error: git pull error. Exiting." && \
return 1
else
echo "Done."
fi
# Copy vim directory to USB device.
echo -n "Copying files to external device..." && \
pushd "$path_to_ext_device" >/dev/null && \
rm -rf "${path_to_ext_device}/vim" &>/dev/null && \
cp -r "${path_to_local_repo}/usbify/vim" "${path_to_ext_device}/vim" \
&>/dev/null && \
if [ ! "$?" -eq 0 ]; then
echo "Error: rm or cp error. Exiting." && \
return 1
else
echo "Done."
fi
# restore the dirs to its state before running this script
popd >/dev/null && popd >/dev/null && echo "Complete." && return 0

378
usbify/vim/.vimrc Normal file
View file

@ -0,0 +1,378 @@
" -- BEGIN: Vundle config --
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" The following are examples of different formats supported.
" Keep Plugin commands between vundle#begin/end.
" Displays git information in airline.
Plugin 'tpope/vim-fugitive'
Plugin 'Raimondi/delimitMate'
" Autocompletion
Plugin 'Valloric/YouCompleteMe'
" Displays git-tracked C*UD ops within gutter.
Plugin 'airblade/vim-gitgutter'
Plugin 'kien/ctrlp.vim'
Plugin 'mileszs/ack.vim'
Plugin 'pangloss/vim-javascript'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
" Themes
Plugin 'sickill/vim-monokai'
Plugin 'altercation/vim-colors-solarized'
" Executes shell commands and pipes output into new Vim buffer.
Plugin 'sjl/clam.vim'
" Multiple cursors for simultaneous edits.
" NOTE: use <C-n> to run miltiple cursors not <C-d>
Plugin 'terryma/vim-multiple-cursors'
" Visualize buffers
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
call vundle#end() " required
filetype plugin indent on " required
" Put your non-Plugin stuff after this line
" -- END: Vundle config --
" Airline Settings
" Enables the list of buffers.
let g:airline#extensions#tabline#enabled = 1
" Shows the filename only.
let g:airline#extensions#tabline#fnamemod = ':t'
" Allow glyphs in airline
let g:airline_powerline_fonts = 1
" It's the twenty-first century...no swaps.
set noswapfile
" Allow visual tab completion in command mode
set wildmenu
" Show Vim commands as they're being input.
set showcmd
" Changes <leader> to <space> character.
let mapleader = " "
" Supports mouse interaction.
set mouse=a
" Highlights matches during a search.
set hlsearch
nnoremap <leader>/ :set hlsearch!<CR>
" Use custom-made snippets.
nnoremap ,jsfn :-1read $HOME/.vim/function_skeleton.js<CR>o
" backspace settings
set backspace=2
set backspace=indent,eol,start
" Javascript specific variables
let g:javascript_plugin_jsdoc = 1
" set foldmethod=syntax
" GlobalListchars
set list
set listchars=eol,trail:~,nbsp:␣
" Keeps everything concealed at all times. Even when cursor is on the word.
set conceallevel=1
set concealcursor=nvic
" JavaScript thanks to pangloss/vim-javascript
" let g:javascript_conceal_function = "ƒ"
" match ErrorMsg /ƒ/
" Ultisnips
" Track the engine.
Plugin 'SirVer/ultisnips'
" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'
" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<c-x>"
" let g:UltiSnipsJumpForwardTrigger="<c-j>"
" let g:UltiSnipsJumpBackwardTrigger="<c-k>"
" map jk to <Esc>
inoremap jk <Esc>
" Conventional Emacs line-editor defaults
inoremap <C-a> <Esc>I
inoremap <C-e> <Esc>A
" Manage Vertical and Horizontal splits
nnoremap vs <Esc>:vs<CR>
nnoremap vv <Esc>:vs<CR>
nnoremap sp <Esc>:sp<CR>
nnoremap ss <Esc>:sp<CR>
" Move around splits with <leader>
nnoremap <leader>h <C-w>h
nnoremap <leader>j <C-w>j
nnoremap <leader>k <C-w>k
nnoremap <leader>l <C-w>l
nnoremap <leader>q <C-w>q
" Fuzzy-find open buffer via CtrlP
nnoremap <leader>bg :CtrlPBuffer<CR>
" Buffer creation and management
" Buffer movement
nnoremap <C-l> :1bnext<CR>
nnoremap <C-h> :1bprevious<CR>
" Buffer creation
nnoremap <C-t> :enew<CR>
" Buffer deletion
nnoremap <leader>bq :bp <BAR> bd #<CR>
" make Y do what is intuitive given:
" D: deletes until EOL
" C: changes until EOL
nnoremap Y y$
" flip number keys to their shift+ counterparts
nnoremap t1 t!
nnoremap t2 t@
nnoremap t3 t#
nnoremap t4 t$
nnoremap t5 t%
nnoremap t6 t^
nnoremap t7 t&
nnoremap t8 t*
nnoremap t9 t(
nnoremap t0 t)
nnoremap T1 T!
nnoremap T2 T@
nnoremap T3 T#
nnoremap T4 T$
nnoremap T5 T%
nnoremap T6 T^
nnoremap T7 T&
nnoremap T8 T*
nnoremap T9 T(
nnoremap T0 T)
nnoremap f1 f!
nnoremap f2 f@
nnoremap f3 f#
nnoremap f4 f$
nnoremap f5 f%
nnoremap f6 f^
nnoremap f7 f&
nnoremap f8 f*
nnoremap f9 f(
nnoremap f0 f)
nnoremap F1 F!
nnoremap F2 F@
nnoremap F3 F#
nnoremap F4 F$
nnoremap F5 F%
nnoremap F6 F^
nnoremap F7 F&
nnoremap F8 F*
nnoremap F9 F(
nnoremap F0 F)
" Karate edits
nnoremap ca9 ca(
nnoremap da9 da(
nnoremap va9 va(
nnoremap ca0 ca)
nnoremap da0 da)
nnoremap va0 va)
nnoremap ci9 ci(
nnoremap di9 di(
nnoremap vi9 vi(
nnoremap ci0 ci)
nnoremap di0 di)
nnoremap vi0 vi)
" scrolling and maintaing mouse position
nnoremap <C-j> j<C-e>
nnoremap <C-k> k<C-y>
" reload file after git changes
nnoremap <C-r> :e<CR>
" -- Syntastic Settings --
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 1
let g:syntastic_javascript_checkers = ['gjslint']
" Basic settings
set number
set tabstop=2
set expandtab
set shiftwidth=2
syntax enable
set background=dark
colorscheme solarized
set t_Co=255
" Support italics
highlight Comment cterm=italic
" Define highlighting groups
" NOTE: The ANSII aliases for colors will change when iTerm2 settings are
" changed.
highlight InterestingWord1 ctermbg=Magenta ctermfg=Black
highlight InterestingWord2 ctermbg=Blue ctermfg=Black
" h1 highlighting
nnoremap <silent> <leader>1 :execute '2match InterestingWord1 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>x1 :execute '2match none'<CR>
" h2 highlighting
nnoremap <silent> <leader>2 :execute '3match InterestingWord2 /\<<c-r><c-w>\>/'<CR>
nnoremap <silent> <leader>x2 :execute '3match none'<CR>
"clear all highlighted groups
nnoremap <silent> <leader>xx :execute '2match none'<CR> :execute '3match none'<CR> hh
" pasteboard copy & paste
nnoremap <C-c> V"+y
vnoremap <C-c> "+y
inoremap <C-v> <Esc>"+pa
nnoremap <C-v> o<Esc>"+p
vnoremap <C-v> "+p
" Manage 80 char line limits
highlight OverLength ctermbg=White ctermfg=Black
match OverLength /\%81v.\+/
set wrap!
" Toggle word-wrapping
nnoremap <leader>w :set wrap!<CR>
" Resize split to 10,20,...,100 chars
" Uncomment the next lines for support at those sizes.
" These bindings interfere with the highlight groups, however.
" Increases the width of a vertical split.
" nnoremap <leader>1 :vertical resize 10<CR>
" nnoremap <leader>2 :vertical resize 20<CR>
nnoremap <leader>3 :vertical resize 30<CR>
nnoremap <leader>4 :vertical resize 40<CR>
nnoremap <leader>5 :vertical resize 50<CR>
nnoremap <leader>6 :vertical resize 60<CR>
nnoremap <leader>7 :vertical resize 70<CR>
nnoremap <leader>8 :vertical resize 80<CR>
nnoremap <leader>9 :vertical resize 90<CR>
nnoremap <leader>0 :vertical resize 100<CR>
" Increases the height of a horizontal split.
nnoremap <leader>v1 :resize 5<CR>
nnoremap <leader>v2 :resize 10<CR>
nnoremap <leader>v3 :resize 15<CR>
nnoremap <leader>v4 :resize 20<CR>
nnoremap <leader>v5 :resize 25<CR>
nnoremap <leader>v6 :resize 30<CR>
nnoremap <leader>v7 :resize 35<CR>
nnoremap <leader>v8 :resize 40<CR>
" View Directory tree with ctrl + \
nnoremap <C-\> :NERDTreeToggle<CR>
" BOL and EOL
nnoremap H ^
vnoremap H ^
nnoremap L $
vnoremap L $
" trim trailing whitespace on save
autocmd BufWritePre *.{js,py,tpl,html} :%s/\s\+$//e
" set default font and size
set guifont=Operator\ Mono:h16
" CtrlP Config.
set runtimepath^=~/.vim/bundle/ctrlp.vim
" let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
" Maps CtrlP to leader to future-proof config.
nnoremap <leader>p :CtrlP<CR>
" Fuzzy-finds files within cwd.
" nnoremap <leader>pf :CtrlP<CR>
" Ignores dirs and files
let g:ctrlp_custom_ignore = {
\ 'dir': 'node_modules',
\ 'file': '\v\.(exe|dll|png|jpg|jpeg)$'
\}

52
usbify/vim/vim_point_to_usb.sh Executable file
View file

@ -0,0 +1,52 @@
#!/usr/bin/env bash
path_to_ext_device="/Volumes/usb_vim"
# ensure there is an external device connected and that the path to it is
# accurate.
if [ ! -d "$path_to_ext_device" ]; then
echo "No external device found at: $path_to_ext_device"
echo "Ensure that the value set for path_to_ext_device is correct."
echo "path_to_ext_device: $path_to_ext_device"
echo "Exiting."
return 1
fi
# This script toggles between local vim and a version that can be stored on an
# external device like a USB.
# USB --> local machine
if [ -L "$HOME/.vim" ] && [ -L "$HOME/.vimrc" ]; then
echo "Pointing to USB. Toggling back to local machine..."
# remove the symlinks
rm "$HOME/.vim"
rm "$HOME/.vimrc"
# restore back-ups as active files
[ -d "$HOME/.vim.bak" ] && mv "$HOME/.vim.bak" "$HOME/.vim"
[ -f "$HOME/.vimrc.bak" ] && mv "$HOME/.vimrc.bak" "$HOME/.vimrc"
echo ".vim now points to $HOME/.vim"
echo ".vimrc now points to $HOME/.vimrc"
# local machine --> USB
else
echo "Pointing to local machine. Toggling to USB..."
# back-up local machine's files
[ -d "$HOME/.vim" ] && mv "$HOME/.vim" "$HOME/.vim.bak"
[ -f "$HOME/.vimrc" ] && mv "$HOME/.vimrc" "$HOME/.vimrc.bak"
# symlink .vim and .vimrc to external device
ln -s "${path_to_ext_device}/vim/.vim" "$HOME/.vim"
ln -s "${path_to_ext_device}/vim/.vimrc" "$HOME/.vimrc"
echo ".vim now points to ${path_to_ext_device}/vim/.vim"
fi
echo "Done."