diff options
44 files changed, 351 insertions, 348 deletions
diff --git a/.bash_profile b/.bash_profile deleted file mode 100644 index 28e20bb64c12..000000000000 --- a/.bash_profile +++ /dev/null @@ -1,17 +0,0 @@ -export PATH=$HOME/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH - - -echo "Welcome back, $USER" - -# use vi bindings for terminal input -set -o vi - -# aliases -source $HOME/pc_settings/.w_aliases.sh - -# functions -source $HOME/pc_settings/.w_functions.sh - -# syntax highlighting for CLI; if not installed, run the following command -# brew install zsh-syntax-highlighting - diff --git a/.escape_codes_bash.py b/.escape_codes_bash.py deleted file mode 100644 index 8510c5eaaf48..000000000000 --- a/.escape_codes_bash.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python - -""" -Forward and Backward lookups for Bash escape sequences -""" - -import sys, re - - -literal_to_bash = { - 'ESC': '^[', - - 'UP-ARROW': '^[OA', - 'RIGHT-ARROW': '^[OC', - 'DOWN-ARROW': '^[OB', - 'LEFT-ARROW': '^[OD', - - 'F1': '^[OP', - 'F2': '^[OQ', - 'F3': '^[OR', - 'F4': '^[OS', - 'F5': '^[15~', - 'F6': '^[17~', - 'F7': '^[18~', - 'F8': '^[19~', - 'F9': '^[20~', - 'F10': '^[21~', - 'F11': None, - 'F12': '^[24~' -} - -bash_to_literal = { - v: k for k, v in literal_to_bash.items() -} - -el = sys.argv[1] - -print '{0}: "{1}"'.format(el, literal_to_bash[el]) diff --git a/.escape_codes_url.py b/.escape_codes_url.py deleted file mode 100644 index 60aa1c210694..000000000000 --- a/.escape_codes_url.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/python - -""" -Forward and Backward lookups for URL escape sequences -""" - -import sys, re - - -literal_to_esccode = { - ' ': '%20', - '<': '%3C', - '>': '%3E', - '#': '%23', - '%': '%25', - '{': '%7B', - '}': '%7D', - '|': '%7C', - '\\': '%5C', - '^': '%5E', - '~': '%7E', - '[': '%5B', - ']': '%5D', - '`': '%60', - ';': '%3B', - '/': '%2F', - '?': '%3F', - ':': '%3A', - '@': '%40', - '=': '%3D', - '&': '%26', - '$': '%24', -} - - -esccode_to_literal = { - v: k for k, v in literal_to_esccode.items() -} - - -def is_esccode(string): - p = re.compile(r'^%\w\w$') - m = p.match(string) - return bool(p.match(string)) - - -try: - el = sys.argv[1] -except: - el = None - -if not el: - print literal_to_esccode -else: - msg = esccode_to_literal[el] if is_esccode(el) else literal_to_esccode[el] - print '"{0}": "{1}"'.format(el, msg) diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..55d00c567109 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vim diff --git a/.vimrc b/.vimrc deleted file mode 100644 index 926d70f90dd0..000000000000 --- a/.vimrc +++ /dev/null @@ -1,7 +0,0 @@ -syntax on -set number -set tabstop=2 -set expandtab -set shiftwidth=2 -colorscheme murphy - diff --git a/README.md b/README.md index 3813c8717407..eaf897c4d315 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ # My Mac Configuration I'm documenting this for personal use. Shell settings, vim settings, commonly used applications, et cetera... -### to do -* migrate Google Chrome bookmarks to new machine - ### Commonly used applications * homebrew - necessary for procuring shell applications * karabiner - `key-repeat: 50ms delay-until-repeat: 300ms` increase your Mac's key repeat settings beyond the default range diff --git a/.w_aliases.sh b/aliases.sh index c427af58e9be..c427af58e9be 100644 --- a/.w_aliases.sh +++ b/aliases.sh diff --git a/configs/.tmux.conf b/configs/.tmux.conf new file mode 100644 index 000000000000..5ef3765e86ab --- /dev/null +++ b/configs/.tmux.conf @@ -0,0 +1,7 @@ +set -g default-terminal "screen-256color" + +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 + diff --git a/.zsh_profile b/configs/.zsh_profile index f56d5f1c2e94..28e21f3ca40c 100644 --- a/.zsh_profile +++ b/configs/.zsh_profile @@ -1,4 +1,7 @@ -export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:$PATH +export PATH=$HOME/bin:/opt/local/bin:/opt/local/sbin:/usr/local/go/bin:$PATH + +# make vim the default editor for commit messages etc +export EDITOR=$(which vim) echo "Welcome back, $USER" @@ -6,10 +9,15 @@ echo "Welcome back, $USER" set -o vi # aliases -source $HOME/pc_settings/.w_aliases.sh +source $HOME/pc_settings/aliases.sh # functions -source $HOME/pc_settings/.w_functions.sh +source $HOME/pc_settings/functions/index.sh + + +# setup keybindings for history functions +source $HOME/pc_settings/scripts/setup_keybindings.sh + # BEGIN: bindkeys bindkey "^R" history-incremental-search-backward diff --git a/configs/setup_configs.sh b/configs/setup_configs.sh new file mode 100755 index 000000000000..e1a742c4b199 --- /dev/null +++ b/configs/setup_configs.sh @@ -0,0 +1,39 @@ +#!/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 + + +# 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 + +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 + diff --git a/.git_functions.sh b/functions/git_functions.sh index 16162f0191a9..6ed195a81253 100644 --- a/.git_functions.sh +++ b/functions/git_functions.sh @@ -49,26 +49,30 @@ function wgcheckout { } -# combine fetch and rebase (git frebase) -function wgfreebase { - if [ -z $1 ]; then - branchname="$(git symbolic-ref HEAD 2> /dev/null | cut -f3 -d'/')" - else - branchname="$1" - fi - - git fetch origin "$branchname" && git rebase origin/"$branchname" +# opens the current ticket-branch in web browser +function wgjira { + base_url="https://jira.hugeinc.com/browse" + ticket=$(wgtix) + + open "${base_url}/${ticket}" +} + + +# wgcheckout combined with a fuzzy search +function wgfcheckout { + branchname=$(trim $(git branch | fzf)) + + [ ! -z "$branchname" ] && wgcheckout "$branchname" || return } -# push to current branch -function wgpush { - if [ -z $1 ]; then - branchname="$(git symbolic-ref HEAD 2> /dev/null | cut -f3 -d'/')" - else - branchname="$1" - fi +# View an author's work within a specified date range. +function wgviewcommits { + author=$([ -z "$1" ] && echo "William Carroll" || echo "$1") + todays_date=$(date +'%Y-%m-%d') + date=$([ -z "$2" ] && echo "${todays_date}" || echo "$2") - git push origin $branchname + git log --all --author="${author}" --after="${date} 00:00" \ + --before="${date} 23:59" } diff --git a/functions/history_functions.sh b/functions/history_functions.sh new file mode 100644 index 000000000000..5f97884b1018 --- /dev/null +++ b/functions/history_functions.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + + +HISTFILE=~/.zsh_history + + +function wh_two_back { + command=$(history | tail -n 2 | head -n 1 | cut -c 8-) + echo -n $command +} + + +function wh_three_back { + command=$(history | tail -n 3 | head -n 1 | cut -c 8-) + echo -n "$command" +} + + +function wh_four_back { + command=$(history | tail -n 4 | head -n 1 | cut -c 8-) + echo -n "$command" +} + + +function wh_five_back { + command=$(history | tail -n 5 | head -n 1 | cut -c 8-) + echo -n "$command" +} + diff --git a/.w_functions.sh b/functions/index.sh index 071289e46f90..ae73bed38f54 100644 --- a/.w_functions.sh +++ b/functions/index.sh @@ -3,14 +3,21 @@ npms() { npm start; } + # custom js functions -source $HOME/pc_settings/.js_to_bash.sh +source $HOME/pc_settings/functions/js_to_bash.sh # custom git functions -source $HOME/pc_settings/.git_functions.sh +source $HOME/pc_settings/functions/git_functions.sh # custom bash helpers functions -# source $HOME/pc_settings/.misc_functions.sh +source $HOME/pc_settings/functions/misc_functions.sh + +# custom history functions for zle bindkey +source $HOME/pc_settings/functions/history_functions.sh + +# custom functions to work with vim +source $HOME/pc_settings/functions/vim_functions.sh # generates placeholder content for FE work function lorem { diff --git a/.js_to_bash.sh b/functions/js_to_bash.sh index 22a70a556077..22a70a556077 100644 --- a/.js_to_bash.sh +++ b/functions/js_to_bash.sh diff --git a/functions/misc_functions.sh b/functions/misc_functions.sh new file mode 100644 index 000000000000..17c13d7a6ae9 --- /dev/null +++ b/functions/misc_functions.sh @@ -0,0 +1,40 @@ +# download files to /tmp directory +function wdownload { + URL="$1" + FILENAME="$(basename $URL)" + + wget -O /tmp/"$FILENAME" $URL >/dev/null && open /tmp && echo "Downloaded to: /tmp/$FILENAME" || echo "Error ..." +} + + +# spell checker +function wspcheck { + if [ $# -ge 1 -a -f "$1" ] && input="$1" || input="-" + cat "$input" | tr '[:upper:]' '[:lower:]' | tr -cd '[:alpha:]_ \n' | tr -s ' ' '\n' | sort | comm -23 - ~/english_words.txt +} + + +# fuzzily search through dirs stack +function wfd { + dir=$(dirname $(fzf)) && pushd "$dir" >/dev/null +} + + +# pushd into a directory on your dirs stack +function wpushd { + dir="$(dirs | tr ' ' '\n' | fzf)" && pushd "$dir" +} + + +# trims leading and trailing whitespace +function trim { + input="$1" + + echo "${input//[[:blank:]]/}" +} + + +function wgreviewers { + echo "BJ Warshaw\nDaniel Wasilewski\nSean Sullivan\nCharles Morrissey\nRyan Balch\nZach Goldstein\nWilliam Anderson" +} + diff --git a/functions/vim_functions.sh b/functions/vim_functions.sh new file mode 100644 index 000000000000..63e01b534b18 --- /dev/null +++ b/functions/vim_functions.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Easily search for strings within the files within the current directory. +# Specify file extensions and directories to exclude to improve accuracy. +# The file selected from fzf will be opened in vim. +function vfzopen() { + echo -n "Search Term: " + read search_query + echo -n "Filename: " + read filetype + echo -n "Exclude Directory: " + read exclude_dir + + if [ ! -z "$exclude_dirs" ]; then + filename=$(find . -type f -name "$filetype" | \ + xargs grep -l "$search_query" | fzf) + else + filename=$(find . -type f -name "$filetype" -not -path "./${exclude_dir}/*" \ + | xargs grep -l "$search_query" | fzf) + fi + + + if [ ! -z "$filename" ]; then + vim "$filename" + return 0 + else + return 1 + fi +} diff --git a/launchd_scripts/attempt_vim_switch.sh b/launchd_scripts/attempt_vim_switch.sh new file mode 100755 index 000000000000..65f77c342671 --- /dev/null +++ b/launchd_scripts/attempt_vim_switch.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + + +if [ -d /Volumes/usb_vim ] && \ # usb has mounted + [ ! -L "$HOME/.vimrc" ] && \ # .vimrc is a symlink + [ ! -L "$HOME/.vim" ]; then # .vim dir is a symlink + . "/Volumes/usb_vim/vim/vim_point_to_usb.sh" + . "$HOME/pc_settings/launchd_scripts/notice.sh" +else + . "$HOME/pc_settings/launchd_scripts/notice_2.sh" +fi + + diff --git a/launchd_scripts/bootstrap.sh b/launchd_scripts/bootstrap.sh new file mode 100755 index 000000000000..0df2689ae18e --- /dev/null +++ b/launchd_scripts/bootstrap.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + + +# Unload scripts in case there have been changes since it was last loaded. +echo -n "Unloading personal *.plist files... " && +launchctl unload ~/Library/LaunchAgents/watch_volumes.plist && +echo "Done." || echo "Error." + + +# Remove *.plist symlinks created last time. +echo -n "Removing *.plist symlinks... " && +rm ~/Library/LaunchAgents/watch_volumes.plist && +echo "Done." || echo "Error." + + +# Process the *.tpl files, replacing global identifiers with the values +# from vars.json. +echo -n "Processing *.tpl files... " && +. ./process_files.sh && +echo "Done." || echo "Error." + + +# Recreate those symlinks. +echo -n "Recreating *.plist symlinks to ~/Library/LaunchAgents ... " && +ln -s ~/pc_settings/launchd_scripts/watch_volumes.plist \ + ~/Library/LaunchAgents/watch_volumes.plist && +echo "Done." || echo "Error." + + +# Reload scripts in case there have been changes since it was last loaded. +echo -n "Reloading personal *.plist files... " && +launchctl load ~/Library/LaunchAgents/watch_volumes.plist && +echo "Done." || echo "Error." + diff --git a/launchd_scripts/notice.sh b/launchd_scripts/notice.sh new file mode 100755 index 000000000000..1567be3601e4 --- /dev/null +++ b/launchd_scripts/notice.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +osascript -e "tell Application \"System Events\" to display alert\ + \"New volume mounted.\"" + diff --git a/launchd_scripts/notice_2.sh b/launchd_scripts/notice_2.sh new file mode 100755 index 000000000000..188ee813a06c --- /dev/null +++ b/launchd_scripts/notice_2.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +osascript -e "tell Application \"System Events\" to display alert\ + \"Not going to switch!\"" + diff --git a/launchd_scripts/process_files.sh b/launchd_scripts/process_files.sh new file mode 100755 index 000000000000..a5e330d7705b --- /dev/null +++ b/launchd_scripts/process_files.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# This script processes certain files and replaces +# {{<IDENTIFIER>}} with the entries in vars.json + +output_path="./watch_volumes.plist" +template_file="watch_volumes.plist.tpl" +usb_drive_path=$(jq < ./vars.json '.USB_DRIVE_PATH' | \ + sed 's/\//\\\//g' | sed 's/"//g') + +cat "$template_file" | perl -p -e 's/(\{\{[^}]+\}\})/'$usb_drive_path'/g' \ + >"$output_path" + +echo "Done." + diff --git a/launchd_scripts/vars.json b/launchd_scripts/vars.json new file mode 100644 index 000000000000..6b5328c461f4 --- /dev/null +++ b/launchd_scripts/vars.json @@ -0,0 +1,3 @@ +{ + "USB_DRIVE_PATH": "/Volumes/usb_vim/" +} diff --git a/launchd_scripts/watch_volumes.plist b/launchd_scripts/watch_volumes.plist new file mode 100644 index 000000000000..f082952fec76 --- /dev/null +++ b/launchd_scripts/watch_volumes.plist @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" +"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Label</key> + <string>WatchVolumes</string> + + <key>ProgramArguments</key> + <array> + <string>/Users/wcarroll/pc_settings/launchd_scripts/attempt_vim_switch.sh</string> + </array> + + <key>WatchPaths</key> + <array> + <string>/Volumes/usb_vim/</string> + </array> +</dict> +</plist> diff --git a/launchd_scripts/watch_volumes.plist.tpl b/launchd_scripts/watch_volumes.plist.tpl new file mode 100644 index 000000000000..be5cb4ad763d --- /dev/null +++ b/launchd_scripts/watch_volumes.plist.tpl @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" +"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>Label</key> + <string>WatchVolumes</string> + + <key>ProgramArguments</key> + <array> + <string>/Users/wcarroll/pc_settings/launchd_scripts/attempt_vim_switch.sh</string> + </array> + + <key>WatchPaths</key> + <array> + <string>{{USB_DRIVE_PATH}}</string> + </array> +</dict> +</plist> diff --git a/scripts/.swp b/scripts/.swp new file mode 100644 index 000000000000..5f747da37c33 --- /dev/null +++ b/scripts/.swp Binary files differdiff --git a/scripts/setup_keybindings.sh b/scripts/setup_keybindings.sh new file mode 100644 index 000000000000..872f3eea429b --- /dev/null +++ b/scripts/setup_keybindings.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + + +# This file is run after history_functions.sh have been sourced. +# It converts the defined functions into zsh widgets that are +# thereafter bound to keys for expedience. + + +zle -N wh_two_back_widget wh_two_back && +bindkey '^@' wh_two_back_widget + diff --git a/usbify/README.md b/usbify/README.md index 4486c5984acc..ea84b36bbb32 100644 --- a/usbify/README.md +++ b/usbify/README.md @@ -1,6 +1,6 @@ # USBify -This folder contains packages to make applications into USB portable. +This folder contains packages to make applications USB portable. ## vim Run the `vim_to_usb.sh` script to point your $HOME/.vim folder to an external USB diff --git a/usbify/vim/.vim/.DS_Store b/usbify/vim/.vim/.DS_Store deleted file mode 100644 index 5008ddfcf53c..000000000000 --- a/usbify/vim/.vim/.DS_Store +++ /dev/null Binary files differdiff --git a/usbify/vim/.vim/.netrwhist b/usbify/vim/.vim/.netrwhist deleted file mode 100644 index 75884b1b5e65..000000000000 --- a/usbify/vim/.vim/.netrwhist +++ /dev/null @@ -1,11 +0,0 @@ -let g:netrw_dirhistmax =10 -let g:netrw_dirhist_cnt =9 -let g:netrw_dirhist_1='/Users/wcarroll/huge/projects/google/cerebro/static/js' -let g:netrw_dirhist_2='/Users/wcarroll/huge/projects/google/cerebro/static' -let g:netrw_dirhist_3='/Users/wcarroll/huge/projects/google/cerebro' -let g:netrw_dirhist_4='/Users/wcarroll' -let g:netrw_dirhist_5='/Users' -let g:netrw_dirhist_6='/' -let g:netrw_dirhist_7='/Users/wcarroll/huge/projects/google/cerebro' -let g:netrw_dirhist_8='/Users/wcarroll' -let g:netrw_dirhist_9='/Users/wcarroll/huge/projects/google/cerebro' diff --git a/usbify/vim/.vim/bundle/L9 b/usbify/vim/.vim/bundle/L9 deleted file mode 160000 -Subproject c822b05ee0886f9a9703227dc85a6d47612c4bf diff --git a/usbify/vim/.vim/bundle/Vundle.vim b/usbify/vim/.vim/bundle/Vundle.vim deleted file mode 160000 -Subproject 4984767509e3d05ca051e253c8a8b37de784be4 diff --git a/usbify/vim/.vim/bundle/command-t b/usbify/vim/.vim/bundle/command-t deleted file mode 160000 -Subproject 354c429dad34f7d163663943c948f819588b53d diff --git a/usbify/vim/.vim/bundle/ctrlp.vim b/usbify/vim/.vim/bundle/ctrlp.vim deleted file mode 160000 -Subproject b9fa920b4abbb54799927a3bc57869fdd556321 diff --git a/usbify/vim/.vim/bundle/nerdtree b/usbify/vim/.vim/bundle/nerdtree deleted file mode 160000 -Subproject 2e2b649232d6ae4d02d74793e5da0ee08480ad8 diff --git a/usbify/vim/.vim/bundle/newL9 b/usbify/vim/.vim/bundle/newL9 deleted file mode 160000 -Subproject a78607c9f63f270137e472126ee1b2c3ae52a84 diff --git a/usbify/vim/.vim/bundle/sparkup b/usbify/vim/.vim/bundle/sparkup deleted file mode 160000 -Subproject d400a570bf64b0c216aa7c8e1795820b911a740 diff --git a/usbify/vim/.vim/bundle/syntastic b/usbify/vim/.vim/bundle/syntastic deleted file mode 160000 -Subproject 6014bdc57f161f5ae5140e4247b144ae149bf89 diff --git a/usbify/vim/.vim/bundle/vim-fugitive b/usbify/vim/.vim/bundle/vim-fugitive deleted file mode 160000 -Subproject c00ebd75ac23f4080c0d0bf9453b16304a3fb31 diff --git a/usbify/vim/.vim/bundle/vim-monokai b/usbify/vim/.vim/bundle/vim-monokai deleted file mode 160000 -Subproject e5d4bfb5dab8c4f122b97fe9c3ed2f2d1e8b3bd diff --git a/usbify/vim/.vim/bundle/yajs.vim b/usbify/vim/.vim/bundle/yajs.vim deleted file mode 160000 -Subproject 5cb4b369cac5b29dd7f2e688b23a2b57263972a diff --git a/usbify/vim/.vim/ftdetect/soy.vim b/usbify/vim/.vim/ftdetect/soy.vim deleted file mode 100644 index 7c9420b0ef47..000000000000 --- a/usbify/vim/.vim/ftdetect/soy.vim +++ /dev/null @@ -1 +0,0 @@ -au BufRead,BufNewFile *.soy set filetype=soy diff --git a/usbify/vim/.vim/gjslint.vim b/usbify/vim/.vim/gjslint.vim deleted file mode 100644 index 336890553d5e..000000000000 --- a/usbify/vim/.vim/gjslint.vim +++ /dev/null @@ -1,46 +0,0 @@ -"============================================================================ -"File: gjslint.vim -"Description: Javascript syntax checker - using gjslint -"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com> -"License: This program is free software. It comes without any warranty, -" to the extent permitted by applicable law. You can redistribute -" it and/or modify it under the terms of the Do What The Fuck You -" Want To Public License, Version 2, as published by Sam Hocevar. -" See http://sam.zoy.org/wtfpl/COPYING for more details. -"============================================================================ - -if exists('g:loaded_syntastic_javascript_gjslint_checker') - finish -endif -let g:loaded_syntastic_javascript_gjslint_checker = 1 - -let s:save_cpo = &cpo -set cpo&vim - -function! SyntaxCheckers_javascript_gjslint_GetLocList() dict - call syntastic#log#deprecationWarn('javascript_gjslint_conf', 'javascript_gjslint_args') - - let makeprg = self.makeprgBuild({ - \ 'args': '--nodebug_indentation', - \ 'args_after': '--check_html --nosummary --unix_mode --nobeep' }) - - let errorformat = - \ "%f:%l:(New Error -%\\?\%n) %m," . - \ "%f:%l:(-%\\?%n) %m," . - \ "%-G1 files checked," . - \ " no errors found.," . - \ "%-G%.%#" - - return SyntasticMake({ - \ 'makeprg': makeprg, - \ 'errorformat': errorformat }) -endfunction - -call g:SyntasticRegistry.CreateAndRegisterChecker({ - \ 'filetype': 'javascript', - \ 'name': 'gjslint'}) - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set sw=4 sts=4 et fdm=marker: diff --git a/usbify/vim/.vim/syntax/soy.vim b/usbify/vim/.vim/syntax/soy.vim deleted file mode 100644 index 8b25b622be59..000000000000 --- a/usbify/vim/.vim/syntax/soy.vim +++ /dev/null @@ -1,145 +0,0 @@ -" Google Closure templates syntax file. -" Language: Soy -" Maintainer: Dugan Chen (https://github.com/duganchen) -" -if exists("b:current_syntax") - finish -endif - -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish -endif - -syntax clear -syntax case match - -syntax keyword soyConstant contained null -syntax keyword soyConstant contained false -syntax keyword soyConstant contained true - -syntax keyword soyFunction contained isFirst -syntax keyword soyFunction contained isLast -syntax keyword soyFunction contained index -syntax keyword soyFunction contained hasData -syntax keyword soyFunction contained length -syntax keyword soyFunction contained round -syntax keyword soyFunction contained floor -syntax keyword soyFunction contained ceiling -syntax keyword soyFunction contained min -syntax keyword soyFunction contained max -syntax keyword soyFunction contained randomInt -syntax keyword soyFunction contained bidiGlobalDir -syntax keyword soyFunction contained bidiDirAttr -syntax keyword soyFunction contained bidiMark -syntax keyword soyFunction contained bidiMarkAfter -syntax keyword soyFunction contained bidiStartEdge -syntax keyword soyFunction contained bidiEndEdge -syntax keyword soyFunction contained bidiTextDir - -syntax keyword soyStatement contained namespace -syntax keyword soyStatement contained template -syntax keyword soyStatement contained delpackage -syntax keyword soyStatement contained deltemplate - -syntax keyword soyKeyword contained literal -syntax keyword soyKeyword contained print -syntax keyword soyKeyword contained msg -syntax keyword soyKeyword contained call -syntax keyword soyKeyword contained delcall -syntax keyword soyKeyword contained param -syntax keyword soyKeyword contained let -syntax keyword soyKeyword contained css - -syntax keyword soyConditional contained if -syntax keyword soyConditional contained elseif -syntax keyword soyConditional contained else -syntax keyword soyConditional contained switch -syntax keyword soyConditional contained case -syntax keyword soyConditional contained default -syntax keyword soyConditional contained ifempty - -syntax keyword soyRepeat contained foreach -syntax keyword soyRepeat contained for -syntax keyword soyRepeat contained in -syntax keyword soyRepeat contained range - -syntax keyword soyCharacter contained sp -syntax keyword soyCharacter contained nil -syntax keyword soyCharacter contained r -syntax keyword soyCharacter contained n -syntax keyword soyCharacter contained t -syntax keyword soyCharacter contained lb -syntax keyword soyCharacter contained rb - -syntax keyword soyDirective contained private -syntax keyword soyDirective contained autoescape -syntax keyword soyDirective contained noAutoescape -syntax keyword soyDirective contained id -syntax keyword soyDirective contained escapeCssString -syntax keyword soyDirective contained escapeHtml -syntax keyword soyDirective contained escapeHtmlRcdata -syntax keyword soyDirective contained escapeHtmlAttribute -syntax keyword soyDirective contained escapeHtmlAttributeNospace -syntax keyword soyDirective contained escapeUri -syntax keyword soyDirective contained escapeJs -syntax keyword soyDirective contained escapeJsRegex -syntax keyword soyDirective contained escapeJsString -syntax keyword soyDirective contained escapeJsValue -syntax keyword soyDirective contained truncate -syntax keyword soyDirective contained insertWordBreaks -syntax keyword soyDirective contained changeNewlineToBr -syntax keyword soyDirective contained desc -syntax keyword soyDirective contained meaning -syntax keyword soyDirective contained data -syntax keyword soyDirective contained kind -syntax keyword soyDirective contained variant -syntax keyword soyDirective contained bidiSpanWrap -syntax keyword soyDirective contained bidiUnicodeWrap - -syntax match soySpecialComment /@param?\?/ contained - -syntax region soyCommand start="{" end="}" contains=soyKeyword, soyDirective, soyIdentifier, soyString, soyTemplate, soyConstant, soyInteger, soyCharacter, soyFloat, soySci, soyOperator, soyFunction, soyRepeat, soyConditional, soyStatement, soyLabel - -syntax region soyString contained start="\'" end="\'" -syntax region soyString contained start="\"" end="\"" - -syntax match soyIdentifier /\$[a-zA-Z0-9._]*\>/ contained -syntax region soyComment start=/\/\*/ end='\\*\/' contains=soySpecialComment - -syntax match soyComment /\/\/.*$/ -syntax match soyTemplate /\s\+\.\w\+\>/ contained - -syntax match soyInteger /\-\?\(0x\)\?[A-F0-9]\+\>/ contained - -syntax match soyNumber /\-\?\d\+\(e\-\?\d\+\)\?\>/ contained - -syntax match soyFloat /\-\?\d\+\.\d\+\>/ contained -syntax match soySci /\-\?\d\+e\-\?\d\+\>/ contained - -syntax match soyOperator /\<\(not\|and\|or\)\>/ contained - -syntax match soyLabel /\<\w\+:/ contained - -" Yes, this causes the - in -1 to show as an operator. This is a bug. -syntax match soyOperator /[-*/%+<>=!?:]/ contained - -highlight def link soyOperator Operator -highlight def link soyKeyword Statement -highlight def link soyDirective Type -highlight def link soyIdentifier Identifier -highlight def link soyString String -highlight def link soyComment Comment -highlight def link soyTemplate Identifier -highlight def link soyInteger Number -highlight def link soyFloat Float -highlight def link soySci Float -highlight def link soyConstant Constant -highlight def link soyCharacter Character -highlight def link soyFunction Function -highlight def link soyRepeat Repeat -highlight def link soyConditional Conditional -highlight def link soyStatement Statement -highlight def link soySpecialComment SpecialComment -highlight def link soyLabel Identifier diff --git a/usbify/vim/.vimrc b/usbify/vim/.vimrc index dd720b76bdb1..ce2a7c88726e 100644 --- a/usbify/vim/.vimrc +++ b/usbify/vim/.vimrc @@ -21,6 +21,8 @@ Plugin 'othree/yajs.vim' Plugin 'crusoexia/vim-monokai' Plugin 'scrooloose/syntastic' Plugin 'scrooloose/nerdtree' +Plugin 'mileszs/ack.vim' +Plugin 'sjl/clam.vim' call vundle#end() " required filetype plugin indent on " required @@ -50,6 +52,7 @@ let g:syntastic_check_on_wq = 1 let g:syntastic_javascript_checkers = ['gjslint'] +" Basic settings syntax on set number set tabstop=2 @@ -59,6 +62,32 @@ colorscheme monokai set t_Co=255 +" Ensure that <header> is "," character +let mapleader = "," + + +" Define highlighting groups +highlight InterestingWord1 ctermbg=Cyan ctermfg=Black +highlight InterestingWord2 ctermbg=Yellow ctermfg=Black +highlight InterestingWord3 ctermbg=Magenta ctermfg=Black + + +" h1 highlighting +nnoremap <silent> <leader>h1 :execute 'match InterestingWord1 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>xh1 :execute 'match none'<CR> + +" h2 highlighting +nnoremap <silent> <leader>h2 :execute '2match InterestingWord2 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>xh2 :execute '2match none'<CR> + +" h3 highlighting +nnoremap <silent> <leader>h3 :execute '3match InterestingWord3 /\<<c-r><c-w>\>/'<CR> +nnoremap <silent> <leader>xh3 :execute '3match none'<CR> + +"clear all highlighted groups +nnoremap <silent> <leader>xhh :execute 'match none'<CR> :execute '2match none'<CR> :execute '3match none'<CR> + + " add 80 character wrap line highlight OverLength ctermbg=red ctermfg=white guibg=#592929 match OverLength /\%81v.\+/ @@ -71,10 +100,20 @@ imap jj <Esc> map <C-n> :NERDTreeToggle<CR> +" BOL and EOL +nnoremap H ^ +nnoremap L $ + + +" set -o emacs line-editor defaults +inoremap <C-a> <Esc>I +inoremap <C-e> <Esc>A + " trim trailing whitespace on save autocmd BufWritePre *.{js,py,tpl,html} :%s/\s\+$//e + " set default font and size set guifont=Operator\ Mono:h16 |