Aliases and vim-dart

This commit is contained in:
Michael Campagnaro 2014-02-17 02:00:21 -05:00
parent 6b4fdbacbb
commit 1a83c05214
5 changed files with 153 additions and 40 deletions

1
vim/ftdetect/dart.vim Normal file
View File

@ -0,0 +1 @@
au BufRead,BufNewFile *.dart set filetype=dart

120
vim/syntax/dart.vim Normal file
View File

@ -0,0 +1,120 @@
" Vim syntax file " Language: Dart
" Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
" for details. All rights reserved. Use of this source code is governed by a
" BSD-style license that can be found in the LICENSE file.
" Quit when a syntax file was already loaded
if !exists("main_syntax")
if version < 600
syntax clear
elseif exists("b:current_syntax")
finish
endif
" we define it here so that included files can test for it
let main_syntax='dart'
syn region dartFold start="{" end="}" transparent fold
endif
" Ensure long multiline strings are highlighted.
syn sync fromstart
" keyword definitions
syn keyword dartConditional if else switch
syn keyword dartRepeat do while for
syn keyword dartBoolean true false
syn keyword dartConstant null
syn keyword dartTypedef this super class typedef
syn keyword dartOperator new is as in factory
syn match dartOperator "+=\=\|-=\=\|*=\=\|/=\=\|%=\=\|\~/=\=\|<<=\=\|>>=\=\|[<>]=\=\|===\=\|\!==\=\|&=\=\|\^=\=\||=\=\|||\|&&\|\[\]=\=\|=>\|!\|\~\|?\|:"
syn keyword dartType void var bool int double num dynamic
syn keyword dartStatement return
syn keyword dartStorageClass static abstract final const
syn keyword dartExceptions throw rethrow try on catch finally
syn keyword dartAssert assert
syn keyword dartClassDecl extends with implements
syn keyword dartBranch break continue nextgroup=dartUserLabelRef skipwhite
syn keyword dartKeyword get set operator call external
syn match dartUserLabelRef "\k\+" contained
syn region dartLabelRegion transparent matchgroup=dartLabel start="\<case\>" matchgroup=NONE end=":"
syn keyword dartLabel default
syn match dartLibrary "^\(import\|part of\|part\|export\|library\|show\|hide\)\s"
" Comments
syn keyword dartTodo contained TODO FIXME XXX
syn region dartComment start="/\*" end="\*/" contains=dartTodo,dartDocLink,@Spell
syn match dartLineComment "//.*" contains=dartTodo,@Spell
syn match dartLineDocComment "///.*" contains=dartTodo,dartDocLink,@Spell
syn region dartDocLink contained start=+\[+ end=+\]+
" Strings
syn region dartString start=+\z(["']\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
syn region dartRawString start=+r\z(["']\)+ end=+\z1+ contains=@Spell
syn region dartMultilineString start=+\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell,dartInterpolation,dartSpecialChar
syn region dartRawMultilineString start=+r\z("\{3\}\|'\{3\}\)+ end=+\z1+ contains=@Spell
syn match dartInterpolation contained "\$\(\w\+\|{[^}]\+}\)"
syn match dartSpecialChar contained "\\\(u\x\{4\}\|u{\x\+}\|x\x\x\|x{\x\+}\|.\)"
" Numbers
syn match dartNumber "\<\d\+\(\.\d\+\)\=\>"
" TODO(antonm): consider conditional highlighting of corelib classes.
syn keyword dartCoreClasses BidirectionalIterator Comparable DateTime Duration Expando Function Invocation Iterable Iterator List Map Match Object Pattern RegExp RuneIterator Runes Set StackTrace Stopwatch String StringBuffer StringSink Symbol Type
syn keyword dartCoreTypedefs Comparator
syn keyword dartCoreExceptions AbstractClassInstantiationError ArgumentError AssertionError CastError ConcurrentModificationError Error Exception FallThroughError FormatException IntegerDivisionByZeroException NoSuchMethodError NullThrownError OutOfMemoryError RangeError RuntimeError StackOverflowError StateError TypeError UnimplementedError UnsupportedError
" The default highlighting.
command! -nargs=+ HiLink hi def link <args>
HiLink dartBranch Conditional
HiLink dartUserLabelRef dartUserLabel
HiLink dartLabel Label
HiLink dartUserLabel Label
HiLink dartConditional Conditional
HiLink dartRepeat Repeat
HiLink dartExceptions Exception
HiLink dartAssert Statement
HiLink dartStorageClass StorageClass
HiLink dartClassDecl dartStorageClass
HiLink dartBoolean Boolean
HiLink dartString String
HiLink dartRawString String
HiLink dartMultilineString String
HiLink dartRawMultilineString String
HiLink dartNumber Number
HiLink dartStatement Statement
HiLink dartOperator Operator
HiLink dartComment Comment
HiLink dartLineComment Comment
HiLink dartLineDocComment Comment
HiLink dartConstant Constant
HiLink dartTypedef Typedef
HiLink dartTodo Todo
HiLink dartKeyword Keyword
HiLink dartType Type
HiLink dartInterpolation PreProc
HiLink dartDocLink SpecialComment
HiLink dartSpecialChar SpecialChar
HiLink dartLibrary Include
HiLink dartCoreClasses Type
HiLink dartCoreTypedefs Typedef
HiLink dartCoreExceptions Exception
delcommand HiLink
let b:current_syntax = "dart"
if main_syntax == 'dart'
unlet main_syntax
endif
let b:spell_options="contained"
" Enable automatic indentation (2 spaces)
set expandtab
set shiftwidth=2
set softtabstop=2
set cindent
set cinoptions+=j1,J1

37
vimrc
View File

@ -124,7 +124,6 @@ imap <right> <nop>
map <Leader>bb :!bundle install<cr>
map <leader>gs :Gstatus<CR>
map <leader>gw :!git add . && git commit -m 'WIP' && git push<cr>
map <leader>nn :sp ~/Dropbox/notes/programming-notes<cr>
map <leader>pn :sp ~/Dropbox/notes/project-notes<cr>
" Remove trailing whitespace on save all files.
@ -203,6 +202,10 @@ map <leader>mm :split<cr>
map <leader>gg :topleft 100 :split Gemfile<cr>
map <leader>gr :topleft 100 :split config/routes.rb<cr>
" Map paste and nonumber
map <leader>p :set paste! paste?<cr>
map <leader>o :set number! number?<cr>
" Clear the search buffer (highlighting) when hitting return
function! MapCR()
nnoremap <cr> :nohlsearch<cr>
@ -267,36 +270,6 @@ endfunction
:command! PromoteToLet :call PromoteToLet()
:map <leader>pp :PromoteToLet<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SWITCH BETWEEN TEST AND PRODUCTION CODE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! OpenTestAlternate()
let new_file = AlternateForCurrentFile()
exec ':e ' . new_file
endfunction
function! AlternateForCurrentFile()
let current_file = expand("%")
let new_file = current_file
let in_spec = match(current_file, '^spec/') != -1
let going_to_spec = !in_spec
let in_app = match(current_file, '\<controllers\>') != -1 || match(current_file, '\<models\>') != -1 || match(current_file, '\<views\>') != -1 || match(current_file, '\<helpers\>') != -1
if going_to_spec
if in_app
let new_file = substitute(new_file, '^app/', '', '')
end
let new_file = substitute(new_file, '\.rb$', '_spec.rb', '')
let new_file = 'spec/' . new_file
else
let new_file = substitute(new_file, '_spec\.rb$', '.rb', '')
let new_file = substitute(new_file, '^spec/', '', '')
if in_app
let new_file = 'app/' . new_file
end
endif
return new_file
endfunction
nnoremap <leader>o :call OpenTestAlternate()<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" RUNNING TESTS
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -355,5 +328,5 @@ function! RunTests(filename)
endfunction
" Use Marked.app to preview Markdown files...
nnoremap <leader>p :silent !open -a Marked.app '%:p'<cr>
nnoremap <leader>pp :silent !open -a Marked.app '%:p'<cr>

View File

@ -30,7 +30,8 @@ alias bu='bundle update'
alias cls=clear
alias code='cd ~/code'
alias cpr='cp -r'
alias d='cd ~/.dotfiles'
alias d='dart'
alias dot='cd ~/.dotfiles'
alias dr='cd ~/Dropbox'
alias duh='du -csh'
alias functions='vim ~/.dotfiles/zsh/functions'
@ -42,11 +43,15 @@ alias patch='git format-patch HEAD^ --stdout > patch.diff'
alias reguard='killall -9 ruby ; guard'
alias r='rails'
alias rb='rbenv'
alias rbp='cd $RBENV_PATH/versions/$(rbenv version | sed -e "s/ (set.*$//")'
alias rbl='cd $RBENV_PATH/versions/$(rbenv version | sed -e "s/ (set.*$//")/lib/ruby'
alias rg='rails generate'
alias rmr='rm -rf'
alias rc='rails console'
alias rs='rails server'
alias reload='source ~/.zshrc'
alias s='cd ~/.ssh'
alias sc='vim ~/.ssh/config'
alias tail-logs='heroku logs -t'
alias u='cd ..'
alias v='vim'
@ -66,47 +71,54 @@ alias amend='git commit --amend'
alias g='gst'
alias ga='git add -A :/'
alias gaa='git add -A'
alias gae='echo "Use amend!" && git commit --amend' # Remove when not needed
alias gau='git add --update'
alias gb='git branch'
alias gbd='git branch -D'
alias gc='git commit'
alias gci='echo "Use gc!" && git commit' # Remove when no longer needed
alias gcl='git clone'
alias gcm="git commit -m"
alias gco='git checkout'
alias gcob='git checkout -b'
alias gcp='git cherry-pick'
alias gcpn='git cherry-pick -n'
alias gd='git diff'
alias gdc='git diff --cached'
alias gdm='git diff master'
alias gds='git diff --stat=160,120'
alias gdw='git diff --color-words'
alias gf='git fetch'
alias gfix="ga && git commit -a --amend -C HEAD"
alias gfo='git fetch origin'
alias gfm='git fetch origin master'
alias gh="source ~/.githelpers && show_git_head"
alias gl='gll -25'
alias gli='git show --pretty="format:" --name-only'
alias gll="source ~/.githelpers && pretty_git_log"
alias gla='gll --all'
alias glog='git log'
alias glogf='git log --follow'
alias gm='git merge'
alias gmff='git merge --ff-only'
alias gmffs='git merge --ff-only --squash'
alias gmtheirs='git merge -Xtheirs'
alias gp='git push'
alias gpd='git push && git push heroku master'
alias gpp='git push && git push production HEAD:production'
alias gph='git push heroku master'
alias gpf='git push -f'
alias gpu='git push -u'
alias gpff='git pull --ff-only'
alias gpl='git pull'
alias gpo='git push origin'
alias gpom='git push origin master'
alias gpr='git pull --rebase'
alias gr='git reset'
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbo='git fetch origin && git rebase origin/master'
alias grbm='git rebase master'
alias grbi='git rebase -i'
alias grbm='git fetch origin master && git rebase master'
alias grbo='git fetch origin master && git rebase origin/master'
alias gre='git remote'
alias gref='git reflog'
alias grev='git remote -v'
@ -144,9 +156,12 @@ alias learn='cd ~/code/learning-area'
alias robo='cd ~/code/projects/robocoin'
alias roboa='cd ~/code/projects/robocoin/angular'
alias pcg='cd ~/code/work/pcg'
alias sc='cd ~/code/work/redwood/scene-app/angular'
alias cur='cd ~/code/projects/things'
# Work
alias pcgt='vim ~/code/work/pcg/docs/time-tracker.txt'
alias pcgn='vim ~/code/work/pcg/docs/personal-notes.txt'
# Open Source
alias ssh-discourse='ssh -F ~/code/projects/discourse/.project/vagrant.ssh.conf default'

8
zshrc
View File

@ -27,7 +27,7 @@ export TERM=xterm-256color
export EDITOR=vi
# Grep tweaks
export GREP_OPTIONS="-nRi --color --exclude-dir=.git --exclude-dir=vendor --exclude-dir=tmp --exclude-dir=public --exclude-dir=log --exclude-dir=node_modules --exclude-dir=bower_components" # --exclude-dir=vendor/assets --exclude-dir=fonts --exclude-dir=images --exclude-dir=coverage --exclude-dir=rdoc"
export GREP_OPTIONS="-nRi --color --exclude-dir=.git --exclude-dir=vendor --exclude-dir=tmp --exclude-dir=public --exclude-dir=log --exclude-dir=node_modules --exclude-dir=bower_components --exclude-dir=coverage" # --exclude-dir=vendor/assets --exclude-dir=fonts --exclude-dir=images --exclude-dir=coverage --exclude-dir=rdoc"
# Save a ton of history
export HISTSIZE=20000
@ -61,7 +61,8 @@ export PATH=/usr/local/sbin:/usr/local/bin:${PATH}
PATH=$PATH:$HOME/bin
# Start rbenv
export PATH="$HOME/.rbenv/bin:$PATH"
export RBENV_PATH="$HOME/.rbenv"
export PATH="$RBENV_PATH/bin:$PATH"
eval "$(rbenv init -)"
export RUBY_HEAP_MIN_SLOTS=1000000
@ -76,3 +77,6 @@ export PYTHONPATH=/Users/pulsar/Code/open-source/ansible/lib:${PYTHONPATH}
export ANSIBLE_LIBRARY=/Users/pulsar/Code/open-source/ansible/library
export MANPATH=/Users/pulsar/Code/open-source/ansible/docs/man:${MANPATH}
export ANSIBLE_HOSTS=~/.ansible_hosts
# Setup Dart
export PATH=/Applications/Dart/dart-sdk/bin:${PATH}