Compare commits

..

10 Commits

Author SHA1 Message Date
c7847d2dc4 ignore dirty state of submodule 2016-06-19 15:33:12 +01:00
941a089d66 modifications to obtain working environment 2016-06-19 15:32:34 +01:00
0bf1741698 reorganise vim config directory 2016-06-19 15:28:11 +01:00
5c2ececbdf reorganise installation script 2016-06-19 15:24:11 +01:00
6a99745ff8 move back to vim 2016-06-19 15:22:39 +01:00
1ec2cfafeb add tmux plugin manager 2016-06-19 15:21:23 +01:00
699645bd1b delete unused things 2016-06-19 15:09:02 +01:00
Nick Nisi
1f14af4ef9 add dns-restart function 2016-05-25 22:30:22 -05:00
Nick Nisi
8b12345643 upgrade plug 2016-05-25 22:30:06 -05:00
Nick Nisi
6ede79f9f4 fixes #28 ~/.vim/ symlink in link.sh
Thanks to @archer96 for finding the issue and providing fix
2016-05-19 05:08:34 -07:00
57 changed files with 676 additions and 1476 deletions

12
.gitignore vendored
View File

@@ -1,10 +1,2 @@
.netrwhist tmux/plugins/*
npm-debug.log config/vim/plugged/*
plug.vim.old
config/nvim/spell
config/nvim/shada
config/nvim/plugged
vim/vim.symlink/spell/
vim/vim.symlink/plugged/

5
.gitmodules vendored
View File

@@ -1,3 +1,8 @@
[submodule ".config/base16-shell"] [submodule ".config/base16-shell"]
path = .config/base16-shell path = .config/base16-shell
url = git@github.com:chriskempson/base16-shell.git url = git@github.com:chriskempson/base16-shell.git
[submodule "tmux/plugins/tpm"]
path = tmux/plugins/tpm
url = git@github.com:tmux-plugins/tpm.git
ignore = dirty

View File

@@ -1,21 +0,0 @@
# General ack Settings
##########################################################
# only search with case-sensitivity if there is mixed case
--smart-case
# follow symlinks
--follow
# ignore directories
--ignore-dir=node_modules
# added file types
--type-set=css=.css,.less,.scss,.styl
--type-set=styl=.styl
--type-set=less=.less
--type-set=html=.html,.mustache,.handlebars,.tmpl
--type-set=json=.json
--type-set=md=.markdown,.md
--type-set=svg=.svg
--type-set=ts=.ts
--type-set=style=.scss,.sass,.styl,.less,.css

View File

@@ -1,65 +0,0 @@
#!/usr/bin/osascript
property defaultAccount : "Pollen"
property defaultMailbox : "INBOX"
on run args
set justUnread to false
set theAccount to missing value
set theMailbox to missing value
if defaultAccount = missing value then set defaultAccount to "-g"
if defaultMailbox = missing value then set defaultMailbox to "INBOX"
set theCount to the count of args
if theCount > 0 then
if item 1 of args = "-u" then
set justUnread to true
set theCount to theCount - 1
set args to the rest of args
else if item 1 of args = "-ug" or item 1 of args = "-gu" then
set justUnread to true
set item 1 of args to "-g"
else if theCount > 1 and ¬
item 1 of args = "-g" and item 2 of args = "-u" then
set justUnread to true
set theCount to theCount - 1
set args to the rest of args
set item 1 of args to "-g"
end if
end if
tell application "Mail"
if theCount = 0 then
set theAccount to defaultAccount
set theMailbox to defaultMailbox
else if theCount = 1 then
set theAccount to item 1 of args
set theMailbox to defaultMailbox
else if theCount = 2 then
set theAccount to item 1 of args
set theMailbox to item 2 of args
else
error character id 10 ¬
& "Usage: inbox-count [-u] [[account] mailbox]" & character id 10 ¬
& " inbox-count [-u] -g [mailbox]"
end if
set mailboxValue to missing value
if theAccount = "-g" then
if theMailbox = "INBOX" then
set mailboxValue to inbox
else
set mailboxValue to mailbox theMailbox
end if
else
set mailboxValue to mailbox theMailbox of account theAccount
end if
if justUnread then
return the unread count of mailboxValue
else
return the count of messages of mailboxValue
end if
end tell
end run

View File

@@ -1,13 +0,0 @@
(* Get the current song from iTunes or Spotify *)
if application "iTunes" is running then
tell application "iTunes"
if exists current track then
set theName to the name of the current track
set theArtist to the artist of the current track
try
return "♫ " & theName & " - " & theArtist
on error err
end try
end if
end tell
end if

View File

@@ -1,26 +0,0 @@
#!/bin/bash
# modified from http://ficate.com/blog/2012/10/15/battery-life-in-the-land-of-tmux/
HEART='♥ '
if [[ `uname` == 'Linux' ]]; then
current_charge=$(cat /proc/acpi/battery/BAT1/state | grep 'remaining capacity' | awk '{print $3}')
total_charge=$(cat /proc/acpi/battery/BAT1/info | grep 'last full capacity' | awk '{print $4}')
else
battery_info=`ioreg -rc AppleSmartBattery`
current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | awk '{print $3}')
total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | awk '{print $3}')
fi
charged_slots=$(echo "((($current_charge/$total_charge)*10)/3)+1" | bc -l | cut -d '.' -f 1)
if [[ $charged_slots -gt 3 ]]; then
charged_slots=3
fi
echo -n '#[fg=colour196]'
for i in `seq 1 $charged_slots`; do echo -n "$HEART"; done
if [[ $charged_slots -lt 3 ]]; then
echo -n '#[fg=colour254]'
for i in `seq 1 $(echo "3-$charged_slots" | bc)`; do echo -n "$HEART"; done
fi

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
shell=$(basename "$SHELL") shell=$(basename "$SHELL")
# check if reattach-to-user-namespace is available # check if reattach-to-user-namespace is available

4
bin/tm
View File

@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# abort if we're already inside a TMUX session # abort if we're already inside a TMUX session
[ "$TMUX" == "" ] || exit 0 [ "$TMUX" == "" ] || exit 0
@@ -7,7 +7,7 @@
# present menu for user to choose which workspace to open # present menu for user to choose which workspace to open
PS3="Please choose your session: " PS3="Please choose your session: "
options=($(tmux list-sessions -F "#S" 2>/dev/null) "New Session" "zsh") options=($(tmux list-sessions -F "#S" 2>/dev/null) "New Session")
echo "Available sessions" echo "Available sessions"
echo "------------------" echo "------------------"
echo " " echo " "

View File

@@ -1,544 +0,0 @@
" Section Plugins {{{
call plug#begin('~/.config/nvim/plugged')
" colorschemes
Plug 'chriskempson/base16-vim'
" utilities
Plug 'ctrlpvim/ctrlp.vim' " fuzzy file finder, mapped to <leader>t
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } | Plug 'Xuyuanp/nerdtree-git-plugin' | Plug 'ryanoasis/vim-devicons' " file drawer
Plug 'mileszs/ack.vim' " search inside files using ack. Same as command line ack utility, but use :Ack
Plug 'Raimondi/delimitMate' " automatic closing of quotes, parenthesis, brackets, etc.
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'tpope/vim-unimpaired' " mappings which are simply short normal mode aliases for commonly used ex commands
Plug 'tpope/vim-endwise' " automatically add end in ruby
Plug 'tpope/vim-ragtag' " endings for html, xml, etc. - ehances surround
Plug 'tpope/vim-surround' " mappings to easily delete, change and add such surroundings in pairs, such as quotes, parens, etc.
Plug 'benmills/vimux' " tmux integration for vim
Plug 'vim-airline/vim-airline' " fancy statusline
Plug 'vim-airline/vim-airline-themes' " themes for vim-airline
" Plug 'scrooloose/syntastic' " syntax checking for vim
Plug 'benekastah/neomake' " neovim replacement for syntastic using neovim's job control functonality
Plug 'tpope/vim-fugitive' " amazing git wrapper for vim
Plug 'tpope/vim-repeat' " enables repeating other supported plugins with the . command
Plug 'garbas/vim-snipmate' " snippet manager
Plug 'editorconfig/editorconfig-vim' " .editorconfig support
Plug 'MarcWeber/vim-addon-mw-utils' " interpret a file by function and cache file automatically
Plug 'tomtom/tlib_vim' " utility functions for vim
Plug 'sotte/presenting.vim', { 'for': 'markdown' } " a simple tool for presenting slides in vim based on text files
Plug 'ervandew/supertab' " Perform all your vim insert mode completions with Tab
Plug 'tpope/vim-dispatch' " asynchronous build and test dispatcher
" Plug 'mtth/scratch.vim'
" Plug 'tpope/vim-vinegar'
" Plug 'tpope/vim-abolish'
Plug 'AndrewRadev/splitjoin.vim' " single/multi line code handler: gS - split one line into multiple, gJ - combine multiple lines into one
Plug 'vim-scripts/matchit.zip' " extended % matching
Plug 'tpope/vim-sleuth' " detect indent style (tabs vs. spaces)
Plug 'sickill/vim-pasta' " context-aware pasting
Plug 'junegunn/goyo.vim', { 'on': 'Goyo' } " distraction-free writing
Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } " focus tool. Good for presentating with vim
" language-specific plugins
Plug 'mattn/emmet-vim', { 'for': 'html' } " emmet support for vim - easily create markdup wth CSS-like syntax
Plug 'gregsexton/MatchTag', { 'for': 'html' } " match tags in html, similar to paren support
Plug 'othree/html5.vim', { 'for': 'html' } " html5 support
" Plug 'pangloss/vim-javascript', { 'for': 'javascript' } " JavaScript support
Plug 'gavocanov/vim-js-indent', { 'for': 'javascript' } " JavaScript indent support
Plug 'moll/vim-node', { 'for': 'javascript' } " node support
" Plug 'jelera/vim-javascript-syntax', { 'for': 'javascript' } " JavaScript syntax plugin
Plug 'othree/yajs.vim', { 'for': 'javascript' } " JavaScript syntax plugin
Plug 'mxw/vim-jsx', { 'for': 'jsx' } " JSX support
Plug 'elzr/vim-json', { 'for': 'json' } " JSON support
Plug 'othree/es.next.syntax.vim', { 'for': 'javascript' } " ES6 and beyond syntax
" Plug 'Quramy/tsuquyomi', { 'for': 'typescript', 'do': 'npm install' } " extended typescript support - works as a client for TSServer
Plug 'Shougo/vimproc.vim', { 'do': 'make' } " interactive command execution in vim
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' } " typescript support
" Plug 'clausreinke/typescript-tools.vim', { 'for': 'typescript' } " typescript tools
" Plug 'juvenn/mustache.vim', { 'for': 'mustache' } " mustache support
Plug 'mustache/vim-mustache-handlebars' " mustach support
Plug 'digitaltoad/vim-jade', { 'for': ['jade', 'pug'] } " jade support
Plug 'cakebaker/scss-syntax.vim', { 'for': 'scss' } " sass scss syntax support
Plug 'wavded/vim-stylus', { 'for': ['stylus', 'markdown'] } " markdown support
Plug 'groenewege/vim-less', { 'for': 'less' } " less support
Plug 'ap/vim-css-color', { 'for': ['css','stylus','scss'] } " set the background of hex color values to the color
Plug 'hail2u/vim-css3-syntax', { 'for': 'css' } " CSS3 syntax support
Plug 'itspriddle/vim-marked', { 'for': 'markdown', 'on': 'MarkedOpen' } " Open markdown files in Marked.app - mapped to <leader>m
Plug 'tpope/vim-markdown', { 'for': 'markdown' } " markdown support
Plug 'fatih/vim-go', { 'for': 'go' } " go support
Plug 'timcharper/textile.vim', { 'for': 'textile' } " textile support
Plug 'tclem/vim-arduino' " arduino support - compile wihtout needing to open the arduino IDE
call plug#end()
" }}}
" Section General {{{
" load plugins from vundle
" source ~/.vim/plugins.vim
" Abbreviations
abbr funciton function
abbr teh the
abbr tempalte template
abbr fitler filter
set nocompatible " not compatible with vi
set autoread " detect when a file is changed
" make backspace behave in a sane manner
set backspace=indent,eol,start
" set a map leader for more key combos
let mapleader = ','
let g:mapleader = ','
set history=1000 " change history to 1000
set textwidth=120
" Tab control
set noexpandtab " insert tabs rather than spaces for <Tab>
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop'
set tabstop=4 " the visible width of tabs
set softtabstop=4 " edit as if the tabs are 4 characters wide
set shiftwidth=4 " number of spaces to use for indent and unindent
set shiftround " round indent to a multiple of 'shiftwidth'
set completeopt+=longest
if has('mouse')
set mouse=a
" set ttymouse=xterm2
endif
set clipboard=unnamed
" faster redrawing
set ttyfast
set diffopt+=vertical
" highlight conflicts
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set laststatus=2 " show the satus line all the time
" }}}
" Section AutoGroups {{{
" file type specific settings
augroup configgroup
autocmd!
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType html setlocal ts=4 sts=4 sw=4 noexpandtab indentkeys-=*<return>
autocmd FileType jade setlocal ts=2 sts=2 sw=2 noexpandtab
autocmd FileType *.md.js :call SyntasticReset<cr>
autocmd FileType markdown,textile setlocal textwidth=0 wrapmargin=0 wrap spell
autocmd FileType .xml exe ":silent %!xmllint --format --recover - 2>/dev/null"
autocmd FileType crontab setlocal nobackup nowritebackup
" automatically resize panes on resize
autocmd VimResized * exe 'normal! \<c-w>='
autocmd BufWritePost .vimrc source %
autocmd BufWritePost .vimrc.local source %
" save all files on focus lost, ignoring warnings about untitled buffers
autocmd FocusLost * silent! wa
autocmd BufNewFile,BufRead *.ejs set filetype=html
autocmd BufNewFile,BufRead *.ino set filetype=c
autocmd BufNewFile,BufRead *.svg set filetype=xml
autocmd BufNewFile,BufRead .babelrc set filetype=json
autocmd BufNewFile,BufRead .jshintrc set filetype=json
autocmd BufNewFile,BufRead .eslintrc set filetype=json
autocmd BufNewFile,BufRead *.es6 set filetype=javascript
" make quickfix windows take all the lower section of the screen
" when there are multiple windows open
autocmd FileType qf wincmd J
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
" autocmd! BufEnter * call ApplyLocalSettings(expand('<afile>:p:h'))
autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
autocmd! BufWritePost * Neomake
augroup END
" }}}
" Section User Interface {{{
" code folding settings
set foldmethod=syntax " fold based on indent
set foldnestmax=10 " deepest fold is 10 levels
set nofoldenable " don't fold by default
set foldlevel=1
set so=7 " set 7 lines to the cursors - when moving vertical
set wildmenu " enhanced command line completion
set hidden " current buffer can be put into background
set showcmd " show incomplete commands
set noshowmode " don't show which mode disabled for PowerLine
set wildmode=list:longest " complete files like a shell
set scrolloff=3 " lines of text around cursor
set shell=$SHELL
set cmdheight=1 " command bar height
set title " set terminal title
" Searching
set ignorecase " case insensitive searching
set smartcase " case-sensitive if expresson contains a capital letter
set hlsearch
set incsearch " set incremental search, like modern browsers
set nolazyredraw " don't redraw while executing macros
set magic " Set magic on, for regex
set showmatch " show matching braces
set mat=2 " how many tenths of a second to blink
" error bells
set noerrorbells
set visualbell
set t_vb=
set tm=500
" switch syntax highlighting on
syntax on
set encoding=utf8
let base16colorspace=256 " Access colors present in 256 colorspace"
set t_Co=256 " Explicitly tell vim that the terminal supports 256 colors"
execute "set background=".$BACKGROUND
execute "colorscheme ".$THEME
highlight Comment cterm=italic
highlight htmlArg cterm=italic
set number " show line numbers
" set relativenumber " show relative line numbers
set wrap "turn on line wrapping
set wrapmargin=8 " wrap lines when coming within n characters from side
set linebreak " set soft wrapping
set showbreak=" show ellipsis at breaking
set autoindent " automatically set indent of new line
set smartindent
" }}}
" Section Mappings {{{
" remap esc
inoremap jk <esc>
" markdown to html
nmap <leader>md :%!markdown --html4tags <cr>
" remove extra whitespace
nmap <leader><space> :%s/\s\+$<cr>
" wipout buffer
nmap <silent> <leader>b :bw<cr>
" shortcut to save
nmap <leader>, :w<cr>
" disable Ex mode
noremap Q <NOP>
" set paste toggle
set pastetoggle=<F6>
" toggle paste mode
map <leader>v :set paste!<cr>
" edit ~/.config/nvim/init.vim
map <leader>ev :e! ~/.config/nvim/init.vim<cr>
" edit gitconfig
map <leader>eg :e! ~/.gitconfig<cr>
" clear highlighted search
noremap <space> :set hlsearch! hlsearch?<cr>
" activate spell-checking alternatives
nmap ;s :set invspell spelllang=en<cr>
" toggle invisible characters
set invlist
set listchars=tab:▸\ ,eol,trail:⋅,extends:,precedes:
highlight SpecialKey ctermbg=none " make the highlighting of tabs less annoying
set showbreak=
nmap <leader>l :set list!<cr>
" Textmate style indentation
vmap <leader>[ <gv
vmap <leader>] >gv
nmap <leader>[ <<
nmap <leader>] >>
" switch between current and last buffer
nmap <leader>. <c-^>
" enable . command in visual mode
vnoremap . :normal .<cr>
map <silent> <C-h> :call WinMove('h')<cr>
map <silent> <C-j> :call WinMove('j')<cr>
map <silent> <C-k> :call WinMove('k')<cr>
map <silent> <C-l> :call WinMove('l')<cr>
map <leader>wc :wincmd q<cr>
" toggle cursor line
nnoremap <leader>i :set cursorline!<cr>
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" moving up and down work as you would expect
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
" search for word under the cursor
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
" inoremap <tab> <c-r>=Smart_TabComplete()<CR>
map <leader>r :call RunCustomCommand()<cr>
" map <leader>s :call SetCustomCommand()<cr>
let g:silent_custom_command = 0
" helpers for dealing with other people's code
nmap \t :set ts=4 sts=4 sw=4 noet<cr>
nmap \s :set ts=4 sts=4 sw=4 et<cr>
nmap <leader>w :setf textile<cr> :Goyo<cr>
" }}}
" Section Functions {{{
" Window movement shortcuts
" move to the window in the direction shown, or create a new window
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr())
if (match(a:key,'[jk]'))
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction
" recursively search up from dirname, sourcing all .vimrc.local files along the way
function! ApplyLocalSettings(dirname)
" convert windows paths to unix style
let l:curDir = substitute(a:dirname, '\\', '/', 'g')
" walk to the top of the dir tree
let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, '/'))
if isdirectory(l:parentDir)
call ApplyLocalSettings(l:parentDir)
endif
" now walk back down the path and source .vimsettings as you find them.
" child directories can inherit from their parents
let l:settingsFile = a:dirname . '/.vimrc.local'
if filereadable(l:settingsFile)
exec ':source' . l:settingsFile
endif
endfunction
" smart tab completion
function! Smart_TabComplete()
let line = getline('.') " current line
let substr = strpart(line, -1, col('.')+1) " from the start of the current
" line to one character right
" of the cursor
let substr = matchstr(substr, '[^ \t]*$') " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return '\<tab>'
endif
let has_period = match(substr, '\.') != -1 " position of period, if any
let has_slash = match(substr, '\/') != -1 " position of slash, if any
if (!has_period && !has_slash)
return '\<C-X>\<C-P>' " existing text matching
elseif ( has_slash )
return '\<C-X>\<C-F>' " file matching
else
return '\<C-X>\<C-O>' " plugin matching
endif
endfunction
" execute a custom command
function! RunCustomCommand()
up
if g:silent_custom_command
execute 'silent !' . s:customcommand
else
execute '!' . s:customcommand
endif
endfunction
function! SetCustomCommand()
let s:customcommand = input('Enter Custom Command$ ')
endfunction
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
function! HiInterestingWord(n)
" Save our location.
normal! mz
" Yank the current word into the z register.
normal! "zyiw
" Calculate an arbitrary match ID. Hopefully nothing else is using it.
let mid = 86750 + a:n
" Clear existing matches, but don't worry if they don't exist.
silent! call matchdelete(mid)
" Construct a literal pattern that has to match at boundaries.
let pat = '\V\<' . escape(@z, '\') . '\>'
" Actually match the words.
call matchadd("InterestingWord" . a:n, pat, 1, mid)
" Move back to our original location.
normal! `z
endfunction
nnoremap <silent> <leader>1 :call HiInterestingWord(1)<cr>
nnoremap <silent> <leader>2 :call HiInterestingWord(2)<cr>
nnoremap <silent> <leader>3 :call HiInterestingWord(3)<cr>
nnoremap <silent> <leader>4 :call HiInterestingWord(4)<cr>
nnoremap <silent> <leader>5 :call HiInterestingWord(5)<cr>
nnoremap <silent> <leader>6 :call HiInterestingWord(6)<cr>
hi def InterestingWord1 guifg=#000000 ctermfg=16 guibg=#ffa724 ctermbg=214
hi def InterestingWord2 guifg=#000000 ctermfg=16 guibg=#aeee00 ctermbg=154
hi def InterestingWord3 guifg=#000000 ctermfg=16 guibg=#8cffba ctermbg=121
hi def InterestingWord4 guifg=#000000 ctermfg=16 guibg=#b88853 ctermbg=137
hi def InterestingWord5 guifg=#000000 ctermfg=16 guibg=#ff9eb8 ctermbg=211
hi def InterestingWord6 guifg=#000000 ctermfg=16 guibg=#ff2c4b ctermbg=195
function! HtmlUnEscape()
silent s/&lt;/</eg
silent s/&gt;/>/eg
silent s/&amp;/\&/eg
endfunction
nnoremap <silent> <leader>u :call HtmlUnEscape()<cr>
" }}}
" Section Plugins {{{
" close NERDTree after a file is opened
let g:NERDTreeQuitOnOpen=0
" show hidden files in NERDTree
let NERDTreeShowHidden=1
" remove some files by extension
let NERDTreeIgnore = ['\.js.map$']
" Toggle NERDTree
nmap <silent> <leader>k :NERDTreeToggle<cr>
" expand to the path of the file in the current buffer
nmap <silent> <leader>y :NERDTreeFind<cr>
" map fuzzyfinder (CtrlP) plugin
" nmap <silent> <leader>t :CtrlP<cr>
nmap <silent> <leader>r :CtrlPBuffer<cr>
let g:ctrlp_map='<leader>t'
let g:ctrlp_dotfiles=1
let g:ctrlp_working_path_mode = 'ra'
" Fugitive Shortcuts
nmap <silent> <leader>gs :Gstatus<cr>
nmap <leader>ge :Gedit<cr>
nmap <silent><leader>gr :Gread<cr>
nmap <silent><leader>gb :Gblame<cr>
nmap <leader>m :MarkedOpen!<cr>
nmap <leader>mq :MarkedQuit<cr>
" toggle Limelight
nmap <leader>f :Limelight!!<cr>
let g:neomake_javascript_jshint_maker = {
\ 'args': ['--verbose'],
\ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
\ }
let g:neomake_typescript_tsc_maker = {
\ 'args': ['-m', 'commonjs', '--noEmit' ],
\ 'append_file': 0,
\ 'errorformat':
\ '%E%f %#(%l\,%c): error %m,' .
\ '%E%f %#(%l\,%c): %m,' .
\ '%Eerror %m,' .
\ '%C%\s%\+%m'
\ }
" autocmd FileType javascript let g:neomake_javascript_enabled_makers = findfile('.jshintrc', '.;') != '' ? ['jshint'] : ['eslint']
let g:neomake_javascript_enabled_makers = ['jshint', 'jscs']
" CtrlP ignore patterns
" let g:ctrlp_custom_ignore = {
" \ 'dir': '\.git$\|node_modules$\|bower_components$\|\.hg$\|\.svn$',
" \ 'file': '\.exe$\|\.so$'
" \ }
" only show files that are not ignored by git
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" search the nearest ancestor that contains .git, .hg, .svn
let g:ctrlp_working_path_mode = 2
" airline options
let g:airline_powerline_fonts=1
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_theme='base16'
" don't hide quotes in json files
let g:vim_json_syntax_conceal = 0
let g:SuperTabCrMapping = 0
if (has("gui_running"))
set guioptions=egmrt
set background=light
colorscheme solarized
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_powerline_fonts=0
let g:airline_theme='solarized'
endif
call ApplyLocalSettings(expand('.'))
" }}}
" vim:foldmethod=marker:foldlevel=0

109
config/vim/autogroups.vim Normal file
View File

@@ -0,0 +1,109 @@
" Section AutoGroups {{{
" file type specific settings
augroup configgroup
autocmd!
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType make setlocal ts=8 sts=8 sw=8 noexpandtab
autocmd FileType ruby setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType html setlocal ts=4 sts=4 sw=4 noexpandtab indentkeys-=*<return>
autocmd FileType jade setlocal ts=2 sts=2 sw=2 noexpandtab
autocmd FileType *.md.js :call SyntasticReset<cr>
autocmd FileType markdown,textile setlocal textwidth=0 wrapmargin=0 wrap spell
autocmd FileType .xml exe ":silent %!xmllint --format --recover - 2>/dev/null"
autocmd FileType crontab setlocal nobackup nowritebackup
" automatically resize panes on resize
autocmd VimResized * exe 'normal! \<c-w>='
autocmd BufWritePost .vimrc source %
autocmd BufWritePost .vimrc.local source %
" save all files on focus lost, ignoring warnings about untitled buffers
autocmd FocusLost * silent! wa
autocmd BufNewFile,BufRead *.ejs set filetype=html
autocmd BufNewFile,BufRead *.ino set filetype=c
autocmd BufNewFile,BufRead *.svg set filetype=xml
autocmd BufNewFile,BufRead .babelrc set filetype=json
autocmd BufNewFile,BufRead .jshintrc set filetype=json
autocmd BufNewFile,BufRead .eslintrc set filetype=json
autocmd BufNewFile,BufRead *.es6 set filetype=javascript
" make quickfix windows take all the lower section of the screen
" when there are multiple windows open
autocmd FileType qf wincmd J
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['css', 'javascript', 'js=javascript', 'json=javascript', 'stylus', 'html']
" autocmd! BufEnter * call ApplyLocalSettings(expand('<afile>:p:h'))
autocmd BufNewFile,BufRead,BufWrite *.md syntax match Comment /\%^---\_.\{-}---$/
autocmd! BufWritePost * Neomake
augroup END
" }}}
" Section User Interface {{{
" code folding settings
set foldmethod=syntax " fold based on indent
set foldnestmax=10 " deepest fold is 10 levels
set nofoldenable " don't fold by default
set foldlevel=1
set so=7 " set 7 lines to the cursors - when moving vertical
set wildmenu " enhanced command line completion
set hidden " current buffer can be put into background
set showcmd " show incomplete commands
set noshowmode " don't show which mode disabled for PowerLine
set wildmode=list:longest " complete files like a shell
set scrolloff=3 " lines of text around cursor
set shell=$SHELL
set cmdheight=1 " command bar height
set title " set terminal title
" Searching
set ignorecase " case insensitive searching
set smartcase " case-sensitive if expresson contains a capital letter
set hlsearch
set incsearch " set incremental search, like modern browsers
set nolazyredraw " don't redraw while executing macros
set magic " Set magic on, for regex
set showmatch " show matching braces
set mat=2 " how many tenths of a second to blink
" error bells
set noerrorbells
set visualbell
set t_vb=
set tm=500
" switch syntax highlighting on
syntax on
set encoding=utf8
let base16colorspace=256 " access colors present in 256 colorspace
set t_Co=256 " explicitly tell vim that the terminal supports 256 colors
execute "set background=".$BACKGROUND
execute "colorscheme ".$THEME
highlight Comment cterm=italic
highlight htmlArg cterm=italic
set number " show line numbers
" set relativenumber " show relative line numbers
highlight LineNr term=NONE " don't highlight line numbers
set wrap "turn on line wrapping
set wrapmargin=8 " wrap lines when coming within n characters from side
set linebreak " set soft wrapping
set showbreak=<EFBFBD> " show ellipsis at breaking
set autoindent " automatically set indent of new line
set smartindent
" }}}

View File

@@ -196,6 +196,9 @@ function! plug#end()
filetype off filetype off
for name in g:plugs_order for name in g:plugs_order
if !has_key(g:plugs, name)
continue
endif
let plug = g:plugs[name] let plug = g:plugs[name]
if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for') if get(s:loaded, name, 0) || !has_key(plug, 'on') && !has_key(plug, 'for')
let s:loaded[name] = 1 let s:loaded[name] = 1
@@ -397,7 +400,20 @@ function! s:reorg_rtp()
endfunction endfunction
function! s:doautocmd(...) function! s:doautocmd(...)
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000) if exists('#'.join(a:000, '#'))
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
endif
endfunction
function! s:dobufread(names)
for name in a:names
let path = s:rtp(g:plugs[name]).'/**'
for dir in ['ftdetect', 'ftplugin']
if len(finddir(dir, path))
return s:doautocmd('BufRead')
endif
endfor
endfor
endfunction endfunction
function! plug#load(...) function! plug#load(...)
@@ -415,9 +431,7 @@ function! plug#load(...)
for name in a:000 for name in a:000
call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) call s:lod([name], ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
endfor endfor
if exists('#BufRead') call s:dobufread(a:000)
doautocmd BufRead
endif
return 1 return 1
endfunction endfunction
@@ -453,9 +467,7 @@ function! s:lod(names, types, ...)
endif endif
call s:source(rtp, a:2) call s:source(rtp, a:2)
endif endif
if exists('#User#'.name) call s:doautocmd('User', name)
call s:doautocmd('User', name)
endif
endfor endfor
endfunction endfunction
@@ -463,21 +475,19 @@ function! s:lod_ft(pat, names)
let syn = 'syntax/'.a:pat.'.vim' let syn = 'syntax/'.a:pat.'.vim'
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn) call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
execute 'autocmd! PlugLOD FileType' a:pat execute 'autocmd! PlugLOD FileType' a:pat
if exists('#filetypeplugin#FileType') call s:doautocmd('filetypeplugin', 'FileType')
doautocmd filetypeplugin FileType call s:doautocmd('filetypeindent', 'FileType')
endif
if exists('#filetypeindent#FileType')
doautocmd filetypeindent FileType
endif
endfunction endfunction
function! s:lod_cmd(cmd, bang, l1, l2, args, names) function! s:lod_cmd(cmd, bang, l1, l2, args, names)
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
call s:dobufread(a:names)
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args) execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
endfunction endfunction
function! s:lod_map(map, names, prefix) function! s:lod_map(map, names, prefix)
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin']) call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
call s:dobufread(a:names)
let extra = '' let extra = ''
while 1 while 1
let c = getchar(0) let c = getchar(0)
@@ -486,6 +496,13 @@ function! s:lod_map(map, names, prefix)
endif endif
let extra .= nr2char(c) let extra .= nr2char(c)
endwhile endwhile
if v:count
call feedkeys(v:count, 'n')
endif
call feedkeys('"'.v:register, 'n')
if mode(1) == 'no'
call feedkeys(v:operator)
endif
call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra) call feedkeys(a:prefix . substitute(a:map, '^<Plug>', "\<Plug>", '') . extra)
endfunction endfunction
@@ -779,6 +796,7 @@ function! s:do(pull, force, todo)
else else
let error = 'Invalid hook type' let error = 'Invalid hook type'
endif endif
call s:switch_in()
call setline(4, empty(error) ? (getline(4) . 'OK') call setline(4, empty(error) ? (getline(4) . 'OK')
\ : ('x' . getline(4)[1:] . error)) \ : ('x' . getline(4)[1:] . error))
if !empty(error) if !empty(error)

122
config/vim/functions.vim Normal file
View File

@@ -0,0 +1,122 @@
" Section Functions {{{
" Window movement shortcuts
" move to the window in the direction shown, or create a new window
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
if (t:curwin == winnr())
if (match(a:key,'[jk]'))
wincmd v
else
wincmd s
endif
exec "wincmd ".a:key
endif
endfunction
" recursively search up from dirname, sourcing all .vimrc.local files along the way
function! ApplyLocalSettings(dirname)
" convert windows paths to unix style
let l:curDir = substitute(a:dirname, '\\', '/', 'g')
" walk to the top of the dir tree
let l:parentDir = strpart(l:curDir, 0, strridx(l:curDir, '/'))
if isdirectory(l:parentDir)
call ApplyLocalSettings(l:parentDir)
endif
" now walk back down the path and source .vimsettings as you find them.
" child directories can inherit from their parents
let l:settingsFile = a:dirname . '/.vimrc.local'
if filereadable(l:settingsFile)
exec ':source' . l:settingsFile
endif
endfunction
" smart tab completion
function! Smart_TabComplete()
let line = getline('.') " current line
let substr = strpart(line, -1, col('.')+1) " from the start of the current
" line to one character right
" of the cursor
let substr = matchstr(substr, '[^ \t]*$') " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return '\<tab>'
endif
let has_period = match(substr, '\.') != -1 " position of period, if any
let has_slash = match(substr, '\/') != -1 " position of slash, if any
if (!has_period && !has_slash)
return '\<C-X>\<C-P>' " existing text matching
elseif ( has_slash )
return '\<C-X>\<C-F>' " file matching
else
return '\<C-X>\<C-O>' " plugin matching
endif
endfunction
" execute a custom command
function! RunCustomCommand()
up
if g:silent_custom_command
execute 'silent !' . s:customcommand
else
execute '!' . s:customcommand
endif
endfunction
function! SetCustomCommand()
let s:customcommand = input('Enter Custom Command$ ')
endfunction
function! TrimWhiteSpace()
%s/\s\+$//e
endfunction
function! HiInterestingWord(n)
" Save our location.
normal! mz
" Yank the current word into the z register.
normal! "zyiw
" Calculate an arbitrary match ID. Hopefully nothing else is using it.
let mid = 86750 + a:n
" Clear existing matches, but don't worry if they don't exist.
silent! call matchdelete(mid)
" Construct a literal pattern that has to match at boundaries.
let pat = '\V\<' . escape(@z, '\') . '\>'
" Actually match the words.
call matchadd("InterestingWord" . a:n, pat, 1, mid)
" Move back to our original location.
normal! `z
endfunction
nnoremap <silent> <leader>1 :call HiInterestingWord(1)<cr>
nnoremap <silent> <leader>2 :call HiInterestingWord(2)<cr>
nnoremap <silent> <leader>3 :call HiInterestingWord(3)<cr>
nnoremap <silent> <leader>4 :call HiInterestingWord(4)<cr>
nnoremap <silent> <leader>5 :call HiInterestingWord(5)<cr>
nnoremap <silent> <leader>6 :call HiInterestingWord(6)<cr>
hi def InterestingWord1 guifg=#000000 ctermfg=16 guibg=#ffa724 ctermbg=214
hi def InterestingWord2 guifg=#000000 ctermfg=16 guibg=#aeee00 ctermbg=154
hi def InterestingWord3 guifg=#000000 ctermfg=16 guibg=#8cffba ctermbg=121
hi def InterestingWord4 guifg=#000000 ctermfg=16 guibg=#b88853 ctermbg=137
hi def InterestingWord5 guifg=#000000 ctermfg=16 guibg=#ff9eb8 ctermbg=211
hi def InterestingWord6 guifg=#000000 ctermfg=16 guibg=#ff2c4b ctermbg=195
function! HtmlUnEscape()
silent s/&lt;/</eg
silent s/&gt;/>/eg
silent s/&amp;/\&/eg
endfunction
nnoremap <silent> <leader>u :call HtmlUnEscape()<cr>
" }}}

54
config/vim/general.vim Normal file
View File

@@ -0,0 +1,54 @@
" Section General {{{
" Abbreviations
abbr funciton function
abbr teh the
abbr tempalte template
abbr fitler filter
set shortmess=a
set nocompatible " not compatible with vi
set autoread " detect when a file is changed
" make backspace behave in a sane manner
set backspace=indent,eol,start
" set a map leader for more key combos
let mapleader = ','
let g:mapleader = ','
set history=1000 " change history to 1000
set textwidth=120
" Tab control
set noexpandtab " insert tabs rather than spaces for <Tab>
set smarttab " tab respects 'tabstop', 'shiftwidth', and 'softtabstop'
set tabstop=4 " the visible width of tabs
set softtabstop=4 " edit as if the tabs are 4 characters wide
set shiftwidth=4 " number of spaces to use for indent and unindent
set shiftround " round indent to a multiple of 'shiftwidth'
set completeopt+=longest
if has('mouse')
set mouse=a
" set ttymouse=xterm2
endif
set clipboard=unnamed
" faster redrawing
set ttyfast
set diffopt+=vertical
" highlight conflicts
match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set directory=~/.vim-tmp,~/.tmp,~/tmp,/var/tmp,/tmp
set laststatus=2 " show the satus line all the time
" vim:foldmethod=marker:foldlevel=0
" }}}

6
config/vim/init.vim Normal file
View File

@@ -0,0 +1,6 @@
source ~/.vim/plugins.vim
" source ~/.vim/plugin-settings.vim
" source ~/.vim/general.vim
" source ~/.vim/functions.vim
" source ~/.vim/mappings.vim
" source ~/.vim/autogroups.vim

92
config/vim/mappings.vim Normal file
View File

@@ -0,0 +1,92 @@
" Section Mappings {{{
" remap esc
inoremap jk <esc>
" markdown to html
nmap <leader>md :%!markdown --html4tags <cr>
" remove extra whitespace
nmap <leader><space> :%s/\s\+$<cr>
" wipout buffer
nmap <silent> <leader>b :bw<cr>
" shortcut to save
nmap <leader>, :w<cr>
" disable Ex mode
noremap Q <NOP>
" set paste toggle
set pastetoggle=<F6>
" toggle paste mode
map <leader>v :set paste!<cr>
" edit ~/.config/nvim/init.vim
map <leader>ev :e! ~/.config/nvim/init.vim<cr>
" edit gitconfig
map <leader>eg :e! ~/.gitconfig<cr>
" clear highlighted search
noremap <space> :set hlsearch! hlsearch?<cr>
" activate spell-checking alternatives
nmap ;s :set invspell spelllang=en<cr>
" toggle invisible characters
set invlist
set listchars=tab:?\ ,eol:<3A>,trail:<3A>,extends:?,precedes:?
highlight SpecialKey ctermbg=none " make the highlighting of tabs less annoying
set showbreak=?
nmap <leader>l :set list!<cr>
" Textmate style indentation
vmap <leader>[ <gv
vmap <leader>] >gv
nmap <leader>[ <<
nmap <leader>] >>
" switch between current and last buffer
nmap <leader>. <c-^>
" enable . command in visual mode
vnoremap . :normal .<cr>
map <silent> <C-h> :call WinMove('h')<cr>
map <silent> <C-j> :call WinMove('j')<cr>
map <silent> <C-k> :call WinMove('k')<cr>
map <silent> <C-l> :call WinMove('l')<cr>
map <leader>wc :wincmd q<cr>
" toggle cursor line
nnoremap <leader>i :set cursorline!<cr>
" scroll the viewport faster
nnoremap <C-e> 3<C-e>
nnoremap <C-y> 3<C-y>
" moving up and down work as you would expect
nnoremap <silent> j gj
nnoremap <silent> k gk
nnoremap <silent> ^ g^
nnoremap <silent> $ g$
" search for word under the cursor
nnoremap <leader>/ "fyiw :/<c-r>f<cr>
" inoremap <tab> <c-r>=Smart_TabComplete()<CR>
map <leader>r :call RunCustomCommand()<cr>
" map <leader>s :call SetCustomCommand()<cr>
let g:silent_custom_command = 0
" helpers for dealing with other people's code
nmap \t :set ts=4 sts=4 sw=4 noet<cr>
nmap \s :set ts=4 sts=4 sw=4 et<cr>
nmap <leader>w :setf textile<cr> :Goyo<cr>
" }}}

View File

@@ -0,0 +1,87 @@
" Section Plugins {{{
" close NERDTree after a file is opened
let g:NERDTreeQuitOnOpen=0
" show hidden files in NERDTree
let NERDTreeShowHidden=1
" remove some files by extension
let NERDTreeIgnore = ['\.js.map$']
" Toggle NERDTree
nmap <silent> <leader>k :NERDTreeToggle<cr>
" expand to the path of the file in the current buffer
nmap <silent> <leader>y :NERDTreeFind<cr>
" map fuzzyfinder (CtrlP) plugin
" nmap <silent> <leader>t :CtrlP<cr>
nmap <silent> <leader>r :CtrlPBuffer<cr>
let g:ctrlp_map='<leader>t'
let g:ctrlp_dotfiles=1
let g:ctrlp_working_path_mode = 'ra'
" Fugitive Shortcuts
nmap <silent> <leader>gs :Gstatus<cr>
nmap <leader>ge :Gedit<cr>
nmap <silent><leader>gr :Gread<cr>
nmap <silent><leader>gb :Gblame<cr>
nmap <leader>m :MarkedOpen!<cr>
nmap <leader>mq :MarkedQuit<cr>
" toggle Limelight
nmap <leader>f :Limelight!!<cr>
let g:neomake_javascript_jshint_maker = {
\ 'args': ['--verbose'],
\ 'errorformat': '%A%f: line %l\, col %v\, %m \(%t%*\d\)',
\ }
let g:neomake_typescript_tsc_maker = {
\ 'args': ['-m', 'commonjs', '--noEmit' ],
\ 'append_file': 0,
\ 'errorformat':
\ '%E%f %#(%l\,%c): error %m,' .
\ '%E%f %#(%l\,%c): %m,' .
\ '%Eerror %m,' .
\ '%C%\s%\+%m'
\ }
" autocmd FileType javascript let g:neomake_javascript_enabled_makers = findfile('.jshintrc', '.;') != '' ? ['jshint'] : ['eslint']
let g:neomake_javascript_enabled_makers = ['jshint', 'jscs']
" CtrlP ignore patterns
" let g:ctrlp_custom_ignore = {
" \ 'dir': '\.git$\|node_modules$\|bower_components$\|\.hg$\|\.svn$',
" \ 'file': '\.exe$\|\.so$'
" \ }
" only show files that are not ignored by git
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" search the nearest ancestor that contains .git, .hg, .svn
let g:ctrlp_working_path_mode = 2
" airline options
let g:airline_powerline_fonts=1
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_theme='base16'
" don't hide quotes in json files
let g:vim_json_syntax_conceal = 0
let g:SuperTabCrMapping = 0
if (has("gui_running"))
set guioptions=egmrt
set background=light
colorscheme solarized
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_powerline_fonts=0
let g:airline_theme='solarized'
endif
call ApplyLocalSettings(expand('.'))
" }}}

74
config/vim/plugins.vim Normal file
View File

@@ -0,0 +1,74 @@
" Section Plugins {{{
call plug#begin('~/.vim/plugged')
" colorschemes
Plug 'chriskempson/base16-vim'
" utilities
Plug 'ctrlpvim/ctrlp.vim' " fuzzy file finder, mapped to <leader>t
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } | Plug 'Xuyuanp/nerdtree-git-plugin' | Plug 'ryanoasis/vim-devicons' " file drawer
Plug 'mileszs/ack.vim' " search inside files using ack. Same as command line ack utility, but use :Ack
Plug 'Raimondi/delimitMate' " automatic closing of quotes, parenthesis, brackets, etc.
Plug 'tpope/vim-commentary' " comment stuff out
Plug 'tpope/vim-unimpaired' " mappings which are simply short normal mode aliases for commonly used ex commands
Plug 'tpope/vim-endwise' " automatically add end in ruby
Plug 'tpope/vim-ragtag' " endings for html, xml, etc. - ehances surround
Plug 'tpope/vim-surround' " mappings to easily delete, change and add such surroundings in pairs, such as quotes, parens, etc.
Plug 'benmills/vimux' " tmux integration for vim
Plug 'vim-airline/vim-airline' " fancy statusline
Plug 'vim-airline/vim-airline-themes' " themes for vim-airline
" Plug 'scrooloose/syntastic' " syntax checking for vim
Plug 'benekastah/neomake' " neovim replacement for syntastic using neovim's job control functonality
Plug 'tpope/vim-fugitive' " amazing git wrapper for vim
Plug 'tpope/vim-repeat' " enables repeating other supported plugins with the . command
Plug 'garbas/vim-snipmate' " snippet manager
Plug 'editorconfig/editorconfig-vim' " .editorconfig support
Plug 'MarcWeber/vim-addon-mw-utils' " interpret a file by function and cache file automatically
Plug 'tomtom/tlib_vim' " utility functions for vim
Plug 'sotte/presenting.vim', { 'for': 'markdown' } " a simple tool for presenting slides in vim based on text files
Plug 'ervandew/supertab' " Perform all your vim insert mode completions with Tab
Plug 'tpope/vim-dispatch' " asynchronous build and test dispatcher
" Plug 'mtth/scratch.vim'
" Plug 'tpope/vim-vinegar'
" Plug 'tpope/vim-abolish'
Plug 'AndrewRadev/splitjoin.vim' " single/multi line code handler: gS - split one line into multiple, gJ - combine multiple lines into one
Plug 'vim-scripts/matchit.zip' " extended % matching
Plug 'tpope/vim-sleuth' " detect indent style (tabs vs. spaces)
Plug 'sickill/vim-pasta' " context-aware pasting
Plug 'junegunn/goyo.vim', { 'on': 'Goyo' } " distraction-free writing
Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } " focus tool. Good for presentating with vim
" language-specific plugins
Plug 'mattn/emmet-vim', { 'for': 'html' } " emmet support for vim - easily create markdup wth CSS-like syntax
Plug 'gregsexton/MatchTag', { 'for': 'html' } " match tags in html, similar to paren support
Plug 'othree/html5.vim', { 'for': 'html' } " html5 support
" Plug 'pangloss/vim-javascript', { 'for': 'javascript' } " JavaScript support
Plug 'gavocanov/vim-js-indent', { 'for': 'javascript' } " JavaScript indent support
Plug 'moll/vim-node', { 'for': 'javascript' } " node support
" Plug 'jelera/vim-javascript-syntax', { 'for': 'javascript' } " JavaScript syntax plugin
Plug 'othree/yajs.vim', { 'for': 'javascript' } " JavaScript syntax plugin
Plug 'mxw/vim-jsx', { 'for': 'jsx' } " JSX support
Plug 'elzr/vim-json', { 'for': 'json' } " JSON support
Plug 'othree/es.next.syntax.vim', { 'for': 'javascript' } " ES6 and beyond syntax
" Plug 'Quramy/tsuquyomi', { 'for': 'typescript', 'do': 'npm install' } " extended typescript support - works as a client for TSServer
Plug 'Shougo/vimproc.vim', { 'do': 'make' } " interactive command execution in vim
Plug 'leafgarland/typescript-vim', { 'for': 'typescript' } " typescript support
" Plug 'clausreinke/typescript-tools.vim', { 'for': 'typescript' } " typescript tools
" Plug 'juvenn/mustache.vim', { 'for': 'mustache' } " mustache support
Plug 'mustache/vim-mustache-handlebars' " mustach support
Plug 'digitaltoad/vim-jade', { 'for': ['jade', 'pug'] } " jade support
Plug 'cakebaker/scss-syntax.vim', { 'for': 'scss' } " sass scss syntax support
Plug 'wavded/vim-stylus', { 'for': ['stylus', 'markdown'] } " markdown support
Plug 'groenewege/vim-less', { 'for': 'less' } " less support
Plug 'ap/vim-css-color', { 'for': ['css','stylus','scss'] } " set the background of hex color values to the color
Plug 'hail2u/vim-css3-syntax', { 'for': 'css' } " CSS3 syntax support
Plug 'itspriddle/vim-marked', { 'for': 'markdown', 'on': 'MarkedOpen' } " Open markdown files in Marked.app - mapped to <leader>m
Plug 'tpope/vim-markdown', { 'for': 'markdown' } " markdown support
Plug 'fatih/vim-go', { 'for': 'go' } " go support
Plug 'timcharper/textile.vim', { 'for': 'textile' } " textile support
Plug 'tclem/vim-arduino' " arduino support - compile wihtout needing to open the arduino IDE
call plug#end()
" }}}

View File

@@ -1,9 +1,9 @@
# gitconfig # gitconfig
[user] [user]
name = Nick Nisi name = Rik Veenboer
email = nick@nisi.org email = rik.veenboer@gmail.com
[github] [github]
user = nicknisi user = Boukefalos
[init] [init]
templatedir = ~/.dotfiles/git/templates templatedir = ~/.dotfiles/git/templates
[alias] [alias]
@@ -143,13 +143,6 @@
[grep] [grep]
extendRegexp = true extendRegexp = true
lineNumber = true lineNumber = true
[credential]
helper = osxkeychain
[difftool "Kaleidoscope"]
cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\"
[mergetool "Kaleidoscope"]
cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot
trustexitcode = true
[rebase] [rebase]
instructionFormat = "[%an - %ar] %s" instructionFormat = "[%an - %ar] %s"
[pager] [pager]

View File

@@ -15,9 +15,3 @@ Icon
# project-specific vim configurations # project-specific vim configurations
.vimrc.local .vimrc.local
# typescript command garbage
tscommand*.txt
# nvm - the Node Version Manager
.nvmrc

View File

@@ -1,37 +0,0 @@
#!/bin/sh
# JSCS Pre-Commit
# If a JavaScript file is trying to be committed and it fails style checking
# then fail the commit
EXIT_CODE=0
COLOR_RED="\x1B[31m"
COLOR_YELLOW="\x1B[1;33m"
COLOR_GREEN="\x1B[32m"
COLOR_NONE="\x1B[0m"
if ! jscs > /dev/null 2>&1; then
echo "${COLOR_YELLOW}JSCS is not installed. Exiting.${COLOR_NONE}"
exit 0
fi
repo=$( git rev-parse --show-toplevel )
for file in $( exec git diff-index --cached --name-only HEAD ); do
if [ ${file: -3} == ".js" ]; then
status=$( exec git status --porcelain $file )
if [[ $status != D* ]]; then
jscs ${repo}/${file}
EXIT_CODE=$((${EXIT_CODE} + $?))
fi
fi
done
echo ""
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo "${COLOR_RED}✘ JSCS detected syntax problems.${COLOR_NONE}"
else
echo "${COLOR_GREEN}✔ JSCS detected no errors.${COLOR_NONE}"
fi
exit $((${EXIT_CODE}))

View File

@@ -1,37 +0,0 @@
#!/bin/sh
# JSHint Pre-Commit
# If a JavaScript file is trying to be committed and it fails linting
# then fail the commit
EXIT_CODE=0
COLOR_RED="\x1B[31m"
COLOR_YELLOW="\x1B[1;33m"
COLOR_GREEN="\x1B[32m"
COLOR_NONE="\x1B[0m"
if ! jshint > /dev/null 2>&1; then
echo "${COLOR_YELLOW}JSHint is not installed. Exiting.${COLOR_NONE}"
exit 0
fi
repo=$( git rev-parse --show-toplevel )
for file in $( exec git diff-index --cached --name-only HEAD ); do
if [ ${file: -3} == ".js" ]; then
status=$( exec git status --porcelain $file )
if [[ $status != D* ]]; then
jshint ${repo}/${file}
EXIT_CODE=$((${EXIT_CODE} + $?))
fi
fi
done
echo ""
if [[ ${EXIT_CODE} -ne 0 ]]; then
echo "${COLOR_RED}✘ JSHINT detected syntax problems.${COLOR_NONE}"
else
echo "${COLOR_GREEN}✔ JSHINT detected no errors.${COLOR_NONE}"
fi
exit $((${EXIT_CODE}))

View File

@@ -5,29 +5,17 @@ echo "Installing dotfiles"
echo "Initializing submodule(s)" echo "Initializing submodule(s)"
git submodule update --init --recursive git submodule update --init --recursive
source install/link.sh if apropos "package manager" | grep -q apt; then
echo -e "\n\nUsing APT package manager"
if [ "$(uname)" == "Darwin" ]; then source install/apt.sh
echo -e "\n\nRunning on OSX"
source install/brew.sh
source install/osx.sh
source install/nvm.sh
# create a backup of the original nginx.conf
mv /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx.original
ln -s ~/.dotfiles/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf
# symlink the code.dev from dotfiles
ln -s ~/.dotfiles/nginx/code.dev /usr/local/etc/nginx/sites-enabled/code.dev
fi fi
echo "creating vim directories" source install/terminfo.sh
mkdir -p ~/.vim-tmp source install/ruby.sh
source install/link.sh
# echo "Configuring zsh as default shell"
echo "Configuring zsh as default shell" # chsh -s $(which zsh)
chsh -s $(which zsh)
echo "Done." echo "Done."

15
install/apt.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/bin/sh
echo -e "\n\nInstalling APT packages..."
echo "=============================="
# cli tools
apt-get install tree
apt-get install wget
apt-get install curl
# development tools
apt-get install git
apt-get install tmux
apt-get install zsh
apt-get install ruby

View File

@@ -1,12 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
# Backup files that are provided by the dotfiles into a ~/dotfiles-backup directory # Backup files that are provided by the dotfiles into a ~/dotfiles-backup directory
DOTFILES=$HOME/.dotfiles DOTFILES=$HOME/.dotfiles
BACKUP_DIR=$HOME/dotfiles-backup BACKUP_DIR=$HOME/dotfiles-backup
set -e # TODO: what does this do?
echo "Creating backup directory at $BACKUP_DIR" echo "Creating backup directory at $BACKUP_DIR"
mkdir -p $BACKUP_DIR mkdir -p $BACKUP_DIR
@@ -21,7 +20,7 @@ for file in $linkables; do
fi fi
done done
typeset -a files=($HOME/.config/nvim $HOME/.vim $HOME/.vimrc) typeset -a files=($HOME/.vim $HOME/.vimrc)
for file in $files; do for file in $files; do
if [ -e $file ]; then if [ -e $file ]; then
cp -rf $file $BACKUP_DIR cp -rf $file $BACKUP_DIR

View File

@@ -1,36 +0,0 @@
#!/bin/sh
if test ! $(which brew); then
echo "Installing homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
echo -e "\n\nInstalling homebrew packages..."
echo "=============================="
# cli tools
brew install ack
brew install tree
brew install wget
# development server setup
brew install nginx
brew install dnsmasq
# development tools
brew install git
brew install hub
brew install macvim --override-system-vim
brew install reattach-to-user-namespace
brew install tmux
brew install zsh
brew install highlight
brew install nvm
brew install z
brew install markdown
brew install diff-so-fancy
# install neovim
brew install neovim/neovim/neovim
exit 0

View File

@@ -32,25 +32,28 @@ for config in $DOTFILES/config/*; do
fi fi
done done
# create vim symlinks
# As I have moved off of vim as my full time editor in favor of neovim,
# I feel it doesn't make sense to leave my vimrc intact in the dotfiles repo
# as it is not really being actively maintained. However, I would still
# like to configure vim, so lets symlink ~/.vimrc and ~/.vim over to their
# neovim equivalent.
echo -e "\n\nCreating vim symlinks" echo -e "\n\nCreating vim symlinks"
echo "==============================" echo "=============================="
typeset -A vimfiles typeset -A vimfiles
vimfiles[~/.vim]=$DOTFILES/config/nvim vimfiles[~/.vim]=$DOTFILES/config/vim
vimfiles[~/.vimrc]=$DOTFILES/config/nvim/init.vim vimfiles[~/.vimrc]=$DOTFILES/config/vim/init.vim
for file in "${!vimfiles[@]}"; do for file in "${!vimfiles[@]}"; do
if [ -e ${file} ]; then if [ -e ${file} ]; then
echo "${file} already exists... skipping" echo "${file} already exists... skipping"
else else
echo "Creating symlink for $file" echo "Creating symlink for $file"
ln -s $vimfiles[$file] $file ln -s ${vimfiles[$file]} $file
fi fi
done done
echo -e "\n\nCreating tmux symlinks"
echo "=============================="
file=~/.tmux/
if [ -e ${file}/plugins ]; then
echo "${file}/plugins already exists... skipping"
else
mkdir -p ~/.tmux/
echo "Creating symlink for $file/plugins"
ln -s $DOTFILES/tmux/plugins $file
fi

View File

@@ -1,42 +0,0 @@
#!/bin/bash
echo -e "\n\nInstalling nginx"
echo "=============================="
######################################################
# nginx setup
######################################################
$DOTFILES=$HOME/.dotfiles
# first, make sure apache is off
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
# run nginx when osx starts
sudo cp /usr/local/opt/nginx/homebrew.mxcl.nginx.plist /Library/LaunchDaemons
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
mkdir -p /usr/local/etc/nginx/sites-enabled
cp -R nginx/sites-available /usr/local/etc/nginx/sites-available
mv /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf.orig
ln -s $DOTFILES/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf
sites=$( ls -1 -d $DOTFILES/nginx/sites-available)
for site in $sites ; do
echo "linking $site"
ln -s $DOTFILES/nginx/sites-available/$site /usr/local/etc/nginx/sites-enabled/$site
done
######################################################
# dnsmasq setup
######################################################
echo "installing dnsmasq"
# move dnsmasq config into place
ln -s $DOTFILES/nginx/dnsmasq.conf /usr/local/etc/
# setup dnsmasq
sudo cp -fv /usr/local/opt/dnsmasq/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq

View File

@@ -1,10 +0,0 @@
#!/bin/sh
echo -e "\n\nInstalling Node (from nvm)"
echo "=============================="
# reload nvm into this environment
source $(brew --prefix nvm)/nvm.sh
nvm install stable
nvm alias default stable

View File

@@ -1,210 +0,0 @@
#!/usr/bin/env sh
echo -e "\n\nSetting OS X settings"
echo "=============================="
# echo "Finder: show all filename extensions"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# echo "show hidden files by default"
defaults write com.apple.Finder AppleShowAllFiles -bool false
# echo "only use UTF-8 in Terminal.app"
defaults write com.apple.terminal StringEncodings -array 4
# echo "expand save dialog by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# echo "show the ~/Library folder in Finder"
chflags nohidden ~/Library
# echo "disable resume system wide"
# defaults write NSGlobalDomainNSQuitAlwaysKeepWindows -bool false
echo "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
echo "Enable subpixel font rendering on non-Apple LCDs"
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# echo "Enable the 2D Dock"
# defaults write com.apple.dock no-glass -bool true
# Automatically hide and show the Dock
# defaults write com.apple.dock autohide -bool true
# echo "Make Dock icons of hidden applications translucent"
# defaults write com.apple.dock showhidden -bool true
#echo "Enable iTunes track notifications in the Dock"
#defaults write com.apple.dock itunes-notifications -bool true
# Disable menu bar transparency
#defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Show remaining battery time; hide percentage
# defaults write com.apple.menuextra.battery ShowPercent -string "NO"
# defaults write com.apple.menuextra.battery ShowTime -string "YES"
# echo "Always show scrollbars"
# defaults write NSGlobalDomain AppleShowScrollBars -string "Auto"
#echo "Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons"
#defaults write com.apple.finder QuitMenuItem -bool true
# Disable window animations and Get Info animations in Finder
# defaults write com.apple.finder DisableAllAnimations -bool true
echo "Use current directory as default search scope in Finder"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
echo "Show Path bar in Finder"
defaults write com.apple.finder ShowPathbar -bool true
echo "Show Status bar in Finder"
defaults write com.apple.finder ShowStatusBar -bool true
# echo "Expand print panel by default"
# defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
#echo "Disable the “Are you sure you want to open this application?” dialog"
#defaults write com.apple.LaunchServices LSQuarantine -bool false
#echo "Disable shadow in screenshots"
#defaults write com.apple.screencapture disable-shadow -bool true
# echo "Enable highlight hover effect for the grid view of a stack (Dock)"
# defaults write com.apple.dock mouse-over-hilte-stack -bool true
# echo "Enable spring loading for all Dock items"
# defaults write enable-spring-load-actions-on-all-items -bool true
# echo "Show indicator lights for open applications in the Dock"
# defaults write com.apple.dock show-process-indicators -bool true
# Dont animate opening applications from the Dock
# defaults write com.apple.dock launchanim -bool false
#echo "Display ASCII control characters using caret notation in standard text views"
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt`
#defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
echo "Disable press-and-hold for keys in favor of key repeat"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
echo "Set a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 2
echo "Set a shorter Delay until key repeat"
defaults write NSGlobalDomain InitialKeyRepeat -int 15
#echo "Disable auto-correct"
#defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Disable opening and closing window animations
# defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
# echo "Disable disk image verification"
# defaults write com.apple.frameworks.diskimages skip-verify -bool true
# defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
# defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
# echo "Automatically open a new Finder window when a volume is mounted"
# defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
# defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
# defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# echo "Display full POSIX path as Finder window title"
# defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Increase window resize speed for Cocoa applications
# defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# echo "Avoid creating .DS_Store files on network volumes"
# defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# echo "Disable the warning when changing a file extension"
# defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# echo "Show item info below desktop icons"
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
# echo "Enable snap-to-grid for desktop icons"
# /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# echo "Disable the warning before emptying the Trash"
# defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Empty Trash securely by default
# defaults write com.apple.finder EmptyTrashSecurely -bool true
#echo "Require password immediately after sleep or screen saver begins"
#defaults write com.apple.screensaver askForPassword -int 1
#defaults write com.apple.screensaver askForPasswordDelay -int 0
echo "Enable tap to click (Trackpad)"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
#echo "Map bottom right Trackpad corner to right-click"
#defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
#defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
# echo "Disable Safaris thumbnail cache for History and Top Sites"
# defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
echo "Enable Safaris debug menu"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# echo "Make Safaris search banners default to Contains instead of Starts With"
# defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# Remove useless icons from Safaris bookmarks bar
# defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# echo "Add a context menu item for showing the Web Inspector in web views"
# defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
#echo "Only use UTF-8 in Terminal.app"
#defaults write com.apple.terminal StringEncodings -array 4
# echo "Disable the Ping sidebar in iTunes"
# defaults write com.apple.iTunes disablePingSidebar -bool true
# echo "Disable all the other Ping stuff in iTunes"
# defaults write com.apple.iTunes disablePing -bool true
# echo "Make ⌘ + F focus the search input in iTunes"
# defaults write com.apple.iTunes NSUserKeyEquivalents -dict-add "Target Search Field" "@F"
# Disable send and reply animations in Mail.app
# defaults write com.apple.Mail DisableReplyAnimations -bool true
# defaults write com.apple.Mail DisableSendAnimations -bool true
# Disable Resume system-wide
# defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
# echo "Disable the “reopen windows when logging back in” option"
# This works, although the checkbox will still appear to be checked.
# defaults write com.apple.loginwindow TALLogoutSavesState -bool false
# defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false
# echo "Enable Dashboard dev mode (allows keeping widgets on the desktop)"
# defaults write com.apple.dashboard devmode -bool true
#echo "Reset Launchpad"
#[ -e ~/Library/Application\ Support/Dock/*.db ] && rm ~/Library/Application\ Support/Dock/*.db
# echo "Disable local Time Machine backups"
# hash tmutil &> /dev/null && sudo tmutil disablelocal
#echo "Remove Dropboxs green checkmark icons in Finder"
#file=/Applications/Dropbox.app/Contents/Resources/check.icns
#[ -e "$file" ] && mv -f "$file" "$file.bak"
#unset file
#Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo)
# Commented out, as this is known to cause problems when saving files in Adobe Illustrator CS5 :(
#echo "0x08000100:0" > ~/.CFUserTextEncoding
echo "Kill affected applications"
for app in Safari Finder Dock Mail SystemUIServer; do killall "$app" >/dev/null 2>&1; done

7
install/ruby.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
DOTFILES=$HOME/.dotfiles
echo -e "\nRuby gems"
echo "=============================="
gem install tmuxinator

3
install/terminfo.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
tic resources/xterm-256color-italic.terminfo
tic resources/tmux-256color-italic.terminfo

View File

@@ -1,68 +0,0 @@
{
"requireCurlyBraces": [
"if", "else", "for", "while", "do", "try",
"catch"
],
"requireSpaceAfterKeywords": [
"if", "else", "for", "while", "do", "switch",
"return", "try", "catch"
],
"requireSpaceBeforeBlockStatements": true,
"requireParenthesesAroundIIFE": true,
"requireSpacesInConditionalExpression": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowMultipleVarDecl": true,
"requireBlocksOnNewline": true,
"disallowEmptyBlocks": true,
"requireSpacesInsideObjectBrackets": "allButNested",
"requireSpacesInsideArrayBrackets": "allButNested",
"disallowQuotedKeysInObjects": "allButReserved",
"disallowSpaceAfterObjectKeys": true,
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceAfterBinaryOperators": true,
"disallowImplicitTypeConversion": [
"binary"
],
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowKeywords": [
"with"
],
"disallowMultipleLineStrings": true,
"disallowMultipleLineBreaks": true,
"validateQuoteMarks": {
"mark": "'",
"escape": true
},
"validateIndentation": "\t",
"disallowMixedSpacesAndTabs": "smart",
"disallowTrailingWhitespace": true,
"disallowTrailingComma": true,
"requireKeywordsOnNewLine": [
"else"
],
"requireLineFeedAtFileEnd": true,
"maximumLineLength": 120,
"requireCapitalizedConstructors": true,
"requireDotNotation": true,
"disallowYodaConditions": true,
"requireSpaceAfterLineComment": true
}

View File

@@ -1,68 +0,0 @@
{
"asi": false,
"bitwise": false,
"boss": false,
"browser": true,
"camelcase": true,
"couch": false,
"curly": true,
"debug": false,
"devel": true,
"dojo": false,
"eqeqeq": true,
"eqnull": true,
"esversion": 6,
"evil": false,
"expr": true,
"forin": false,
"funcscope": true,
"globalstrict": false,
"immed": true,
"iterator": false,
"jquery": false,
"lastsemic": false,
"latedef": false,
"laxbreak": true,
"laxcomma": false,
"loopfunc": true,
"mootools": false,
"multistr": false,
"newcap": true,
"noarg": true,
"node": false,
"noempty": false,
"nonew": true,
"nonstandard": false,
"nomen": false,
"onecase": false,
"onevar": false,
"passfail": false,
"plusplus": false,
"proto": false,
"prototypejs": false,
"regexdash": true,
"regexp": false,
"rhino": false,
"undef": true,
"unused": true,
"scripturl": true,
"shadow": false,
"smarttabs": true,
"strict": false,
"sub": false,
"supernew": false,
"trailing": true,
"validthis": true,
"withstmt": false,
"white": true,
"worker": false,
"wsh": false,
"yui": false,
"indent": 4,
"globals": {
"require": true,
"define": true
},
"quotmark": true,
"maxcomplexity": 10
}

View File

@@ -1 +0,0 @@
address=/.dev/127.0.0.1

View File

@@ -1,121 +0,0 @@
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
include sites-enabled/*.dev;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name 10.0.1.9 localhost code.dev rugen.local;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /Users/nicknisi/code;
index index.html index.php;
include /usr/local/etc/nginx/conf.d/php-fpm;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}

View File

@@ -1,34 +0,0 @@
server {
listen 80;
server_name app localhost .dev;
# the location of our projects directory
set $basepath "/Users/nicknisi/code";
set $domain $host;
if ($domain ~ "^(.*)\.dev$") {
set $domain $1;
}
set $rootpath "${domain}";
if (-d $basepath/$domain/public) {
set $rootpath "${domain}/public";
}
if (-f $basepath/$domain/index.html) {
set $rootpath $domain;
}
root $basepath/$rootpath;
location / {
# enable index view of the directory
autoindex on;
# a 405 is thrown when posting to a static file. this corrects it
error_page 405 = $uri;
}
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}

View File

@@ -1,8 +0,0 @@
source-file ~/.tmux.conf
new-session -s dev -n ide
split-window -v -p 10 -t dev
select-pane -t 1
split-window -h -p 30 -t dev
new-window -n shell
select-window -t dev:1
select-pane -t 1

View File

@@ -18,7 +18,6 @@ set -g status-left-length 32
set -g status-right-length 150 set -g status-right-length 150
set -g status-interval 5 set -g status-interval 5
# default statusbar colors # default statusbar colors
# set-option -g status-bg colour0 # set-option -g status-bg colour0
set-option -g status-fg $tm_color_active set-option -g status-fg $tm_color_active
@@ -45,14 +44,9 @@ set-option -g message-fg $tm_color_active
set-option -g display-panes-active-colour $tm_color_active set-option -g display-panes-active-colour $tm_color_active
set-option -g display-panes-colour $tm_color_inactive set-option -g display-panes-colour $tm_color_inactive
tm_spotify="#[fg=$tm_color_background,bg=$tm_color_music]#(osascript ~/.dotfiles/applescripts/spotify.scpt)"
tm_itunes="#[fg=$tm_color_music,bg=$tm_color_background]$tm_right_separator_black#[fg=$tm_color_background,bg=$tm_color_music]#(osascript ~/.dotfiles/applescripts/itunes.scpt)"
tm_rdio="#[fg=$tm_color_background,bg=$tm_color_music]#(osascript ~/.dotfiles/applescripts/rdio.scpt)"
tm_battery="#[fg=colour255,bg=$tm_color_music]$tm_right_separator_black#[bg=colour255]#(~/.dotfiles/bin/battery_indicator.sh)"
tm_date="#[bg=colour255,fg=$tm_color_inactive]$tm_right_separator_black#[bg=$tm_color_inactive,fg=$tm_color_background] %R %d %b" tm_date="#[bg=colour255,fg=$tm_color_inactive]$tm_right_separator_black#[bg=$tm_color_inactive,fg=$tm_color_background] %R %d %b"
tm_host="#[bg=$tm_color_inactive,fg=$tm_color_feature]$tm_right_separator_black#[bg=$tm_color_feature,fg=$tm_color_background,bold] #h " tm_host="#[bg=$tm_color_inactive,fg=$tm_color_feature]$tm_right_separator_black#[bg=$tm_color_feature,fg=$tm_color_background,bold] #h "
tm_session_name="#[bg=$tm_color_feature,fg=$tm_color_background,bold]$tm_icon #S #[fg=$tm_color_feature,bg=default,nobold]$tm_left_separator_black" tm_session_name="#[bg=$tm_color_feature,fg=$tm_color_background,bold]$tm_icon #S #[fg=$tm_color_feature,bg=default,nobold]$tm_left_separator_black"
set -g status-left $tm_session_name set -g status-left $tm_session_name
set -g status-right $tm_itunes' '$tm_rdio' '$tm_battery' '$tm_date' '$tm_host set -g status-right $tm_date' '$tm_host

1
tmux/plugins/tpm Submodule

Submodule tmux/plugins/tpm added at 51ff07a729

View File

@@ -17,7 +17,6 @@ set -g status-left-length 32
set -g status-right-length 150 set -g status-right-length 150
set -g status-interval 5 set -g status-interval 5
# default statusbar colors # default statusbar colors
# set-option -g status-bg colour0 # set-option -g status-bg colour0
set-option -g status-fg $tm_color_active set-option -g status-fg $tm_color_active
@@ -49,12 +48,9 @@ set-option -g display-panes-colour $tm_color_inactive
# clock # clock
set-window-option -g clock-mode-colour $tm_color_active set-window-option -g clock-mode-colour $tm_color_active
tm_tunes="#[fg=$tm_color_music]#(osascript ~/.dotfiles/applescripts/tunes.scpt)"
tm_battery="#(~/.dotfiles/bin/battery_indicator.sh)"
tm_date="#[fg=$tm_color_inactive] %R %d %b" tm_date="#[fg=$tm_color_inactive] %R %d %b"
tm_host="#[fg=$tm_color_feature,bold]#h" tm_host="#[fg=$tm_color_feature,bold]#h"
tm_session_name="#[fg=$tm_color_feature,bold]$tm_icon #S" tm_session_name="#[fg=$tm_color_feature,bold]$tm_icon #S"
set -g status-left $tm_session_name' ' set -g status-left $tm_session_name' '
set -g status-right $tm_tunes' '$tm_date' '$tm_host set -g status-right $tm_date' '$tm_host

View File

@@ -1,4 +1,3 @@
set -g default-command "login-shell"
# tmux display things in 256 colors # tmux display things in 256 colors
set -g default-terminal "tmux-256color-italic" set -g default-terminal "tmux-256color-italic"
set -g status-utf8 on set -g status-utf8 on
@@ -33,9 +32,9 @@ unbind =
bind = select-layout tiled bind = select-layout tiled
# cycle through panes # cycle through panes
# unbind C-a unbind C-a
# unbind o # this is the default key for cycling panes unbind o # this is the default key for cycling panes
# bind ^A select-pane -t:.+ bind ^A select-pane -t:.+
# make window/pane index start with 1 # make window/pane index start with 1
set -g base-index 1 set -g base-index 1
@@ -77,19 +76,6 @@ bind -r J resize-pane -D 10
bind -r K resize-pane -U 10 bind -r K resize-pane -U 10
bind -r L resize-pane -R 10 bind -r L resize-pane -R 10
# enable mouse support for switching panes/windows
setw -g mouse on
# set-option -g -q mouse on
bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e; send-keys PPage"
bind-key -t vi-copy PPage page-up
bind-key -t vi-copy NPage page-down
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "select-pane -t =; send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "select-pane -t =; send-keys -M" "select-pane -t =; send-keys -M"
bind-key -t vi-copy WheelUpPane halfpage-up
bind-key -t vi-copy WheelDownPane halfpage-down
# maximizing and restoring windows # maximizing and restoring windows
unbind Up unbind Up
bind Up new-window -d -n fullscreen \; swap-pane -s fullscreen.1 \; select-window -t fullscreen bind Up new-window -d -n fullscreen \; swap-pane -s fullscreen.1 \; select-window -t fullscreen
@@ -101,17 +87,32 @@ setw -g mode-keys vi
# more settings to make copy-mode more vim-like # more settings to make copy-mode more vim-like
unbind [ unbind [
bind Escape copy-mode bind Escape copy-mode
unbind p # unbind p
bind p paste-buffer # bind p paste-buffer
bind p previous-window
bind -t vi-copy 'v' begin-selection bind -t vi-copy 'v' begin-selection
bind -t vi-copy 'y' copy-selection bind -t vi-copy 'y' copy-selection
# Buffers to/from Mac clipboard, yay tmux book from pragprog
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
############################## ##############################
### Color & Style Settings ### ### Color & Style Settings ###
############################## ##############################
source ~/.dotfiles/tmux/theme.sh source ~/.dotfiles/tmux/theme.sh
###############
### Plugins ###
###############
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'Morantron/tmux-fingers'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

View File

@@ -8,8 +8,6 @@ else # OS X `ls`
colorflag="-G" colorflag="-G"
fi fi
alias vim="nvim"
# Filesystem aliases # Filesystem aliases
alias ..='cd ..' alias ..='cd ..'
alias ...='cd ../..' alias ...='cd ../..'
@@ -27,9 +25,6 @@ alias grep='grep --color=auto'
alias df='df -h' # disk free, in Gigabytes, not bytes alias df='df -h' # disk free, in Gigabytes, not bytes
alias du='du -h -c' # calculate disk usage for a folder alias du='du -h -c' # calculate disk usage for a folder
# Applications
alias ios='open -a /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app'
# IP addresses # IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en1" alias localip="ipconfig getifaddr en1"
@@ -65,14 +60,3 @@ alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && k
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "$method"="lwp-request -m '$method'" alias "$method"="lwp-request -m '$method'"
done done
# Stuff I never really use but cannot delete either because of http://xkcd.com/530/
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume 10'"
# Kill all the tabs in Chrome to free up memory
# [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description
alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill"
alias chrome="/Applications/Google\\ \\Chrome.app/Contents/MacOS/Google\\ \\Chrome"
alias canary="/Applications/Google\\ Chrome\\ Canary.app/Contents/MacOS/Google\\ Chrome\\ Canary"

View File

@@ -30,5 +30,9 @@ bindkey '^[[3~' delete-char
bindkey '^[^N' newtab bindkey '^[^N' newtab
bindkey '^?' backward-delete-char bindkey '^?' backward-delete-char
# remap reverse search
bindkey -v
bindkey '^R' history-incremental-search-backward
fpath=($ZSH/functions $fpath) fpath=($ZSH/functions $fpath)
autoload -U $ZSH/functions/*(:t) autoload -U $ZSH/functions/*(:t)

View File

@@ -39,6 +39,11 @@ function ng-restart() {
sudo launchctl start homebrew.mxcl.nginx sudo launchctl start homebrew.mxcl.nginx
} }
function dns-restart() {
sudo launchctl stop homebrew.mxcl.dnsmasq
sudo launchctl start homebrew.mxcl.dnsmasq
}
# Start an HTTP server from a directory, optionally specifying the port # Start an HTTP server from a directory, optionally specifying the port
function server() { function server() {

View File

@@ -1,2 +0,0 @@
#compdef c
_files -W $CODE_DIR -/

View File

@@ -1 +0,0 @@
cd $CODE_DIR/$1

View File

@@ -48,7 +48,6 @@ git_arrows() {
echo $arrows echo $arrows
} }
# indicate a job (for example, vim) has been backgrounded # indicate a job (for example, vim) has been backgrounded
# If there is a job in the background, display a ✱ # If there is a job in the background, display a ✱
suspended_jobs() { suspended_jobs() {
@@ -63,8 +62,8 @@ suspended_jobs() {
precmd() { precmd() {
vcs_info vcs_info
print -P '\n%F{205}%~' print -P '\n%F{145}%~'
} }
export PROMPT='%(?.%F{205}.%F{red})%f ' export PROMPT='%(?.%F{145}.%F{red})%f '
export RPROMPT='`git_dirty`%F{241}$vcs_info_msg_0_%f `git_arrows``suspended_jobs`' export RPROMPT='`git_dirty`%F{241}$vcs_info_msg_0_%f `git_arrows``suspended_jobs`'

0
zsh/spectrum.zsh Normal file → Executable file
View File

View File

@@ -13,7 +13,7 @@ if [[ -d ~/code ]]; then
fi fi
# source all .zsh files inside of the zsh/ directory # source all .zsh files inside of the zsh/ directory
for config ($ZSH/**/*.zsh) source $config for config ($ZSH/*.zsh) source $config
if [[ -a ~/.localrc ]]; then if [[ -a ~/.localrc ]]; then
source ~/.localrc source ~/.localrc