diff --git a/.gitmodules b/.gitmodules index 51ad8768..83acff3d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,9 @@ [submodule "vim/bundle/vim-scripts-AutoTag"] path = vim/bundle/vim-scripts-AutoTag url = https://github.com/vim-scripts/AutoTag.git +[submodule "vim/bundle/vim-scripts-IndexedSearch"] + path = vim/bundle/vim-scripts-IndexedSearch + url = https://github.com/vim-scripts/IndexedSearch +[submodule "vim/bundle/scrooloose-syntastic"] + path = vim/bundle/scrooloose-syntastic + url = https://github.com/scrooloose/syntastic.git diff --git a/README.md b/README.md index 98dbf194..e0c19620 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,8 @@ Included vim plugins * NERDTree - everyone's favorite tree browser * NERDTree-tabs - makes NERDTree play nice with MacVim tabs so that it's on every tab - * showmarks - creates a visual gutter to the left of the number column showing you your bookmarks. use \mt to toggle it, \mm to place the next available mark, \mh to delete, \ma to clear all. Use standard vim mark navigation ('X) for mark named X. + * ShowMarks - creates a visual gutter to the left of the number column showing you your marks (saved locations). use \mt to toggle it, \mm to place the next available mark, \mh to delete, \ma to clear all. Use standard vim mark navigation ('X) for mark named X. + * EasyMotion - hit ,, (forward) or z,, (back) and watch the magic happen. just type the letters and jump directly to your target Git @@ -153,9 +154,8 @@ Included vim plugins * solarized - a color scheme scientifically calibrated for awesomeness (including skwp mods for ShowMarks) * csapprox - helps colors to be represented correctly on terminals (even though we expect to use MacVim) - Automation + Coding - * delimitMate - automatically closes quotes * tComment - gcc to comment a line, gcp to comment blocks, nuff said * sparkup - div.foo#bar - hit ctrl-e, expands into
, and that's just the beginning @@ -166,6 +166,13 @@ Included vim plugins * vim-markdown-preview - :Mm to view your README.md as html * ruby-debug-ide - not quite working for me, but maybe it will for you. supposedly a graphical debugger you can step through + General enhancements that don't add new commands + + * IndexedSearch - when you do searches will show you "Match 2 of 4" in the status line, nothing new to learn + * delimitMate - automatically closes quotes + * syntastic - automatic syntax checking when you save the file + + Adding your own vim plugins --- diff --git a/vim/autoload/syntastic.vim b/vim/autoload/syntastic.vim deleted file mode 100755 index 30d56b83..00000000 --- a/vim/autoload/syntastic.vim +++ /dev/null @@ -1,194 +0,0 @@ -if exists("g:loaded_syntastic_autoload") - finish -endif -let g:loaded_syntastic_autoload = 1 - -let s:save_cpo = &cpo -set cpo&vim - -function! syntastic#ErrorBalloonExpr() - if !exists('b:syntastic_balloons') | return '' | endif - return get(b:syntastic_balloons, v:beval_lnum, '') -endfunction - -function! syntastic#HighlightErrors(errors, termfunc, ...) - call clearmatches() - let forcecb = a:0 && a:1 - for item in a:errors - let group = item['type'] == 'E' ? 'SpellBad' : 'SpellCap' - if item['col'] && !forcecb - let lastcol = col([item['lnum'], '$']) - let lcol = min([lastcol, item['col']]) - call matchadd(group, '\%'.item['lnum'].'l\%'.lcol.'c') - else - let term = a:termfunc(item) - if len(term) > 0 - call matchadd(group, '\%' . item['lnum'] . 'l' . term) - endif - endif - endfor -endfunction - -" initialize c/cpp syntax checker handlers -function! s:Init() - let s:handlers = [] - let s:cflags = {} - - call s:RegHandler('gtk', 'syntastic#CheckPKG', - \ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib']) - call s:RegHandler('glib', 'syntastic#CheckPKG', - \ ['glib', 'glib-2.0', 'glib']) - call s:RegHandler('glade', 'syntastic#CheckPKG', - \ ['glade', 'libglade-2.0', 'libglade']) - call s:RegHandler('libsoup', 'syntastic#CheckPKG', - \ ['libsoup', 'libsoup-2.4', 'libsoup-2.2']) - call s:RegHandler('webkit', 'syntastic#CheckPKG', - \ ['webkit', 'webkit-1.0']) - call s:RegHandler('cairo', 'syntastic#CheckPKG', - \ ['cairo', 'cairo']) - call s:RegHandler('pango', 'syntastic#CheckPKG', - \ ['pango', 'pango']) - call s:RegHandler('libxml', 'syntastic#CheckPKG', - \ ['libxml', 'libxml-2.0', 'libxml']) - call s:RegHandler('freetype', 'syntastic#CheckPKG', - \ ['freetype', 'freetype2', 'freetype']) - call s:RegHandler('SDL', 'syntastic#CheckPKG', - \ ['sdl', 'sdl']) - call s:RegHandler('opengl', 'syntastic#CheckPKG', - \ ['opengl', 'gl']) - call s:RegHandler('ruby', 'syntastic#CheckRuby', []) - call s:RegHandler('Python\.h', 'syntastic#CheckPython', []) - call s:RegHandler('php\.h', 'syntastic#CheckPhp', []) -endfunction - -" search the first 100 lines for include statements that are -" given in the handlers dictionary -function! syntastic#SearchHeaders() - let includes = '' - let files = [] - let found = [] - let lines = filter(getline(1, 100), 'v:val =~# "#\s*include"') - - " search current buffer - for line in lines - let file = matchstr(line, '"\zs\S\+\ze"') - if file != '' - call add(files, file) - continue - endif - for handler in s:handlers - if line =~# handler["regex"] - let includes .= call(handler["func"], handler["args"]) - call add(found, handler["regex"]) - break - endif - endfor - endfor - - " search included headers - for hfile in files - if hfile != '' - let filename = expand('%:p:h') . ((has('win32') || has('win64')) ? - \ '\' : '/') . hfile - try - let lines = readfile(filename, '', 100) - catch /E484/ - continue - endtry - let lines = filter(lines, 'v:val =~# "#\s*include"') - for handler in s:handlers - if index(found, handler["regex"]) != -1 - continue - endif - for line in lines - if line =~# handler["regex"] - let includes .= call(handler["func"], handler["args"]) - call add(found, handler["regex"]) - break - endif - endfor - endfor - endif - endfor - - return includes -endfunction - -" try to find library with 'pkg-config' -" search possible libraries from first to last given -" argument until one is found -function! syntastic#CheckPKG(name, ...) - if executable('pkg-config') - if !has_key(s:cflags, a:name) - for i in range(a:0) - let l:cflags = system('pkg-config --cflags '.a:000[i]) - " since we cannot necessarily trust the pkg-config exit code - " we have to check for an error output as well - if v:shell_error == 0 && l:cflags !~? 'not found' - let l:cflags = ' '.substitute(l:cflags, "\n", '', '') - let s:cflags[a:name] = l:cflags - return l:cflags - endif - endfor - else - return s:cflags[a:name] - endif - endif - return '' -endfunction - -" try to find PHP includes with 'php-config' -function! syntastic#CheckPhp() - if executable('php-config') - if !exists('s:php_flags') - let s:php_flags = system('php-config --includes') - let s:php_flags = ' ' . substitute(s:php_flags, "\n", '', '') - endif - return s:php_flags - endif - return '' -endfunction - -" try to find the ruby headers with 'rbconfig' -function! syntastic#CheckRuby() - if executable('ruby') - if !exists('s:ruby_flags') - let s:ruby_flags = system('ruby -r rbconfig -e ' - \ . '''puts Config::CONFIG["archdir"]''') - let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '') - let s:ruby_flags = ' -I' . s:ruby_flags - endif - return s:ruby_flags - endif - return '' -endfunction - -" try to find the python headers with distutils -function! syntastic#CheckPython() - if executable('python') - if !exists('s:python_flags') - let s:python_flags = system('python -c ''from distutils import ' - \ . 'sysconfig; print sysconfig.get_python_inc()''') - let s:python_flags = substitute(s:python_flags, "\n", '', '') - let s:python_flags = ' -I' . s:python_flags - endif - return s:python_flags - endif - return '' -endfunction - -" return a handler dictionary object -function! s:RegHandler(regex, function, args) - let handler = {} - let handler["regex"] = a:regex - let handler["func"] = function(a:function) - let handler["args"] = a:args - call add(s:handlers, handler) -endfunction - -call s:Init() - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim: set et sts=4 sw=4: diff --git a/vim/bundle/scrooloose-syntastic b/vim/bundle/scrooloose-syntastic new file mode 160000 index 00000000..1ce4d319 --- /dev/null +++ b/vim/bundle/scrooloose-syntastic @@ -0,0 +1 @@ +Subproject commit 1ce4d31930a18e2629c9dcada1d0cb169a490849 diff --git a/vim/bundle/vim-scripts-IndexedSearch b/vim/bundle/vim-scripts-IndexedSearch new file mode 160000 index 00000000..500a64a5 --- /dev/null +++ b/vim/bundle/vim-scripts-IndexedSearch @@ -0,0 +1 @@ +Subproject commit 500a64a50dda26a4553b296c52eb6610bef55ae6 diff --git a/vim/macros/rails.vim b/vim/macros/rails.vim deleted file mode 100644 index 0ac6422d..00000000 --- a/vim/macros/rails.vim +++ /dev/null @@ -1,10 +0,0 @@ -command! -nargs=0 Rroutes :Rfind routes.rb -command! -nargs=0 RSroutes :RSfind routes.rb - -command! -nargs=0 Rschema :Rfind db/schema.rb -command! -nargs=0 RSschema :RSfind db/schema.rb - -command! -nargs=0 Rconfig :Rfind application.yml -command! -nargs=0 RSconfig :RSfind application.yml - -Rnavcommand sass public/stylesheets/sass -suffix=.sass diff --git a/vim/plugin/syntastic.vim b/vim/plugin/syntastic.vim deleted file mode 100755 index 7b283429..00000000 --- a/vim/plugin/syntastic.vim +++ /dev/null @@ -1,333 +0,0 @@ -"============================================================================ -"File: syntastic.vim -"Description: vim plugin for on the fly syntax checking -"Maintainer: Martin Grenfell -"Version: 1.2.0 -"Last Change: 28 Oct, 2010 -"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_plugin") - finish -endif -let g:loaded_syntastic_plugin = 1 - -let s:running_windows = has("win16") || has("win32") || has("win64") - -if !s:running_windows - let s:uname = system('uname') -endif - -if !exists("g:syntastic_enable_signs") || !has('signs') - let g:syntastic_enable_signs = 0 -endif - -if !exists("g:syntastic_enable_balloons") || !has('balloon_eval') - let g:syntastic_enable_balloons = 0 -endif - -if !exists("g:syntastic_auto_loc_list") - let g:syntastic_auto_loc_list = 0 -endif - -if !exists("g:syntastic_auto_jump") - let syntastic_auto_jump=0 -endif - -if !exists("g:syntastic_quiet_warnings") - let g:syntastic_quiet_warnings = 0 -endif - -if !exists("g:syntastic_disabled_filetypes") - let g:syntastic_disabled_filetypes = [] -endif - -if !exists("g:syntastic_stl_format") - let g:syntastic_stl_format = '[Syntax: line:%F (%t)]' -endif - -"refresh and redraw all the error info for this buf when saving or reading -autocmd bufreadpost,bufwritepost * call s:UpdateErrors() -function! s:UpdateErrors() - if &buftype == 'quickfix' - return - endif - call s:CacheErrors() - - if g:syntastic_enable_balloons && has('balloon_eval') - let b:syntastic_balloons = {} - for i in b:syntastic_loclist - let b:syntastic_balloons[i['lnum']] = i['text'] - endfor - set beval bexpr=syntastic#ErrorBalloonExpr() - endif - - if g:syntastic_enable_signs - call s:RefreshSigns() - endif - - if s:BufHasErrorsOrWarningsToDisplay() - call setloclist(0, b:syntastic_loclist) - if g:syntastic_auto_jump - silent!ll - endif - elseif g:syntastic_auto_loc_list == 2 - lclose - endif - - if g:syntastic_auto_loc_list == 1 - if s:BufHasErrorsOrWarningsToDisplay() - call s:ShowLocList() - else - "TODO: this will close the loc list window if one was opened by - "something other than syntastic - lclose - endif - endif -endfunction - -"detect and cache all syntax errors in this buffer -" -"depends on a function called SyntaxCheckers_{&ft}_GetLocList() existing -"elsewhere -function! s:CacheErrors() - let b:syntastic_loclist = [] - - if filereadable(expand("%")) - for ft in split(&ft, '\.') - if s:Checkable(ft) - let b:syntastic_loclist = extend(b:syntastic_loclist, SyntaxCheckers_{ft}_GetLocList()) - endif - endfor - endif -endfunction - -"return true if there are cached errors/warnings for this buf -function! s:BufHasErrorsOrWarnings() - return exists("b:syntastic_loclist") && !empty(b:syntastic_loclist) -endfunction - -"return true if there are cached errors for this buf -function! s:BufHasErrors() - return len(s:ErrorsForType('E')) > 0 -endfunction - -function! s:BufHasErrorsOrWarningsToDisplay() - return s:BufHasErrors() || (!g:syntastic_quiet_warnings && s:BufHasErrorsOrWarnings()) -endfunction - -function! s:ErrorsForType(type) - if !exists("b:syntastic_loclist") - return [] - endif - return filter(copy(b:syntastic_loclist), 'v:val["type"] ==? "' . a:type . '"') -endfunction - -function s:Errors() - return extend(s:ErrorsForType("E"), s:ErrorsForType('')) -endfunction - -function s:Warnings() - return s:ErrorsForType("W") -endfunction - -if g:syntastic_enable_signs - "use >> to display syntax errors in the sign column - sign define SyntasticError text=>> texthl=error - sign define SyntasticWarning text=>> texthl=todo -endif - -"start counting sign ids at 5000, start here to hopefully avoid conflicting -"with any other code that places signs (not sure if this precaution is -"actually needed) -let s:first_sign_id = 5000 -let s:next_sign_id = s:first_sign_id - -"place signs by all syntax errs in the buffer -function s:SignErrors() - if s:BufHasErrorsOrWarningsToDisplay() - for i in b:syntastic_loclist - if i['bufnr'] != bufnr("") - continue - endif - - let sign_type = 'SyntasticError' - if i['type'] == 'W' - let sign_type = 'SyntasticWarning' - endif - - exec "sign place ". s:next_sign_id ." line=". i['lnum'] ." name=". sign_type ." file=". expand("%:p") - call add(s:BufSignIds(), s:next_sign_id) - let s:next_sign_id += 1 - endfor - endif -endfunction - -"remove the signs with the given ids from this buffer -function! s:RemoveSigns(ids) - for i in a:ids - exec "sign unplace " . i - call remove(s:BufSignIds(), index(s:BufSignIds(), i)) - endfor -endfunction - -"get all the ids of the SyntaxError signs in the buffer -function! s:BufSignIds() - if !exists("b:syntastic_sign_ids") - let b:syntastic_sign_ids = [] - endif - return b:syntastic_sign_ids -endfunction - -"update the error signs -function! s:RefreshSigns() - let old_signs = copy(s:BufSignIds()) - call s:SignErrors() - call s:RemoveSigns(old_signs) - let s:first_sign_id = s:next_sign_id -endfunction - -"display the cached errors for this buf in the location list -function! s:ShowLocList() - if exists("b:syntastic_loclist") - let num = winnr() - lopen - if num != winnr() - wincmd p - endif - endif -endfunction - -command Errors call s:ShowLocList() - -"return a string representing the state of buffer according to -"g:syntastic_stl_format -" -"return '' if no errors are cached for the buffer -function! SyntasticStatuslineFlag() - if s:BufHasErrorsOrWarningsToDisplay() - let errors = s:Errors() - let warnings = s:Warnings() - - let output = g:syntastic_stl_format - - "hide stuff wrapped in %E(...) unless there are errors - let output = substitute(output, '\C%E{\([^}]*\)}', len(errors) ? '\1' : '' , 'g') - - "hide stuff wrapped in %W(...) unless there are warnings - let output = substitute(output, '\C%W{\([^}]*\)}', len(warnings) ? '\1' : '' , 'g') - - "hide stuff wrapped in %B(...) unless there are both errors and warnings - let output = substitute(output, '\C%B{\([^}]*\)}', (len(warnings) && len(errors)) ? '\1' : '' , 'g') - - "sub in the total errors/warnings/both - let output = substitute(output, '\C%w', len(warnings), 'g') - let output = substitute(output, '\C%e', len(errors), 'g') - let output = substitute(output, '\C%t', len(b:syntastic_loclist), 'g') - - "first error/warning line num - let output = substitute(output, '\C%F', b:syntastic_loclist[0]['lnum'], 'g') - - "first error line num - let output = substitute(output, '\C%fe', len(errors) ? errors[0]['lnum'] : '', 'g') - - "first warning line num - let output = substitute(output, '\C%fw', len(warnings) ? warnings[0]['lnum'] : '', 'g') - - return output - else - return '' - endif -endfunction - -"A wrapper for the :lmake command. Sets up the make environment according to -"the options given, runs make, resets the environment, returns the location -"list -" -"a:options can contain the following keys: -" 'makeprg' -" 'errorformat' -" -"The corresponding options are set for the duration of the function call. They -"are set with :let, so dont escape spaces. -function! SyntasticMake(options) - let old_loclist = getloclist(0) - let old_makeprg = &makeprg - let old_shellpipe = &shellpipe - let old_shell = &shell - let old_errorformat = &errorformat - - if !s:running_windows && (s:uname !~ "FreeBSD") - "this is a hack to stop the screen needing to be ':redraw'n when - "when :lmake is run. Otherwise the screen flickers annoyingly - let &shellpipe='&>' - let &shell = '/bin/bash' - endif - - if has_key(a:options, 'makeprg') - let &makeprg = a:options['makeprg'] - endif - - if has_key(a:options, 'errorformat') - let &errorformat = a:options['errorformat'] - endif - - silent lmake! - let errors = getloclist(0) - - call setloclist(0, old_loclist) - let &makeprg = old_makeprg - let &errorformat = old_errorformat - let &shellpipe=old_shellpipe - let &shell=old_shell - - return errors -endfunction - -function! s:Checkable(ft) - if !exists("g:loaded_" . a:ft . "_syntax_checker") - exec "runtime syntax_checkers/" . a:ft . ".vim" - endif - - return exists("*SyntaxCheckers_". a:ft ."_GetLocList") && - \ index(g:syntastic_disabled_filetypes, a:ft) == -1 -endfunction - -command! -nargs=? SyntasticEnable call s:Enable() -command! -nargs=? SyntasticDisable call s:Disable() - -"disable syntax checking for the given filetype (defaulting to current ft) -function! s:Disable(...) - let ft = a:0 ? a:1 : &filetype - - if !empty(ft) && index(g:syntastic_disabled_filetypes, ft) == -1 - call add(g:syntastic_disabled_filetypes, ft) - endif - - "will cause existing errors to be cleared - call s:UpdateErrors() -endfunction - -"enable syntax checking for the given filetype (defaulting to current ft) -function! s:Enable(...) - let ft = a:0 ? a:1 : &filetype - - let i = index(g:syntastic_disabled_filetypes, ft) - if i != -1 - call remove(g:syntastic_disabled_filetypes, i) - endif - - if !&modified - call s:UpdateErrors() - redraw! - else - echom "Syntasic: enabled for the '" . ft . "' filetype. :write out to update errors" - endif -endfunction - -" vim: set et sts=4 sw=4: