Skip to content
Browse files

plugins aktualisiert

  • Loading branch information...
1 parent dc1ee9f commit ec8f1a99fcef54dbe1eb6679c1e3977fdd34ee69 Timo Göllner committed
Showing with 3,040 additions and 1,134 deletions.
  1. +45 −0 README.markdown
  2. +155 −110 autoload/rails.vim
  3. +29 −0 compiler/cucumber.vim
  4. +226 −0 doc/fugitive.txt
  5. +14 −14 doc/rails.txt
  6. +24 −20 doc/surround.txt
  7. +1 −0 ftdetect/haml.vim
  8. +14 −7 ftplugin/cucumber.vim
  9. +4 −3 ftplugin/haml.vim
  10. +8 −4 ftplugin/sass.vim
  11. +12 −0 ftplugin/scss.vim
  12. +29 −9 indent/cucumber.vim
  13. +7 −7 indent/haml.vim
  14. +4 −4 indent/sass.vim
  15. +12 −0 indent/scss.vim
  16. +1,761 −0 plugin/fugitive.vim
  17. +0 −354 plugin/git.vim
  18. +1 −1 plugin/rails.vim
  19. +516 −521 plugin/surround.vim
  20. +64 −38 syntax/cucumber.vim
  21. +46 −28 syntax/haml.vim
  22. +48 −14 syntax/sass.vim
  23. +20 −0 syntax/scss.vim
View
45 README.markdown
@@ -0,0 +1,45 @@
+fugitive.vim
+============
+
+I'm not going to lie to you; fugitive.vim may very well be the best
+Git wrapper of all time. Check out these features:
+
+View any blob, tree, commit, or tag in the repository with `:Gedit` (and
+`:Gsplit`, `:Gvsplit`, `:Gtabedit`, ...). Edit a file in the index and
+write to it to stage the changes. Use `:Gdiff` to bring up the staged
+version of the file side by side with the working tree version and use
+Vim's diff handling capabilities to stage a subset of the file's
+changes.
+
+Bring up the output of `git status` with `:Gstatus`. Press `-` to
+`add`/`reset` a file's changes, or `p` to `add`/`reset` `--patch` that
+mofo. And guess what `:Gcommit` does!
+
+`:Gblame` brings up an interactive vertical split with `git blame`
+output. Press enter on a line to reblame the file as it stood in that
+commit, or `o` to open that commit in a split.
+
+`:Gmove` does a `git mv` on a file and simultaneously renames the
+buffer. `:Gremove` does a `git rm` on a file and simultaneously deletes
+the buffer.
+
+Use `:Ggrep` to search the work tree (or any arbitrary commit) with
+`git grep`, skipping over that which is not tracked in the repository.
+`:Glog` loads all previous revisions of a file into the quickfix list so
+you can iterate over them and watch the file evolve!
+
+`:Gread` is a variant of `git checkout -- filename` that operates on the
+buffer rather than the filename. This means you can use `u` to undo it
+and you never get any warnings about the file changing outside Vim.
+`:Gwrite` writes to both the work tree and index versions of a file,
+making it like `git add` when called from a work tree file and like
+`git checkout` when called from the index or a blob in history.
+
+Add `%{fugitive#statusline()}` to `'statusline'` to get an indicator
+with the current branch in (surprise!) your statusline.
+
+Oh, and of course there's `:Git` for running any arbitrary command.
+
+Like fugitive.vim? Follow the repository on
+[GitHub](http://github.com/tpope/vim-fugitive) and vote for it on
+[vim.org](http://www.vim.org/scripts/script.php?script_id=2975).
View
265 autoload/rails.vim
@@ -6,7 +6,7 @@
if exists('g:autoloaded_rails') || &cp
finish
endif
-let g:autoloaded_rails = '4.2'
+let g:autoloaded_rails = '4.3'
let s:cpo_save = &cpo
set cpo&vim
@@ -330,6 +330,8 @@ function! s:readable_controller_name(...) dict abort
return s:sub(f,'.*<app/apis/(.{-})_api\.rb$','\1')
elseif f =~ '\<test/functional/.*_test\.rb$'
return s:sub(f,'.*<test/functional/(.{-})%(_controller)=_test\.rb$','\1')
+ elseif f =~ '\<test/unit/helpers/.*_helper_test\.rb$'
+ return s:sub(f,'.*<test/unit/helpers/(.{-})_helper_test\.rb$','\1')
elseif f =~ '\<spec/controllers/.*_spec\.rb$'
return s:sub(f,'.*<spec/controllers/(.{-})%(_controller)=_spec\.rb$','\1')
elseif f =~ '\<spec/helpers/.*_helper_spec\.rb$'
@@ -376,6 +378,8 @@ function! s:readable_model_name(...) dict abort
return s:sub(f,'.*<%(test|spec)/exemplars/(.*)_exemplar\.rb$','\1')
elseif f =~ '\<\%(test/\|spec/\)\=factories/.*\.rb$'
return s:sub(f,'.*<%(test/|spec/)=factories/(.{-})%(_factory)=\.rb$','\1')
+ elseif f =~ '\<\%(test/\|spec/\)\=fabricators/.*\.rb$'
+ return s:sub(f,'.*<%(test/|spec/)=fabricators/(.{-})%(_fabricator)=\.rb$','\1')
elseif a:0 && a:1
return rails#singularize(self.controller_name())
endif
@@ -708,6 +712,8 @@ function! s:readable_calculate_file_type() dict abort
let r = "test"
elseif f =~ '\<spec/.*_spec\.rb'
let r = "spec"
+ elseif f =~ '\<spec/support/.*\.rb'
+ let r = "spec"
elseif f =~ '\<db/migrate\>'
let r = "db-migration"
elseif f=~ '\<db/schema\.rb$'
@@ -716,10 +722,12 @@ function! s:readable_calculate_file_type() dict abort
let r = "task"
elseif f =~ '\<log/.*\.log$'
let r = "log"
- elseif e == "css" || e == "sass" || e == "less"
+ elseif e == "css" || e =~ "s[ac]ss" || e == "less"
let r = "stylesheet-".e
elseif e == "js"
let r = "javascript"
+ elseif e == "coffee"
+ let r = "javascript-coffee"
elseif e == "html"
let r = e
elseif f =~ '\<config/routes\>.*\.rb$'
@@ -772,7 +780,8 @@ function! s:app_has(feature) dict
\'spec': 'spec/',
\'cucumber': 'features/',
\'sass': 'public/stylesheets/sass/',
- \'lesscss': 'app/stylesheets/'}
+ \'lesscss': 'app/stylesheets/',
+ \'coffee': 'app/scripts/'}
if self.cache.needs('features')
call self.cache.set('features',{})
endif
@@ -922,7 +931,7 @@ function! s:BufCommands()
let ext = expand("%:e")
if ext =~ s:viewspattern()
" TODO: complete controller names with trailing slashes here
- command! -buffer -bar -nargs=? -range -complete=customlist,s:controllerList Rextract :<line1>,<line2>call s:Extract(<bang>0,<f-args>)
+ command! -buffer -bar -bang -nargs=? -range -complete=customlist,s:controllerList Rextract :<line1>,<line2>call s:Extract(<bang>0,<f-args>)
endif
if RailsFilePath() =~ '\<db/migrate/.*\.rb$'
command! -buffer -bar Rinvert :call s:Invert(<bang>0)
@@ -989,7 +998,7 @@ function! rails#new_app_command(bang,...)
return
endif
let dir = ""
- if a:1 !~ '^-'
+ if a:1 !~ '^-' && a:1 !=# 'new'
let dir = a:1
elseif a:{a:0} =~ '[\/]'
let dir = a:{a:0}
@@ -1146,6 +1155,11 @@ function! s:Rake(bang,lnum,arg)
let arg = rails#buffer().default_rake_task(lnum)
endif
endif
+ if !has_key(self,'options') | let self.options = {} | endif
+ if arg == '-'
+ let arg = get(self.options,'last_rake_task','')
+ endif
+ let self.options['last_rake_task'] = arg
let withrubyargs = '-r ./config/boot -r '.s:rquote(self.path('config/environment')).' -e "puts \%((in \#{Dir.getwd}))" '
if arg =~# '^notes\>'
let &l:errorformat = '%-P%f:,\ \ *\ [%*[\ ]%l]\ [%t%*[^]]] %m,\ \ *\ [%*[\ ]%l] %m,%-Q'
@@ -1156,7 +1170,7 @@ function! s:Rake(bang,lnum,arg)
if !a:bang
cwindow
endif
- elseif arg =~# '^\%(stats\|routes\|secret\|time:zones\|db:\%(charset\|collation\|fixtures:identify\>.*\|version\)\)\%([: ]\|$\)'
+ elseif arg =~# '^\%(stats\|routes\|secret\|time:zones\|db:\%(charset\|collation\|fixtures:identify\>.*\|migrate:status\|version\)\)\%([: ]\|$\)'
let &l:errorformat = '%D(in\ %f),%+G%.%#'
exe 'make! '.arg
if !a:bang
@@ -1202,7 +1216,9 @@ endfunction
function! s:readable_default_rake_task(lnum) dict abort
let app = self.app()
let lnum = a:lnum < 0 ? 0 : a:lnum
- if self.getline(lnum) =~# '# rake '
+ if self.getvar('&buftype') == 'quickfix'
+ return '-'
+ elseif self.getline(lnum) =~# '# rake '
return matchstr(self.getline(lnum),'\C# rake \zs.*')
elseif self.getline(self.last_method_line(lnum)-1) =~# '# rake '
return matchstr(self.getline(self.last_method_line(lnum)-1),'\C# rake \zs.*')
@@ -1229,9 +1245,9 @@ function! s:readable_default_rake_task(lnum) dict abort
if self.name() =~# '\<spec/spec_helper\.rb$'
return 'spec'
elseif lnum > 0
- return 'spec SPEC="%:p":'.lnum
+ return 'spec SPEC="'.self.path().'":'.lnum
else
- return 'spec SPEC="%:p"'
+ return 'spec SPEC="'.self.path().'"'
endif
elseif self.type_name('test')
let meth = self.last_method(lnum)
@@ -1241,11 +1257,11 @@ function! s:readable_default_rake_task(lnum) dict abort
let call = ""
endif
if self.type_name('test-unit','test-functional','test-integration')
- return s:sub(s:gsub(self.type_name(),'-',':'),'unit$|functional$','&s')." TEST=\"%:p\"".s:sub(call,'^ ',' TESTOPTS=')
+ return s:sub(s:gsub(self.type_name(),'-',':'),'unit$|functional$','&s').' TEST="'.self.path().'"'.s:sub(call,'^ ',' TESTOPTS=')
elseif self.name() =~# '\<test/test_helper\.rb$'
return 'test'
else
- return "test:recent TEST=\"%:p\"".s:sub(call,'^ ',' TESTOPTS=')
+ return 'test:recent TEST="'.self.path().'"'.s:sub(call,'^ ',' TESTOPTS=')
endif
elseif self.type_name('db-migration')
let ver = matchstr(self.name(),'\<db/migrate/0*\zs\d*\ze_')
@@ -1273,13 +1289,17 @@ function! s:readable_default_rake_task(lnum) dict abort
else
return 'routes CONTROLLER='.self.controller_name()
endif
- elseif app.has('spec') && self.name() =~# '^app/.*\.rb' && app.has_file(s:sub(self.name(),'^app/(.*)\.rb$','spec/\1_spec.rb'))
- return 'spec SPEC="%:p:r:s?[\/]app[\/]?/spec/?_spec.rb" SPEC_OPTS='
+ elseif app.has('spec') && self.name() =~# '^app/.*\.\w\+$' && app.has_file(s:sub(self.name(),'^app/(.*)\.\w\+$','spec/\1_spec.rb'))
+ return 'spec SPEC="'.fnamemodify(s:sub(self.name(),'<app/','spec/'),':p:r').'_spec.rb"'
+ elseif app.has('spec') && self.name() =~# '^app/.*\.\w\+$' && app.has_file(s:sub(self.name(),'^app/(.*)$','spec/\1_spec.rb'))
+ return 'spec SPEC="'.fnamemodify(s:sub(self.name(),'<app/','spec/'),':p').'_spec.rb"'
elseif self.type_name('model')
- return 'test:units TEST="%:p:r:s?[\/]app[\/]models[\/]?/test/unit/?_test.rb"'
- elseif self.type_name('api')
- return 'test:units TEST="%:p:r:s?[\/]app[\/]apis[\/]?/test/functional/?_test.rb"'
- elseif self.type_name('\<\%(controller\|helper\|view\)')
+ return 'test:units TEST="'.fnamemodify(s:sub(self.name(),'<app/models/','test/unit/'),':p:r').'_test.rb"'
+ elseif self.type_name('api','mailer')
+ return 'test:units TEST="'.fnamemodify(s:sub(self.name(),'<app/%(apis|mailers|models)/','test/functional/'),':p:r').'_test.rb"'
+ elseif self.type_name('helper')
+ return 'test:units TEST="'.fnamemodify(s:sub(self.name(),'<app/','test/unit/'),':p:r').'_test.rb"'
+ elseif self.type_name('controller','helper','view')
if self.name() =~ '\<app/' && s:controller() !~# '^\%(application\)\=$'
return 'test:functionals TEST="'.s:escarg(app.path('test/functional/'.s:controller().'_controller_test.rb')).'"'
else
@@ -1287,9 +1307,9 @@ function! s:readable_default_rake_task(lnum) dict abort
endif
elseif self.type_name('cucumber-feature')
if lnum > 0
- return 'cucumber FEATURE="%:p":'.lnum
+ return 'cucumber FEATURE="'.self.path().'":'.lnum
else
- return 'cucumber FEATURE="%:p"'
+ return 'cucumber FEATURE="'.self.path().'"'
endif
elseif self.type_name('cucumber')
return 'cucumber'
@@ -1351,11 +1371,13 @@ function! s:readable_preview_urls(lnum) dict abort
let url += [self.getvar('rails_preview')]
end
if self.name() =~ '^public/stylesheets/sass/'
- let urls = urls + [s:sub(s:sub(self.name(),'^public/stylesheets/sass/','/stylesheets/'),'\.sass$','.css')]
+ let urls = urls + [s:sub(s:sub(self.name(),'^public/stylesheets/sass/','/stylesheets/'),'\.s[ac]ss$','.css')]
elseif self.name() =~ '^public/'
let urls = urls + [s:sub(self.name(),'^public','')]
elseif self.name() =~ '^app/stylesheets/'
let urls = urls + [s:sub(s:sub(self.name(),'^app/stylesheets/','/stylesheets/'),'\.less$','.css')]
+ elseif self.name() =~ '^app/scripts/'
+ let urls = urls + [s:sub(s:sub(self.name(),'^app/scripts/','/javascripts/'),'\.coffee$','.js')]
elseif self.controller_name() != '' && self.controller_name() != 'application'
if self.type_name('controller') && self.last_method(a:lnum) != ''
let urls += ['/'.self.controller_name().'/'.self.last_method(a:lnum).'/']
@@ -1847,7 +1869,7 @@ function! s:RailsFind()
let res = s:findit('\v<File.dirname\(__FILE__\)\s*\+\s*[:'."'".'"](\f+)>['."'".'"]=',expand('%:h').'\1')
if res != ""|return res|endif
- let res = rails#underscore(s:findit('\v\s*<%(include|extend)\(=\s*<(\f+)>','\1'))
+ let res = rails#underscore(s:findit('\v\s*<%(include|extend)\(=\s*<([[:alnum:]_:]+)>','\1'))
if res != ""|return res.".rb"|endif
let res = s:findamethod('require','\1')
@@ -2279,6 +2301,7 @@ function! s:integrationtestList(A,L,P)
let found += rails#app().relglob("test/integration/","**/*","_test.rb")
endif
if rails#app().has('spec')
+ let found += rails#app().relglob("spec/requests/","**/*","_spec.rb")
let found += rails#app().relglob("spec/integration/","**/*","_spec.rb")
endif
if rails#app().has('cucumber')
@@ -2355,7 +2378,7 @@ function! s:Navcommand(bang,...)
if name !~ '^[A-Za-z]\+$'
return s:error("E182: Invalid command name")
endif
- let cmds = 'ESVT '
+ let cmds = 'ESVTD '
let cmd = ''
while cmds != ''
exe 'command! -buffer -bar -bang -nargs=* -complete=customlist,'.s:sid.'CommandList R'.cmd.name." :call s:CommandEdit('".cmd."<bang>','".name."',\"".prefix."\",".string(suffix).",".string(filter).",".string(default).",<f-args>)"
@@ -2537,7 +2560,7 @@ function! s:viewEdit(cmd,...)
let dir = fnamemodify(rails#app().path(found),':h')
if !isdirectory(dir)
if a:0 && a:1 =~ '!'
- call mkdir(dir)
+ call mkdir(dir,'p')
else
return s:error('No such directory')
endif
@@ -2624,6 +2647,8 @@ function! s:stylesheetEdit(cmd,...)
let name = a:0 ? a:1 : s:controller(1)
if rails#app().has('sass') && rails#app().has_file('public/stylesheets/sass/'.name.'.sass')
return s:EditSimpleRb(a:cmd,"stylesheet",name,"public/stylesheets/sass/",".sass",1)
+ elseif rails#app().has('sass') && rails#app().has_file('public/stylesheets/sass/'.name.'.scss')
+ return s:EditSimpleRb(a:cmd,"stylesheet",name,"public/stylesheets/sass/",".scss",1)
elseif rails#app().has('lesscss') && rails#app().has_file('app/stylesheets/'.name.'.less')
return s:EditSimpleRb(a:cmd,"stylesheet",name,"app/stylesheets/",".less",1)
else
@@ -2632,7 +2657,14 @@ function! s:stylesheetEdit(cmd,...)
endfunction
function! s:javascriptEdit(cmd,...)
- return s:EditSimpleRb(a:cmd,"javascript",a:0? a:1 : "application","public/javascripts/",".js",1)
+ let name = a:0 ? a:1 : s:controller(1)
+ if rails#app().has('coffee') && rails#app().has_file('app/scripts/'.name.'.coffee')
+ return s:EditSimpleRb(a:cmd,'javascript',name,'app/scripts/','.coffee',1)
+ elseif rails#app().has('coffee') && rails#app().has_file('app/scripts/'.name.'.js')
+ return s:EditSimpleRb(a:cmd,'javascript',name,'app/scripts/','.js',1)
+ else
+ return s:EditSimpleRb(a:cmd,'javascript',name,'public/javascripts/','.js',1)
+ endif
endfunction
function! s:unittestEdit(cmd,...)
@@ -2699,10 +2731,10 @@ function! s:integrationtestEdit(cmd,...)
else
let cmd = s:findcmdfor(a:cmd)
endif
- let mapping = {'test': ['test/integration/','_test.rb'], 'spec': ['spec/integration/','_spec.rb'], 'cucumber': ['features/','.feature']}
- let tests = map(filter(rails#app().test_suites(),'has_key(mapping,v:val)'),'get(mapping,v:val)')
+ let tests = [['test/integration/','_test.rb'], [ 'spec/requests/','_spec.rb'], [ 'spec/integration/','_spec.rb'], [ 'features/','.feature']]
+ call filter(tests, 'isdirectory(rails#app().path(v:val[0]))')
if empty(tests)
- let tests = [mapping['test']]
+ let tests = [['test/integration/','_test.rb']]
endif
for [prefix, suffix] in tests
if rails#app().has_file(prefix.f.suffix)
@@ -3033,15 +3065,6 @@ function! s:readable_related(...) dict abort
return api
elseif self.type_name('api')
return s:sub(s:sub(f,'/apis/','/controllers/'),'_api\.rb$','_controller.rb')
- elseif self.type_name('helper')
- let controller = s:sub(s:sub(f,'/helpers/','/controllers/'),'_helper\.rb$','_controller.rb')
- let controller = s:sub(controller,'application_controller','application')
- let spec = s:sub(s:sub(f,'<app/','spec/'),'\.rb$','_spec.rb')
- if self.app().has_file(spec)
- return spec
- else
- return controller
- endif
elseif self.type_name('fixtures') && f =~ '\<spec/'
let file = rails#singularize(fnamemodify(f,":t:r")).'_spec.rb'
return file
@@ -3061,14 +3084,16 @@ function! s:readable_related(...) dict abort
else
let file .= '_test.rb'
endif
- if self.type_name('model')
+ if self.type_name('helper')
+ return s:sub(file,'<app/helpers/','test/unit/helpers/')."\n".s:sub(s:sub(file,'_test\.rb$','_spec.rb'),'<app/helpers/','spec/helpers/')
+ elseif self.type_name('model')
return s:sub(file,'<app/models/','test/unit/')."\n".s:sub(s:sub(file,'_test\.rb$','_spec.rb'),'<app/models/','spec/models/')
elseif self.type_name('controller')
return s:sub(file,'<app/controllers/','test/functional/')."\n".s:sub(s:sub(file,'_test\.rb$','_spec.rb'),'app/controllers/','spec/controllers/')
elseif self.type_name('mailer')
return s:sub(file,'<app/m%(ailer|odel)s/','test/unit/')."\n".s:sub(s:sub(file,'_test\.rb$','_spec.rb'),'<app/','spec/')
elseif self.type_name('test-unit')
- return s:sub(file,'test/unit/','app/models/')."\n".s:sub(file,'test/unit/','lib/')
+ return s:sub(s:sub(file,'test/unit/helpers/','app/helpers/'),'test/unit/','app/models/')."\n".s:sub(file,'test/unit/','lib/')
elseif self.type_name('test-functional')
if file =~ '_api\.rb'
return s:sub(file,'test/functional/','app/apis/')
@@ -3088,7 +3113,7 @@ function! s:readable_related(...) dict abort
elseif file =~ '\<vendor/.*/test/'
return s:sub(file,'<vendor/.{-}/\zstest/','lib/')
else
- return fnamemodify(file,":t")
+ return fnamemodify(file,':t')."\n".s:sub(s:sub(f,'\.rb$','_spec.rb'),'^app/','spec/')
endif
else
return ""
@@ -3148,14 +3173,14 @@ function! s:Extract(bang,...) range abort
else
let out = (rails_root)."/app/views/".dir."/_".fname
endif
- if filereadable(out)
- let partial_warn = 1
+ if filereadable(out) && !a:bang
+ return s:error('E13: File exists (add ! to override)')
endif
- if bufnr(out) > 0
- if bufloaded(out)
- return s:error("Partial already open in buffer ".bufnr(out))
+ if !isdirectory(fnamemodify(out,':h'))
+ if a:bang
+ call mkdir(fnamemodify(out,':h'),'p')
else
- exe "bwipeout ".bufnr(out)
+ return s:error('No such directory')
endif
endif
" No tabs, they'll just complicate things
@@ -3217,13 +3242,9 @@ function! s:Extract(bang,...) range abort
norm ^5w
endif
let ft = &ft
- if &hidden
- enew
- else
- new
- endif
let shortout = fnamemodify(out,':.')
- silent file `=shortout`
+ silent split `=shortout`
+ silent %delete
let &ft = ft
let @@ = partial
silent put
@@ -3234,10 +3255,6 @@ function! s:Extract(bang,...) range abort
endif
silent! exe '%substitute?\%(\w\|[@:"'."'".'-]\)\@<!'.var.'\>?'.name.'?g'
1
- call RailsBufInit(rails_root)
- if exists("l:partial_warn")
- call s:warn("Warning: partial exists!")
- endif
endfunction
" }}}1
@@ -3419,24 +3436,24 @@ endfunction
function! s:helpermethods()
return ""
\."atom_feed audio_path audio_tag auto_discovery_link_tag auto_link "
- \."benchmark button_to button_to_function button_to_remote "
+ \."button_to button_to_function "
\."cache capture cdata_section check_box check_box_tag collection_select concat content_for content_tag content_tag_for csrf_meta_tag current_cycle cycle "
\."date_select datetime_select debug distance_of_time_in_words distance_of_time_in_words_to_now div_for dom_class dom_id draggable_element draggable_element_js drop_receiving_element drop_receiving_element_js "
- \."error_message_on error_messages_for escape_javascript escape_once evaluate_remote_response excerpt "
- \."field_set_tag fields_for file_field file_field_tag form form_for form_remote_for form_remote_tag form_tag "
+ \."email_field email_field_tag error_message_on error_messages_for escape_javascript escape_once excerpt "
+ \."favicon_link_tag field_set_tag fields_for file_field file_field_tag form form_for form_tag "
\."grouped_collection_select grouped_options_for_select "
\."hidden_field hidden_field_tag highlight "
\."image_path image_submit_tag image_tag input "
\."javascript_cdata_section javascript_include_tag javascript_path javascript_tag "
- \."l label label_tag link_to link_to_function link_to_if link_to_remote link_to_unless link_to_unless_current localize "
- \."mail_to markdown "
- \."number_to_currency number_to_human_size number_to_percentage number_to_phone number_with_delimiter number_with_precision "
- \."observe_field observe_form option_groups_from_collection_for_select options_for_select options_from_collection_for_select "
- \."partial_path password_field password_field_tag path_to_audio path_to_image path_to_javascript path_to_stylesheet path_to_video periodically_call_remote pluralize "
- \."radio_button radio_button_tag raw remote_form_for remote_function reset_cycle "
- \."safe_concat sanitize sanitize_css select select_date select_datetime select_day select_hour select_minute select_month select_second select_tag select_time select_year simple_format sortable_element sortable_element_js strip_links strip_tags stylesheet_link_tag stylesheet_path submit_tag submit_to_remote "
- \."t tag text_area text_area_tag text_field text_field_tag textilize textilize_without_paragraph time_ago_in_words time_select time_zone_options_for_select time_zone_select translate truncate "
- \."update_page update_page_tag url_for "
+ \."l label label_tag link_to link_to_function link_to_if link_to_unless link_to_unless_current localize "
+ \."mail_to "
+ \."number_field number_field_tag number_to_currency number_to_human number_to_human_size number_to_percentage number_to_phone number_with_delimiter number_with_precision "
+ \."option_groups_from_collection_for_select options_for_select options_from_collection_for_select "
+ \."password_field password_field_tag path_to_audio path_to_image path_to_javascript path_to_stylesheet path_to_video phone_field phone_field_tag pluralize "
+ \."radio_button radio_button_tag range_field range_field_tag raw remote_function reset_cycle "
+ \."safe_concat sanitize sanitize_css search_field search_field_tag select select_date select_datetime select_day select_hour select_minute select_month select_second select_tag select_time select_year simple_format sortable_element sortable_element_js strip_links strip_tags stylesheet_link_tag stylesheet_path submit_tag "
+ \."t tag telephone_field telephone_field_tag text_area text_area_tag text_field text_field_tag time_ago_in_words time_select time_zone_options_for_select time_zone_select translate truncate "
+ \."update_page update_page_tag url_field url_field_tag url_for url_options "
\."video_path video_tag visual_effect "
\."word_wrap"
endfunction
@@ -3490,6 +3507,8 @@ function! s:BufSyntax()
syn keyword rubyRailsARAssociationMethod belongs_to has_one has_many has_and_belongs_to_many composed_of accepts_nested_attributes_for
syn keyword rubyRailsARCallbackMethod before_create before_destroy before_save before_update before_validation before_validation_on_create before_validation_on_update
syn keyword rubyRailsARCallbackMethod after_create after_destroy after_save after_update after_validation after_validation_on_create after_validation_on_update
+ syn keyword rubyRailsARCallbackMethod around_create around_destroy around_save around_update
+ syn keyword rubyRailsARCallbackMethod after_commit after_find after_initialize after_rollback after_touch
syn keyword rubyRailsARClassMethod attr_accessible attr_protected establish_connection set_inheritance_column set_locking_column set_primary_key set_sequence_name set_table_name
syn keyword rubyRailsARValidationMethod validate validates validate_on_create validate_on_update validates_acceptance_of validates_associated validates_confirmation_of validates_each validates_exclusion_of validates_format_of validates_inclusion_of validates_length_of validates_numericality_of validates_presence_of validates_size_of validates_uniqueness_of
syn keyword rubyRailsMethod logger
@@ -3498,14 +3517,14 @@ function! s:BufSyntax()
syn keyword rubyRailsARMethod observe
endif
if buffer.type_name('mailer')
- syn keyword rubyRailsMethod logger attachments
+ syn keyword rubyRailsMethod logger url_for polymorphic_path polymorphic_url
syn keyword rubyRailsRenderMethod mail render
- syn keyword rubyRailsControllerMethod default helper helper_attr helper_method
+ syn keyword rubyRailsControllerMethod attachments default helper helper_attr helper_method
endif
if buffer.type_name('controller','view','helper')
syn keyword rubyRailsMethod params request response session headers cookies flash
syn keyword rubyRailsRenderMethod render
- syn keyword rubyRailsMethod logger
+ syn keyword rubyRailsMethod logger polymorphic_path polymorphic_url
endif
if buffer.type_name('helper','view')
exe "syn keyword rubyRailsHelperMethod ".s:gsub(s:helpermethods(),'<%(content_for|select)\s+','')
@@ -3517,7 +3536,7 @@ function! s:BufSyntax()
endif
elseif buffer.type_name('controller')
syn keyword rubyRailsControllerMethod helper helper_attr helper_method filter layout url_for serialize exempt_from_layout filter_parameter_logging hide_action cache_sweeper protect_from_forgery caches_page cache_page caches_action expire_page expire_action rescue_from
- syn keyword rubyRailsRenderMethod render_to_string redirect_to head
+ syn keyword rubyRailsRenderMethod head redirect_to render_to_string respond_with
syn match rubyRailsRenderMethod '\<respond_to\>?\@!'
syn keyword rubyRailsFilterMethod before_filter append_before_filter prepend_before_filter after_filter append_after_filter prepend_after_filter around_filter append_around_filter prepend_around_filter skip_before_filter skip_after_filter
syn keyword rubyRailsFilterMethod verify
@@ -3537,13 +3556,15 @@ function! s:BufSyntax()
syn keyword rubyRailsTestControllerMethod assert_response assert_redirected_to assert_template assert_recognizes assert_generates assert_routing assert_dom_equal assert_dom_not_equal assert_select assert_select_rjs assert_select_encoded assert_select_email assert_tag assert_no_tag
endif
elseif buffer.type_name('spec')
- syn keyword rubyRailsTestMethod describe context it its specify it_should_behave_like before after subject fixtures controller_name helper_name
+ syn keyword rubyRailsTestMethod describe context it its specify shared_examples_for it_should_behave_like before after subject fixtures controller_name helper_name
+ syn match rubyRailsTestMethod '\<let\>!\='
syn keyword rubyRailsTestMethod violated pending expect double mock mock_model stub_model
syn match rubyRailsTestMethod '\.\@<!\<stub\>!\@!'
if !buffer.type_name('spec-model')
syn match rubyRailsTestControllerMethod '\.\@<!\<\%(get\|post\|put\|delete\|head\|process\|assigns\)\>'
syn keyword rubyRailsTestControllerMethod integrate_views
syn keyword rubyRailsMethod params request response session flash
+ syn keyword rubyRailsMethod polymorphic_path polymorphic_url
endif
endif
if buffer.type_name('task')
@@ -3589,30 +3610,30 @@ function! s:BufSyntax()
syn cluster htmlArgCluster add=@rubyStringSpecial
syn cluster htmlPreProc add=@rubyStringSpecial
- elseif &syntax == "eruby" || &syntax == "haml"
+ elseif &syntax == 'eruby' || &syntax == 'haml'
syn case match
if classes != ''
- exe "syn keyword erubyRailsUserClass ".classes." contained containedin=@erubyRailsRegions"
+ exe 'syn keyword '.&syntax.'RailsUserClass '.classes.' contained containedin=@'.&syntax.'RailsRegions'
endif
- if &syntax == "haml"
- syn cluster erubyRailsRegions contains=hamlRubyCodeIncluded,hamlRubyCode,hamlRubyHash,@hamlEmbeddedRuby,rubyInterpolation
+ if &syntax == 'haml'
+ exe 'syn cluster hamlRailsRegions contains=hamlRubyCodeIncluded,hamlRubyCode,hamlRubyHash,@hamlEmbeddedRuby,rubyInterpolation'
else
- syn cluster erubyRailsRegions contains=erubyOneLiner,erubyBlock,erubyExpression,rubyInterpolation
+ exe 'syn cluster erubyRailsRegions contains=erubyOneLiner,erubyBlock,erubyExpression,rubyInterpolation'
endif
- exe "syn keyword erubyRailsHelperMethod ".s:gsub(s:helpermethods(),'<%(content_for|select)\s+','')." contained containedin=@erubyRailsRegions"
- syn match erubyRailsHelperMethod '\<select\>\%(\s*{\|\s*do\>\|\s*(\=\s*&\)\@!' contained containedin=@erubyRailsRegions
- syn match erubyRailsHelperMethod '\<\%(content_for?\=\|current_page?\)' contained containedin=@erubyRailsRegions
- syn keyword erubyRailsMethod debugger logger contained containedin=@erubyRailsRegions
- syn keyword erubyRailsMethod params request response session headers cookies flash contained containedin=@erubyRailsRegions
- syn match erubyRailsViewMethod '\.\@<!\<\(h\|html_escape\|u\|url_encode\|controller\)\>' contained containedin=@erubyRailsRegions
+ exe 'syn keyword '.&syntax.'RailsHelperMethod '.s:gsub(s:helpermethods(),'<%(content_for|select)\s+','').' contained containedin=@'.&syntax.'RailsRegions'
+ exe 'syn match '.&syntax.'RailsHelperMethod "\<select\>\%(\s*{\|\s*do\>\|\s*(\=\s*&\)\@!" contained containedin=@'.&syntax.'RailsRegions'
+ exe 'syn match '.&syntax.'RailsHelperMethod "\<\%(content_for?\=\|current_page?\)" contained containedin=@'.&syntax.'RailsRegions'
+ exe 'syn keyword '.&syntax.'RailsMethod debugger logger polymorphic_path polymorphic_url contained containedin=@'.&syntax.'RailsRegions'
+ exe 'syn keyword '.&syntax.'RailsMethod params request response session headers cookies flash contained containedin=@'.&syntax.'RailsRegions'
+ exe 'syn match '.&syntax.'RailsViewMethod "\.\@<!\<\(h\|html_escape\|u\|url_encode\|controller\)\>" contained containedin=@'.&syntax.'RailsRegions'
if buffer.type_name('view-partial')
- syn keyword erubyRailsMethod local_assigns contained containedin=@erubyRailsRegions
+ exe 'syn keyword '.&syntax.'RailsMethod local_assigns contained containedin=@'.&syntax.'RailsRegions'
endif
- syn keyword erubyRailsRenderMethod render contained containedin=@erubyRailsRegions
- syn case match
+ exe 'syn keyword '.&syntax.'RailsRenderMethod render contained containedin=@'.&syntax.'RailsRegions'
+ exe 'syn case match'
set isk+=$
- exe "syn keyword javascriptRailsFunction contained ".s:javascript_functions
- syn cluster htmlJavaScript add=javascriptRailsFunction
+ exe 'syn keyword javascriptRailsFunction contained '.s:javascript_functions
+ exe 'syn cluster htmlJavaScript add=javascriptRailsFunction'
elseif &syntax == "yaml"
syn case match
" Modeled after syntax/eruby.vim
@@ -3635,7 +3656,7 @@ function! s:BufSyntax()
set isk+=$
exe "syn keyword javascriptRailsFunction contained ".s:javascript_functions
syn cluster htmlJavaScript add=javascriptRailsFunction
- elseif &syntax == "javascript"
+ elseif &syntax == "javascript" || &syntax == "coffee"
" The syntax file included with Vim incorrectly sets syn case ignore.
syn case match
set isk+=$
@@ -3671,8 +3692,14 @@ function! s:HiDefaults()
hi def link erubyRailsRenderMethod erubyRailsMethod
hi def link erubyRailsMethod railsMethod
hi def link erubyRailsUserMethod railsUserMethod
- hi def link railsUserMethod railsMethod
hi def link erubyRailsUserClass railsUserClass
+ hi def link hamlRailsHelperMethod hamlRailsMethod
+ hi def link hamlRailsViewMethod hamlRailsMethod
+ hi def link hamlRailsRenderMethod hamlRailsMethod
+ hi def link hamlRailsMethod railsMethod
+ hi def link hamlRailsUserMethod railsUserMethod
+ hi def link hamlRailsUserClass railsUserClass
+ hi def link railsUserMethod railsMethod
hi def link yamlRailsDelimiter Delimiter
hi def link yamlRailsMethod railsMethod
hi def link yamlRailsComment Comment
@@ -3688,16 +3715,25 @@ function! s:HiDefaults()
endfunction
function! rails#log_syntax()
- syn match railslogRender '^\s*\<\%(Processing\|Rendering\|Rendered\|Redirected\|Completed\)\>'
+ if has('conceal')
+ syn match railslogEscape '\e\[[0-9;]*m' conceal
+ syn match railslogEscapeMN '\e\[[0-9;]*m' conceal nextgroup=railslogModelNum,railslogEscapeMN skipwhite contained
+ syn match railslogEscapeSQL '\e\[[0-9;]*m' conceal nextgroup=railslogSQL,railslogEscapeSQL skipwhite contained
+ else
+ syn match railslogEscape '\e\[[0-9;]*m'
+ syn match railslogEscapeMN '\e\[[0-9;]*m' nextgroup=railslogModelNum,railslogEscapeMN skipwhite contained
+ syn match railslogEscapeSQL '\e\[[0-9;]*m' nextgroup=railslogSQL,railslogEscapeSQL skipwhite contained
+ endif
+ syn match railslogRender '\%(^\s*\%(\e\[[0-9;]*m\)\=\)\@<=\%(Processing\|Rendering\|Rendered\|Redirected\|Completed\)\>'
syn match railslogComment '^\s*# .*'
- syn match railslogModel '^\s*\u\%(\w\|:\)* \%(Load\%( Including Associations\| IDs For Limited Eager Loading\)\=\|Columns\|Count\|Create\|Update\|Destroy\|Delete all\)\>' skipwhite nextgroup=railslogModelNum
- syn match railslogModel '^\s*SQL\>' skipwhite nextgroup=railslogModelNum
- syn region railslogModelNum start='(' end=')' contains=railslogNumber contained skipwhite nextgroup=railslogSQL
- syn match railslogSQL '\u.*$' contained
+ syn match railslogModel '\%(^\s*\%(\e\[[0-9;]*m\)\=\)\@<=\u\%(\w\|:\)* \%(Load\%( Including Associations\| IDs For Limited Eager Loading\)\=\|Columns\|Count\|Create\|Update\|Destroy\|Delete all\)\>' skipwhite nextgroup=railslogModelNum,railslogEscapeMN
+ syn match railslogModel '\%(^\s*\%(\e\[[0-9;]*m\)\=\)\@<=SQL\>' skipwhite nextgroup=railslogModelNum,railslogEscapeMN
+ syn region railslogModelNum start='(' end=')' contains=railslogNumber contained skipwhite nextgroup=railslogSQL,railslogEscapeSQL
+ syn match railslogSQL '\u[^\e]*' contained
" Destroy generates multiline SQL, ugh
- syn match railslogSQL '^ \%(FROM\|WHERE\|ON\|AND\|OR\|ORDER\) .*$'
+ syn match railslogSQL '\%(^ \%(\e\[[0-9;]*m\)\=\)\@<=\%(FROM\|WHERE\|ON\|AND\|OR\|ORDER\) .*$'
syn match railslogNumber '\<\d\+\>%'
- syn match railslogNumber '[ (]\@<=\<\d\+\.\d\+\>'
+ syn match railslogNumber '[ (]\@<=\<\d\+\.\d\+\>\.\@!'
syn region railslogString start='"' skip='\\"' end='"' oneline contained
syn region railslogHash start='{' end='}' oneline contains=railslogHash,railslogString
syn match railslogIP '\<\d\{1,3\}\%(\.\d\{1,3}\)\{3\}\>'
@@ -3710,6 +3746,9 @@ function! rails#log_syntax()
syn match railslogError '^DEPRECATION WARNING\>'
syn keyword railslogHTTP OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT
syn region railslogStackTrace start=":\d\+:in `\w\+'$" end="^\s*$" keepend fold
+ hi def link railslogEscapeMN railslogEscape
+ hi def link railslogEscapeSQL railslogEscape
+ hi def link railslogEscape Ignore
hi def link railslogComment Comment
hi def link railslogRender Keyword
hi def link railslogModel Type
@@ -3746,7 +3785,7 @@ function! s:BufInitStatusline()
if &l:statusline == ''
let &l:statusline='%<%f %h%m%r%='
if &ruler
- let &l:statusline .= '%-16( %l,%c-%v %)%P'
+ let &l:statusline .= '%-14.(%l,%c%V%) %P'
endif
endif
let &l:statusline = s:InjectIntoStatusline(&l:statusline)
@@ -3969,7 +4008,7 @@ function! s:app_dbext_settings(environment) dict
let cmde = '}]; i=0; e=y[e] while e.respond_to?(:to_str) && (i+=1)<16; e.each{|k,v|puts k.to_s+%{=}+v.to_s}}'
let out = self.lightweight_ruby_eval(cmdb.a:environment.cmde)
let adapter = s:extractdbvar(out,'adapter')
- let adapter = get({'postgresql': 'pgsql', 'sqlite3': 'sqlite', 'sqlserver': 'sqlsrv', 'sybase': 'asa', 'oci': 'ora'},adapter,adapter)
+ let adapter = get({'mysql2': 'mysql', 'postgresql': 'pgsql', 'sqlite3': 'sqlite', 'sqlserver': 'sqlsrv', 'sybase': 'asa', 'oci': 'ora'},adapter,adapter)
let dict['type'] = toupper(adapter)
let dict['user'] = s:extractdbvar(out,'username')
let dict['passwd'] = s:extractdbvar(out,'password')
@@ -4113,7 +4152,7 @@ function! s:BufAbbreviations()
Rabbrev rs[ response
Rabbrev se[ session
Rabbrev hd[ headers
- Rabbrev co[ cookies
+ Rabbrev coo[ cookies
Rabbrev fl[ flash
Rabbrev rr( render
Rabbrev ra( render :action\ =>\
@@ -4473,7 +4512,7 @@ function! RailsBufInit(path)
setlocal filetype=eruby
elseif &ft =~ '^\%(conf\|ruby\)\=$' && expand("%:e") =~ '^\%(rjs\|rxml\|builder\|rake\|mab\)$'
setlocal filetype=ruby
- elseif &ft =~ '^\%(conf\|ruby\)\=$' && expand("%:t") =~ '^\%(Rake\|Gem\|Cap\)file$'
+ elseif &ft =~ '^\%(conf\|ruby\)\=$' && expand("%:t") =~ '^\%(\%(Rake\|Gem\|Cap\)file\|Isolate\)$'
setlocal filetype=ruby
elseif &ft =~ '^\%(liquid\)\=$' && expand("%:e") == "liquid"
setlocal filetype=liquid
@@ -4481,6 +4520,8 @@ function! RailsBufInit(path)
setlocal filetype=haml
elseif &ft =~ '^\%(sass\|conf\)\=$' && expand("%:e") == "sass"
setlocal filetype=sass
+ elseif &ft =~ '^\%(scss\|conf\)\=$' && expand("%:e") == "scss"
+ setlocal filetype=scss
elseif &ft =~ '^\%(lesscss\|conf\)\=$' && expand("%:e") == "less"
setlocal filetype=lesscss
elseif &ft =~ '^\%(dryml\)\=$' && expand("%:e") == "dryml"
@@ -4498,13 +4539,17 @@ function! RailsBufInit(path)
if firsttime
call s:BufInitStatusline()
endif
- if expand("%:e") == "log"
- setlocal modifiable filetype=railslog
- silent! %s/\%(\e\[[0-9;]*m\|\r$\)//g
- setlocal readonly nomodifiable noswapfile autoread foldmethod=syntax
+ if expand('%:e') == 'log'
nnoremap <buffer> <silent> R :checktime<CR>
nnoremap <buffer> <silent> G :checktime<Bar>$<CR>
nnoremap <buffer> <silent> q :bwipe<CR>
+ setlocal modifiable filetype=railslog noswapfile autoread foldmethod=syntax
+ if exists('+concealcursor')
+ setlocal concealcursor=nc conceallevel=2
+ else
+ silent %s/\%(\e\[[0-9;]*m\|\r$\)//ge
+ endif
+ setlocal readonly nomodifiable
$
endif
call s:BufSettings()
@@ -4554,7 +4599,7 @@ function! s:SetBasePath()
let path += ['test', 'test/unit', 'test/functional', 'test/integration']
endif
if self.app().has('spec')
- let path += ['spec', 'spec/models', 'spec/controllers', 'spec/helpers', 'spec/views', 'spec/lib', 'spec/integration']
+ let path += ['spec', 'spec/models', 'spec/controllers', 'spec/helpers', 'spec/views', 'spec/lib', 'spec/requests', 'spec/integration']
endif
let path += ['app/*', 'vendor', 'vendor/plugins/*/lib', 'vendor/plugins/*/test', 'vendor/rails/*/lib', 'vendor/rails/*/test']
call map(path,'self.app().path(v:val)')
@@ -4568,8 +4613,8 @@ function! s:BufSettings()
let self = rails#buffer()
call s:SetBasePath()
let rp = s:gsub(self.app().path(),'[ ,]','\\&')
- if stridx(&tags,rp) == -1
- let &l:tags = rp . "/tmp/tags," . &tags . "," . rp . "/tags"
+ if stridx(&tags,rp.'/tmp/tags') == -1
+ let &l:tags = rp . '/tmp/tags,' . &tags . ',' . rp . '/tags'
endif
if has("gui_win32") || has("gui_running")
let code = '*.rb;*.rake;Rakefile'
@@ -4587,7 +4632,7 @@ function! s:BufSettings()
call self.setvar('&includeexpr','RailsIncludeexpr()')
call self.setvar('&suffixesadd', ".rb,.".s:gsub(s:view_types,',',',.').",.css,.js,.yml,.csv,.rake,.sql,.html,.xml")
let ft = self.getvar('&filetype')
- if ft =~ '^\%(e\=ruby\|[yh]aml\|javascript\|css\|sass\|lesscss\)$'
+ if ft =~ '^\%(e\=ruby\|[yh]aml\|javascript\|css\|s[ac]ss\|lesscss\)$'
call self.setvar('&shiftwidth',2)
call self.setvar('&softtabstop',2)
call self.setvar('&expandtab',1)
@@ -4675,7 +4720,7 @@ augroup railsPluginAuto
autocmd BufWritePost */tasks/**.rake call rails#cache_clear("rake_tasks")
autocmd BufWritePost */generators/** call rails#cache_clear("generators")
autocmd FileType * if exists("b:rails_root") | call s:BufSettings() | endif
- autocmd Syntax ruby,eruby,yaml,haml,javascript,railslog if exists("b:rails_root") | call s:BufSyntax() | endif
+ autocmd Syntax ruby,eruby,yaml,haml,javascript,coffee,railslog if exists("b:rails_root") | call s:BufSyntax() | endif
autocmd QuickFixCmdPre make* call s:push_chdir()
autocmd QuickFixCmdPost make* call s:pop_command()
augroup END
View
29 compiler/cucumber.vim
@@ -0,0 +1,29 @@
+" Vim compiler file
+" Compiler: Cucumber
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 Aug 09
+
+if exists("current_compiler")
+ finish
+endif
+let current_compiler = "cucumber"
+
+if exists(":CompilerSet") != 2 " older Vim always used :setlocal
+ command -nargs=* CompilerSet setlocal <args>
+endif
+
+let s:cpo_save = &cpo
+set cpo-=C
+
+CompilerSet makeprg=cucumber
+
+CompilerSet errorformat=
+ \%W%m\ (Cucumber::Undefined),
+ \%E%m\ (%.%#),
+ \%Z%f:%l,
+ \%Z%f:%l:%.%#
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2:
View
226 doc/fugitive.txt
@@ -0,0 +1,226 @@
+*fugitive.txt* A Git wrapper so awesome, it should be illegal
+
+Author: Tim Pope <vimNOSPAM@tpope.org> *fugitive-author*
+License: Same terms as Vim itself (see |license|)
+
+This plugin is only available if 'compatible' is not set.
+
+INTRODUCTION *fugitive*
+
+Install in ~/.vim, or in ~\vimfiles if you're on Windows and feeling lucky.
+Vim 7.2 is recommended as it ships with syntax highlighting for many Git file
+types.
+
+If you're in a hurry to get started, here are some things to try:
+
+In any file in your repository, run |:Gedit| HEAD. Press <CR> to jump to the
+current branch. Press <CR> again to jump to the top most commit. Keep using
+<CR> to explore parent commits, trees, and blobs. Use C in a tree or blob to
+get back to the commit.
+
+Edit a file in the work tree and make some changes. Use |:Gdiff| to open up
+the indexed version. Use |do| and |dp| on various hunks to bring the files in
+sync, or use |:Gread| to pull in all changes. Write the indexed version to
+stage the file.
+
+Run |:Gstatus| to check your repository's status. Use "-" to stage and reset
+files and "p" to add/reset --patch them. Invoke |:Gcommit| to commit your
+changes.
+
+Run |:Gblame| in a work tree file to see a blame in a vertical split. Press
+<CR> on any line to reopen and reblame that file as it stood in that commit.
+Press o or O on any line to inspect that commit in a split or a tab.
+
+Run |:Ggrep| to search the work tree or history. Run |:Gmove| to rename a
+file. Run |:Gremove| to delete a file.
+
+COMMANDS *fugitive-commands*
+
+These commands are local to the buffers in which they work (generally, buffers
+that are part of Git repositories).
+
+ *fugitive-:Git*
+:Git [args] Run an arbitrary git command. Similar to :!git [args]
+ but chdir to the repository tree first.
+
+ *fugitive-:Gcd*
+:Gcd [directory] |:cd| relative to the repository.
+
+ *fugitive-:Glcd*
+:Glcd [directory] |:lcd| relative to the repository.
+
+ *fugitive-:Gstatus*
+:Gstatus Bring up the output of git-status in the preview
+ window. In addition to standard motions, you can
+ use <C-N> and <C-P> to jump from filename to
+ filename. Press D to |:Gdiff| the file on the cursor
+ line, or dh to |:Gdiff!|. Press - to stage or unstage
+ the file on the cursor line. Press p to do so on a
+ per hunk basis (--patch). Press C to invoke
+ |:Gcommit|.
+
+ *fugitive-:Gcommit*
+:Gcommit [args] A wrapper around git-commit. If there is nothing
+ to commit, |:Gstatus| is called instead. Unless the
+ arguments given would skip the invocation of an editor
+ (e.g., -m), a split window will be used to obtain a
+ commit message. Write and close that window (:wq or
+ |:Gwrite|) to finish the commit. Unlike when running
+ the actual git-commit command, it is possible (but
+ unadvisable) to muck with the index with commands like
+ git-add and git-reset while a commit message is
+ pending.
+
+ *fugitive-:Ggrep*
+:Ggrep [args] |:grep| with git-grep as 'grepprg'.
+
+ *fugitive-:Glog*
+:Glog [args] Load all previous revisions of the current file into
+ the quickfix list. Additional git-log arguments can
+ be given (for example, --reverse). If "--" appears as
+ an argument, no file specific filtering is done, and
+ commits are loaded into the quickfix list.
+
+ *fugitive-:Gedit* *fugitive-:Ge*
+:Gedit [revision] |:edit| a |fugitive-revision|.
+
+ *fugitive-:Gsplit*
+:Gsplit [revision] |:split| a |fugitive-revision|.
+
+ *fugitive-:Gvsplit*
+:Gvsplit [revision] |:vsplit| a |fugitive-revision|.
+
+ *fugitive-:Gtabedit*
+:Gtabedit [revision] |:tabedit| a |fugitive-revision|
+
+ *fugitive-:Gpedit*
+:Gpedit [revision] |:pedit| a |fugitive-revision|
+
+ *fugitive-:Gread*
+:Gread [revision] Empty the buffer and |:read| a |fugitive-revision|.
+ When the argument is omitted, this is similar to
+ git-checkout on a work tree file or git-add on a stage
+ file, but without writing anything to disk.
+
+:{range}Gread [revision]
+ |:read| in a |fugitive-revision| after {range}.
+
+ *fugitive-:Gread!*
+:Gread! [revision] Deprecated synonym for |:Gread|.
+
+ *fugitive-:Gwrite*
+:Gwrite Write to the current file's path and stage the results.
+ When run in a work tree file, it is effectively git
+ add. Elsewhere, it is effectively git-checkout. A
+ great deal of effort is expended to behave sensibly
+ when the work tree or index version of the file is
+ open in another buffer.
+
+:Gwrite {path} You can give |:Gwrite| an explicit path of where in
+ the work tree to write. You can also give a path like
+ :0:foo.txt or even :0 to write to just that stage in
+ the index.
+
+ *fugitive-:Gdiff*
+:Gdiff [revision] Perform a |vimdiff| against the current file in the
+ given revision. With no argument, the version in the
+ index is used (which means a three-way diff during a
+ merge conflict, making it a git-mergetool
+ alternative). The newer of the two files is placed
+ to the right. Use |do| and |dp| and write to the
+ index file to simulate "git add --patch".
+
+ *fugitive-:Gdiff!*
+:Gdiff! [revision] Like |:Gdiff|, but split horizontally.
+
+ *fugitive-:Gmove*
+:Gmove {destination} Wrapper around git-mv that renames the buffer
+ afterward. The destination is relative to the current
+ directory except when started with a /, in which case
+ it is relative to the work tree. Add a ! to pass -f.
+
+ *fugitive-:Gremove*
+:Gremove Wrapper around git-rm that deletes the buffer
+ afterward. When invoked in an index file, --cached is
+ passed. Add a ! to pass -f and forcefully discard the
+ buffer.
+
+ *fugitive-:Gblame*
+:Gblame [flags] Run git-blame on the file and open the results in a
+ scroll bound vertical split. Press enter on a line to
+ reblame the file as it was in that commit. You can
+ give any of ltwfsMC as flags and they will be passed
+ along to git-blame.
+
+:[range]Gblame [flags] Run git-blame on the given range.
+
+MAPPINGS *fugitive-mappings*
+
+These maps are available in Git objects.
+
+ *fugitive-<CR>*
+<CR> Jump to the revision under the cursor.
+
+ *fugitive-o*
+o Jump to the revision under the cursor in a new split.
+
+ *fugitive-O*
+O Jump to the revision under the cursor in a new tab.
+
+ *fugitive-~*
+~ Go to the current file in the [count]th first
+ ancestor.
+
+ *fugitive-P*
+P Go to the current file in the [count]th parent.
+
+ *fugitive-C*
+C Go to the commit containing the current file.
+
+ *fugitive-a*
+a Show the current tag, commit, or tree in an alternate
+ format.
+
+SPECIFYING REVISIONS *fugitive-revision*
+
+Fugitive revisions are similar to Git revisions as defined in the "SPECIFYING
+REVISIONS" section in the git-rev-parse man page. For commands that accept an
+optional revision, the default is the file in the index for work tree files
+and the work tree file for everything else. Example revisions follow.
+
+Revision Meaning ~
+HEAD .git/HEAD
+master .git/refs/heads/master
+HEAD^{} The commit referenced by HEAD
+HEAD^ The parent of the commit referenced by HEAD
+HEAD: The tree referenced by HEAD
+/HEAD The file named HEAD in the work tree
+Makefile The file named Makefile in the work tree
+HEAD^:Makefile The file named Makefile in the parent of HEAD
+:Makefile The file named Makefile in the index (writable)
+- The current file in HEAD
+^ The current file in the previous commit
+~3 The current file 3 commits ago
+: .git/index (Same as |:Gstatus|)
+:0 The current file in the index
+:1 The current file's common ancestor during a conflict
+:2 The current file in the target branch during a conflict
+:3 The current file in the merged branch during a conflict
+:/foo The most recent commit with "foo" in the message
+
+STATUSLINE *fugitive-statusline*
+
+ *fugitive#statusline()*
+Add %{fugitive#statusline()} to your statusline to get an indicator including
+the current branch and the currently edited file's commit. If you don't have
+a statusline, this one matches the default when 'ruler' is set:
+>
+ set statusline=%<%f\ %h%m%r%{fugitive#statusline()}%=%-14.(%l,%c%V%)\ %P
+<
+ABOUT *fugitive-about*
+
+Grab the latest version or report a bug on GitHub:
+
+http://github.com/tpope/vim-fugitive
+
+ vim:tw=78:et:ft=help:norl:
View
28 doc/rails.txt
@@ -66,9 +66,9 @@ Rails application development.
fixtures, and more. |rails-rake|
6. Interface to script/*. Generally, use ":Rscript about" to call
- "script/about". Most commands have wrappers with additional features:
- ":Rgenerate controller Blog" generates a blog controller and edits
- app/controllers/blog_controller.rb. |rails-scripts|
+ "script/about" or "script/rails about". Most commands have wrappers with
+ additional features: ":Rgenerate controller Blog" generates a blog
+ controller and edits app/controllers/blog_controller.rb. |rails-scripts|
7. Partial extraction and migration inversion. |:Rextract| {file} replaces
the desired range (ideally selected in visual line mode) with "render
@@ -314,7 +314,6 @@ Suggestions for further contexts to consider for the alternate file, related
file, and file under the cursor are welcome. They are subtly tweaked from
release to release.
-
File Type Navigation Commands ~
*rails-type-navigation*
For the less common cases, a more deliberate set of commands are provided.
@@ -395,8 +394,9 @@ itself!).
defaults to editing test/test_helper.rb.
*rails-:Rjavascript*
-:Rjavascript [{name}] Edit the javascript for the specified name or current
- controller.
+:Rjavascript [{name}] Edit the JavaScript for the specified name or current
+ controller. Also supports CoffeeScript in
+ app/scripts/.
*rails-:Rlayout*
:Rlayout [{name}] Edit the specified layout. Defaults to the layout for
@@ -461,7 +461,7 @@ itself!).
*rails-:Rstylesheet*
:Rstylesheet [{name}] Edit the stylesheet for the specified name or current
- controller.
+ controller. Also supports Sass and SCSS.
*rails-:Rtask*
:Rtask [{name}] Edit the .rake file from lib/tasks for the specified
@@ -525,9 +525,10 @@ Rake integration happens through the :Rake command.
*rails-:Rake*
:[range]Rake {targets} Calls |:make!| {targets} (with 'makeprg' being rake)
and opens the quickfix window if there were any
- errors. If {targets} are omitted, :Rake defaults to
- something sensible as described below. Giving a line
- number argument may affect that default.
+ errors. An argument of "-" reruns the last task. If
+ {targets} are omitted, :Rake defaults to something
+ sensible as described below. Giving a line number
+ argument may affect that default.
*rails-:Rake!*
:[range]Rake! {targets} Called with a bang, :Rake will forgo opening the
@@ -1031,10 +1032,9 @@ Set this include guard to prevent the plugin from being loaded.
Enable Rails abbreviations. See |rails-abbreviations|. Enabled by default.
*g:rails_ctags_arguments* >
- let g:rails_ctags_arguments='--exclude="*.js"'
-Additional arguments to pass to ctags from |:Rtags|. Defaults to
-'--exclude=facebox.js --exclude="*.*.js"', which attempts to ignore jQuery
-plugins that can choke up ctags.
+ let g:rails_ctags_arguments='--languages=-javascript'
+Additional arguments to pass to ctags from |:Rtags|. Defaults to ignoring
+JavaScript files, since ctags has a tendency to choke on those.
*g:rails_default_file* >
let g:rails_default_file='config/database.yml'
View
44 doc/surround.txt
@@ -28,9 +28,9 @@ Vim 7 is recommended for full functionality.
MAPPINGS *surround-mappings*
Delete surroundings is *ds* . The next character given determines the target
-to delete. The exact nature of the target are explained in |surround-targets|
+to delete. The exact nature of the target is explained in |surround-targets|
but essentially it is the last character of a |text-object|. This mapping
-deletes the difference between the "inner" object and "an" object. This is
+deletes the difference between the "i"nner object and "a"n object. This is
easiest to understand with some examples:
Old text Command New text ~
@@ -49,9 +49,9 @@ below in |surround-replacements|. Once again, examples are in order.
(123+4*56)/2 cs)[ [ 123+456 ]/2
<div>Yo!*</div> cst<p> <p>Yo!</p>
-*ys* takes an valid Vim motion or text object as the first object, and wraps
-it using the second argument as with |cs|. (Unfortunately there's no good
-mnemonic for "ys".)
+*ys* takes a valid Vim motion or text object as the first object, and wraps
+it using the second argument as with |cs|. (It's a stretch, but a good
+mnemonic for "ys" is "you surround".)
Old text Command New text ~
Hello w*orld! ysiw) Hello (world)!
@@ -66,22 +66,26 @@ There is also *yS* and *ySS* which indent the surrounded text and place it
on a line of its own.
In visual mode, a simple "s" with an argument wraps the selection. This is
-referred to as the *vs* mapping, although ordinarily there will be
+referred to as the *vS* mapping, although ordinarily there will be
additional keystrokes between the v and s. In linewise visual mode, the
-surroundings are placed on separate lines. In blockwise visual mode, each
-line is surrounded.
-
-An "S" in visual mode (*vS*) behaves similarly but always places the
-surroundings on separate lines. Additionally, the surrounded text is
-indented. In blockwise visual mode, using "S" instead of "s" instead skips
-trailing whitespace.
-
-Note that "s" and "S" already have valid meaning in visual mode, but it is
-identical to "c". If you have muscle memory for "s" and would like to use a
-different key, add your own mapping and the existing one will be disabled.
+surroundings are placed on separate lines and indented. In blockwise visual
+mode, each line is surrounded.
+
+A "gS" in visual mode, known as *vgS* , behaves similarly. In linewise visual
+mode, the automatic indenting is surpressed. In blockwise visual mode, this
+enables surrounding past the end of the like with 'virtualedit' set (there
+seems to be no way in Vim Script to differentiate between a jagged end of line
+selection and a virtual block selected past the end of the line, so two maps
+were needed).
+
+Additionally, there is a legacy "s" or *vs* mapping which is basically the
+same as |vS|. Due to popular demand of wanting to use "s" as Vim does to mean
+replacing the selection (also available as "c"), this mapping is going away.
+If you were one of these people and would like to disable "s" with the current
+release, indicate this to surround.vim by assigning the "s" mapping to
+something else.
>
- vmap <Leader>s <Plug>Vsurround
- vmap <Leader>S <Plug>VSurround
+ xmap <Leader>s <Plug>Vsurround
<
*i_CTRL-G_s* *i_CTRL-G_S*
Finally, there is an experimental insert mode mapping on <C-G>s and <C-S>.
@@ -101,7 +105,7 @@ supported in the version of Vim used (Vim 7 adds several text objects, and
thus is highly recommended). All targets are currently just one character.
Eight punctuation marks, (, ), {, }, [, ], <, and >, represent themselves
-and their counterpart. If the opening mark is used, contained whitespace is
+and their counterparts. If the opening mark is used, contained whitespace is
also trimmed. The targets b, B, r, and a are aliases for ), }, ], and >
(the first two mirror Vim; the second two are completely arbitrary and
subject to change).
View
1 ftdetect/haml.vim
@@ -1,2 +1,3 @@
autocmd BufNewFile,BufRead *.haml setf haml
autocmd BufNewFile,BufRead *.sass setf sass
+autocmd BufNewFile,BufRead *.scss setf scss
View
21 ftplugin/cucumber.vim
@@ -1,6 +1,7 @@
" Vim filetype plugin
" Language: Cucumber
-" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 Aug 09
" Only do this when not done yet for this buffer
if (exists("b:did_ftplugin"))
@@ -25,7 +26,7 @@ if !exists("g:no_plugin_maps") && !exists("g:no_cucumber_maps")
endif
function! s:jump(command,count)
- let steps = s:steps(getline('.'))
+ let steps = s:steps('.')
if len(steps) == 0 || len(steps) < a:count
return 'echoerr "No matching step found"'
elseif len(steps) > 1 && !a:count
@@ -37,7 +38,7 @@ function! s:jump(command,count)
endfunction
function! s:allsteps()
- let step_pattern = '\C^\s*\%(Giv\|[WT]h\)en\>\s*\zs.\{-\}\ze\s*\%(do\|{\)\s*\%(|[A-Za-z0-9_,() *]*|\s*\)\=$'
+ let step_pattern = '\C^\s*\K\k*\>\s*\zs\S.\{-\}\ze\s*\%(do\|{\)\s*\%(|[^|]*|\s*\)\=\%($\|#\)'
let steps = []
for file in split(glob(b:cucumber_root.'/**/*.rb'),"\n")
let lines = readfile(file)
@@ -53,8 +54,12 @@ function! s:allsteps()
return steps
endfunction
-function! s:steps(step)
- let step = matchstr(a:step,'^\s*\k*\s*\zs.\{-\}\s*$')
+function! s:steps(lnum)
+ let c = indent(a:lnum) + 1
+ while synIDattr(synID(a:lnum,c,1),'name') !~# '^$\|Region$'
+ let c = c + 1
+ endwhile
+ let step = matchstr(getline(a:lnum)[c-1 : -1],'^\s*\zs.\{-\}\ze\s*$')
return filter(s:allsteps(),'s:stepmatch(v:val[3],step)')
endfunction
@@ -75,7 +80,7 @@ function! s:stepmatch(receiver,target)
endif
catch
endtry
- if has("ruby")
+ if has("ruby") && pattern !~ '\\\@<!#{'
ruby VIM.command("return #{if (begin; Kernel.eval('/'+VIM.evaluate('pattern')+'/'); rescue SyntaxError; end) === VIM.evaluate('a:target') then 1 else 0 end}")
else
return 0
@@ -104,10 +109,12 @@ function! CucumberComplete(findstart,base) abort
let steps += [step[3][1:-2]]
elseif step[3] =~ '^/\^.*\$/$'
let pattern = step[3][2:-3]
+ let pattern = substitute(pattern,'\C^(?:|I )','I ','')
let pattern = s:bsub(pattern,'\\[Sw]','w')
let pattern = s:bsub(pattern,'\\d','1')
let pattern = s:bsub(pattern,'\\[sWD]',' ')
- let pattern = s:bsub(pattern,'[[:alnum:]. -][?*]?\=','')
+ let pattern = s:bsub(pattern,'\[\^\\\="\]','_')
+ let pattern = s:bsub(pattern,'[[:alnum:]. _-][?*]?\=','')
let pattern = s:bsub(pattern,'\[\([^^]\).\{-\}\]','\1')
let pattern = s:bsub(pattern,'+?\=','')
let pattern = s:bsub(pattern,'(\([[:alnum:]. -]\{-\}\))','\1')
View
7 ftplugin/haml.vim
@@ -1,6 +1,7 @@
" Vim filetype plugin
-" Language: Haml
-" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
+" Language: Haml
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 May 21
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -56,7 +57,7 @@ if exists("loaded_matchit")
let b:match_words = s:match_words
endif
-setlocal commentstring=-#\ %s
+setlocal comments= commentstring=-#\ %s
let b:undo_ftplugin = "setl cms< com< "
\ " | unlet! b:browsefilter b:match_words | " . s:undo_ftplugin
View
12 ftplugin/sass.vim
@@ -1,6 +1,7 @@
" Vim filetype plugin
-" Language: Sass
-" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
+" Language: Sass
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 Jul 26
" Only do this when not done yet for this buffer
if exists("b:did_ftplugin")
@@ -8,11 +9,14 @@ if exists("b:did_ftplugin")
endif
let b:did_ftplugin = 1
-let b:undo_ftplugin = "setl cms< inc< ofu<"
+let b:undo_ftplugin = "setl cms< def< inc< inex< ofu< sua<"
setlocal commentstring=//\ %s
+setlocal define=^\\s*\\%(@mixin\\\|=\\)
+setlocal includeexpr=substitute(v:fname,'\\%(.*/\\\|^\\)\\zs','_','')
setlocal omnifunc=csscomplete#CompleteCSS
+setlocal suffixesadd=.sass,.scss,.css
-let &l:include = '^\s*@import\s\+\%(url(\)\='
+let &l:include = '^\s*@import\s\+\%(url(\)\=["'']\='
" vim:set sw=2:
View
12 ftplugin/scss.vim
@@ -0,0 +1,12 @@
+" Vim filetype plugin
+" Language: SCSS
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 Jul 26
+
+if exists("b:did_ftplugin")
+ finish
+endif
+
+runtime! ftplugin/sass.vim
+
+" vim:set sw=2:
View
38 indent/cucumber.vim
@@ -1,6 +1,7 @@
" Vim indent file
" Language: Cucumber
-" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 May 21
if exists("b:did_indent")
finish
@@ -16,25 +17,44 @@ if exists("*GetCucumberIndent")
finish
endif
+function! s:syn(lnum)
+ return synIDattr(synID(a:lnum,1+indent(a:lnum),1),'name')
+endfunction
+
function! GetCucumberIndent()
let line = getline(prevnonblank(v:lnum-1))
let cline = getline(v:lnum)
- if cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
- return &sw
- elseif cline =~# '^\s*\%(Examples\|Scenarios\):'
- return 2 * &sw
- elseif line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ let syn = s:syn(prevnonblank(v:lnum-1))
+ let csyn = s:syn(v:lnum)
+ if csyn ==# 'cucumberFeature' || cline =~# '^\s*Feature:'
+ return 0
+ elseif csyn ==# 'cucumberExamples' || cline =~# '^\s*\%(Examples\|Scenarios\):'
return 2 * &sw
- elseif line =~# '^\s*\%(Examples\|Scenarios\):'
+ elseif csyn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || cline =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ return &sw
+ elseif syn ==# 'cucumberFeature' || line =~# '^\s*Feature:'
+ return &sw
+ elseif syn ==# 'cucumberExamples' || line =~# '^\s*\%(Examples\|Scenarios\):'
return 3 * &sw
+ elseif syn =~# '^cucumber\%(Background\|Scenario\|ScenarioOutline\)$' || line =~# '^\s*\%(Background\|Scenario\|Scenario Outline\):'
+ return 2 * &sw
+ elseif cline =~# '^\s*@' && (s:syn(nextnonblank(v:lnum+1)) == 'cucumberFeature' || getline(nextnonblank(v:lnum+1)) =~# '^\s*Feature:' || indent(prevnonblank(v:lnum-1)) <= 0)
+ return 0
+ elseif line =~# '^\s*@'
+ return &sw
elseif cline =~# '^\s*|' && line =~# '^\s*|'
return indent(prevnonblank(v:lnum-1))
elseif cline =~# '^\s*|' && line =~# '^\s*[^|#]'
return indent(prevnonblank(v:lnum-1)) + &sw
- elseif cline =~# '^\s*[^|#]' && line =~# '^\s*|'
+ elseif cline =~# '^\s*[^|# \t]' && line =~# '^\s*|'
return indent(prevnonblank(v:lnum-1)) - &sw
+ elseif cline =~# '^\s*$' && line =~# '^\s*|'
+ let in = indent(prevnonblank(v:lnum-1))
+ return in == indent(v:lnum) ? in : in - &sw
+ elseif cline =~# '^\s*#' && getline(v:lnum-1) =~ '^\s*$' && getline(v:lnum+1) =~# '\S'
+ return indent(getline(v:lnum+1))
endif
- return -1
+ return indent(prevnonblank(v:lnum-1))
endfunction
" vim:set sts=2 sw=2:
View
14 indent/haml.vim
@@ -1,7 +1,7 @@
" Vim indent file
-" Language: HAML
-" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
-" Last Change: 2008 Sep 11
+" Language: Haml
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 May 21
if exists("b:did_indent")
finish
@@ -44,8 +44,6 @@ function! GetHamlIndent()
if indent == indent(lnum)
let indent = cindent <= indent ? -1 : increase
endif
- "let indent = indent == indent(lnum) ? -1 : indent
- "let indent = indent > indent(lnum) + &sw ? indent(lnum) + &sw : indent
let group = synIDattr(synID(lnum,lastcol,1),'name')
@@ -53,9 +51,11 @@ function! GetHamlIndent()
return indent
elseif line =~ '^/\%(\[[^]]*\]\)\=$'
return increase
- elseif line =~ '^:'
+ elseif group == 'hamlFilter'
return increase
- elseif line =~ '^'.s:tag.'[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
+ elseif line =~ '^'.s:tag.'[&!]\=[=~-]\s*\%(\%(if\|else\|elsif\|unless\|case\|when\|while\|until\|for\|begin\|module\|class\|def\)\>\%(.*\<end\>\)\@!\|.*do\%(\s*|[^|]*|\)\=\s*$\)'
+ return increase
+ elseif line =~ '^'.s:tag.'[&!]\=[=~-].*,\s*$'
return increase
elseif line == '-#'
return increase
View
8 indent/sass.vim
@@ -1,7 +1,7 @@
" Vim indent file
-" Language: SASS
-" Maintainer: Tim Pope <vimNOSPAM@tpope.info>
-" Last Change: 2007 Dec 16
+" Language: Sass
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 May 21
if exists("b:did_indent")
finish
@@ -17,7 +17,7 @@ if exists("*GetSassIndent")
finish
endif
-let s:property = '^\s*:\|^\s*[[:alnum:]-]\+:'
+let s:property = '^\s*:\|^\s*[[:alnum:]-]\+\%(:\|\s*=\)'
function! GetSassIndent()
let lnum = prevnonblank(v:lnum-1)
View
12 indent/scss.vim
@@ -0,0 +1,12 @@
+" Vim indent file
+" Language: SCSS
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Last Change: 2010 Jul 26
+
+if exists("b:did_indent")
+ finish
+endif
+
+runtime! indent/css.vim
+
+" vim:set sw=2:
View
1,761 plugin/fugitive.vim
1,761 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
354 plugin/git.vim
@@ -1,354 +0,0 @@
-" Author: motemen <motemen@gmail.com>
-" License: The MIT License
-" URL: http://github.com/motemen/git-vim/
-
-if !exists('g:git_command_edit')
- let g:git_command_edit = 'new'
-endif
-
-if !exists('g:git_bufhidden')
- let g:git_bufhidden = ''
-endif
-
-if !exists('g:git_bin')
- let g:git_bin = 'git'
-endif
-
-if !exists('g:git_author_highlight')
- let g:git_author_highlight = { }
-endif
-
-if !exists('g:git_highlight_blame')
- let g:git_highlight_blame = 0
-endif
-
-if !exists('g:git_no_map_default') || !g:git_no_map_default
- nnoremap <Leader>gd :GitDiff<Enter>
- nnoremap <Leader>gD :GitDiff --cached<Enter>
- nnoremap <Leader>gs :GitStatus<Enter>
- nnoremap <Leader>gl :GitLog<Enter>
- nnoremap <Leader>ga :GitAdd<Enter>
- nnoremap <Leader>gA :GitAdd <cfile><Enter>
- nnoremap <Leader>gc :GitCommit<Enter>
- nnoremap <Leader>gp :GitPullRebase<Enter>
-endif
-
-" Ensure b:git_dir exists.
-function! s:GetGitDir()
- if !exists('b:git_dir')
- let b:git_dir = s:SystemGit('rev-parse --git-dir')
- if !v:shell_error
- let b:git_dir = fnamemodify(split(b:git_dir, "\n")[0], ':p') . '/'
- endif
- endif
- return b:git_dir
-endfunction
-
-" Returns current git branch.
-" Call inside 'statusline' or 'titlestring'.
-function! GitBranch()
- let git_dir = <SID>GetGitDir()
-
- if strlen(git_dir) && filereadable(git_dir . '/HEAD')
- let lines = readfile(git_dir . '/HEAD')
- if !len(lines)
- return ''
- else
- return matchstr(lines[0], 'refs/heads/\zs.\+$')
- endif
- else
- return ''
- endif
-endfunction
-
-" List all git local branches.
-function! ListGitBranches(arg_lead, cmd_line, cursor_pos)
- let branches = split(s:SystemGit('branch'), '\n')
- if v:shell_error
- return []
- endif
-
- return map(branches, 'matchstr(v:val, ''^[* ] \zs.*'')')
-endfunction
-
-" List all git commits.
-function! ListGitCommits(arg_lead, cmd_line, cursor_pos)
- let commits = split(s:SystemGit('log --pretty=format:%h'))
- if v:shell_error
- return []
- endif
-
- let commits = ['HEAD'] + ListGitBranches(a:arg_lead, a:cmd_line, a:cursor_pos) + commits
-
- if a:cmd_line =~ '^GitDiff'
- " GitDiff accepts <commit>..<commit>
- if a:arg_lead =~ '\.\.'
- let pre = matchstr(a:arg_lead, '.*\.\.\ze')
- let commits = map(commits, 'pre . v:val')
- endif
- endif
-
- return filter(commits, 'match(v:val, ''\v'' . a:arg_lead) == 0')
-endfunction
-
-" Show diff.
-function! GitDiff(args)
- let git_output = s:SystemGit('diff ' . a:args . ' -- ' . s:Expand('%'))
- if !strlen(git_output)
- echo "No output from git command"
- return
- endif
-
- call <SID>OpenGitBuffer(git_output)
- setlocal filetype=git-diff
-endfunction
-
-" Show Status.
-function! GitStatus()
- let git_output = s:SystemGit('status')
- call <SID>OpenGitBuffer(git_output)
- setlocal filetype=git-status
- nnoremap <buffer> <Enter> :GitAdd <cfile><Enter>:call <SID>RefreshGitStatus()<Enter>
- nnoremap <buffer> - :silent !git reset HEAD -- =expand('<cfile>')<Enter><Enter>:call <SID>RefreshGitStatus()<Enter>
-endfunction
-
-function! s:RefreshGitStatus()
- let pos_save = getpos('.')
- GitStatus
- call setpos('.', pos_save)
-endfunction
-
-" Show Log.
-function! GitLog(args)
- let git_output = s:SystemGit('log ' . a:args . ' -- ' . s:Expand('%'))
- call <SID>OpenGitBuffer(git_output)
- setlocal filetype=git-log
-endfunction
-
-" Add file to index.
-function! GitAdd(expr)
- let file = s:Expand(strlen(a:expr) ? a:expr : '%')
-
- call GitDoCommand('add ' . file)
-endfunction
-
-" Commit.
-function! GitCommit(args)
- let git_dir = <SID>GetGitDir()
-
- let args = a:args
-
- if args !~ '\v\k@<!(-a|--all)>' && s:SystemGit('diff --cached --stat') =~ '^\(\s\|\n\)*$'
- let args .= ' -a'
- endif
-
- " Create COMMIT_EDITMSG file
- let editor_save = $EDITOR
- let $EDITOR = ''
- let git_output = s:SystemGit('commit ' . args)
- let $EDITOR = editor_save
-
- execute printf('%s %sCOMMIT_EDITMSG', g:git_command_edit, git_dir)
- setlocal filetype=git-status bufhidden=wipe
- augroup GitCommit
- autocmd BufWritePre <buffer> g/^#\|^\s*$/d | setlocal fileencoding=utf-8
- execute printf("autocmd BufWritePost <buffer> call GitDoCommand('commit %s -F ' . expand('%%')) | autocmd! GitCommit * <buffer>", args)
- augroup END
-endfunction
-
-" Checkout.
-function! GitCheckout(args)
- call GitDoCommand('checkout ' . a:args)
-endfunction
-
-" Push.
-function! GitPush(args)
-" call GitDoCommand('push ' . a:args)
- " Wanna see progress...
- let args = a:args
- if args =~ '^\s*$'
- let args = 'origin ' . GitBranch()
- endif
- execute '!' g:git_bin 'push' args
-endfunction
-
-" Pull.
-function! GitPull(args)
-" call GitDoCommand('pull ' . a:args)
- " Wanna see progress...
- execute '!' g:git_bin 'pull' a:args
-endfunction
-
-" Show commit, tree, blobs.
-function! GitCatFile(file)
- let file = s:Expand(a:file)
- let git_output = s:SystemGit('cat-file -p ' . file)
- if !strlen(git_output)
- echo "No output from git command"
- return
- endif
-
- call <SID>OpenGitBuffer(git_output)
-endfunction
-
-" Show revision and author for each line.
-function! GitBlame()
- let git_output = s:SystemGit('blame -- ' . expand('%'))
- if !strlen(git_output)
- echo "No output from git command"
- return
- endif
-
- setlocal noscrollbind
-
- " :/
- let git_command_edit_save = g:git_command_edit
- let g:git_command_edit = 'leftabove vnew'
- call <SID>OpenGitBuffer(git_output)
- let g:git_command_edit = git_command_edit_save
-
- setlocal modifiable
- silent %s/\d\d\d\d\zs \+\d\+).*//
- vertical resize 20
- setlocal nomodifiable
- setlocal nowrap scrollbind
-
- if g:git_highlight_blame
- call s:DoHighlightGitBlame()
- endif
-
- wincmd p
- setlocal nowrap scrollbind
-
- syncbind
-endfunction
-
-" Experimental
-function! s:DoHighlightGitBlame()
- for l in range(1, line('$'))
- let line = getline(l)
- let [commit, author] = matchlist(line, '\(\x\+\) (\(.\{-}\)\s* \d\d\d\d-\d\d-\d\d')[1:2]
- call s:LoadSyntaxRuleFor({ 'author': author })
- endfor
-endfunction
-
-function! s:LoadSyntaxRuleFor(params)
- let author = a:params.author
- let name = 'gitBlameAuthor_' . substitute(author, '\s', '_', 'g')
- if (!hlID(name))
- if has_key(g:git_author_highlight, author)
- execute 'highlight' name g:git_author_highlight[author]
- else
- let [n1, n2] = [0, 1]
- for c in split(author, '\zs')
- let n1 = (n1 + char2nr(c)) % 8
- let n2 = (n2 + char2nr(c) * 3) % 8
- endfor
- if n1 == n2
- let n1 = (n2 + 1) % 8
- endif
- execute 'highlight' name printf('ctermfg=%d ctermbg=%d', n1, n2)
- endif
- execute 'syntax match' name '"\V\^\x\+ (' . escape(author, '\') . '\.\*"'
- endif
-endfunction
-
-function! GitDoCommand(args)
- let git_output = s:SystemGit(a:args)
- let git_output = substitute(git_output, '\n*$', '', '')
- if v:shell_error
- echohl Error
- echo git_output
- echohl None
- else
- echo git_output
- endif
-endfunction
-
-function! s:SystemGit(args)
- return system(g:git_bin . ' ' . a:args)
-endfunction
-
-" Show vimdiff for merge. (experimental)
-function! GitVimDiffMerge()
- let file = s:Expand('%')
- let filetype = &filetype
- let t:git_vimdiff_original_bufnr = bufnr('%')
- let t:git_vimdiff_buffers = []
-
- topleft new
- setlocal buftype=nofile
- file `=':2:' . file`
- call add(t:git_vimdiff_buffers, bufnr('%'))
- execute 'silent read!git show :2:' . file
- 0d
- diffthis
- let &filetype = filetype
-
- rightbelow vnew
- setlocal buftype=nofile
- file `=':3:' . file`
- call add(t:git_vimdiff_buffers, bufnr('%'))
- execute 'silent read!git show :3:' . file
- 0d
- diffthis
- let &filetype = filetype
-endfunction
-
-function! GitVimDiffMergeDone()
- if exists('t:git_vimdiff_original_bufnr') && exists('t:git_vimdiff_buffers')
- if getbufline(t:git_vimdiff_buffers[0], 1, '$') == getbufline(t:git_vimdiff_buffers[1], 1, '$')
- execute 'sbuffer ' . t:git_vimdiff_original_bufnr
- 0put=getbufline(t:git_vimdiff_buffers[0], 1, '$')
- normal! jdG
- update
- execute 'bdelete ' . t:git_vimdiff_buffers[0]
- execute 'bdelete ' . t:git_vimdiff_buffers[1]
- close
- else
- echohl Error
- echo 'There still remains conflict'
- echohl None
- endif
- endif
-endfunction
-
-function! s:OpenGitBuffer(content)
- if exists('b:is_git_msg_buffer') && b:is_git_msg_buffer
- enew!
- else
- execute g:git_command_edit
- endif
-
- setlocal buftype=nofile readonly modifiable
- execute 'setlocal bufhidden=' . g:git_bufhidden
-
- silent put=a:content
- keepjumps 0d
- setlocal nomodifiable
-
- let b:is_git_msg_buffer = 1
-endfunction
-
-function! s:Expand(expr)
- if has('win32')
- return substitute(expand(a:expr), '\', '/', 'g')
- else
- return expand(a:expr)
- endif
-endfunction
-
-command! -nargs=1 -complete=customlist,ListGitCommits GitCheckout call GitCheckout(<q-args>)
-command! -nargs=* -complete=customlist,ListGitCommits GitDiff call GitDiff(<q-args>)
-command! GitStatus call GitStatus()
-command! -nargs=? GitAdd call GitAdd(<q-args>)
-command! -nargs=* GitLog call GitLog(<q-args>)
-command! -nargs=* GitCommit call GitCommit(<q-args>)
-command! -nargs=1 GitCatFile call GitCatFile(<q-args>)
-command! GitBlame call GitBlame()
-command! -nargs=+ Git call GitDoCommand(<q-args>)
-command! GitVimDiffMerge call GitVimDiffMerge()
-command! GitVimDiffMergeDone call GitVimDiffMergeDone()
-command! -nargs=* GitPull call GitPull(<q-args>)
-command! GitPullRebase call GitPull('--rebase')
-command! -nargs=* GitPush call GitPush(<q-args>)
View
2 plugin/rails.vim
@@ -56,7 +56,7 @@ call s:SetOptDefault("rails_statusline",1)
call s:SetOptDefault("rails_syntax",1)
call s:SetOptDefault("rails_mappings",1)
call s:SetOptDefault("rails_abbreviations",1)
-call s:SetOptDefault("rails_ctags_arguments","--exclude=\"*.js\"")
+call s:SetOptDefault("rails_ctags_arguments","--languages=-javascript")
call s:SetOptDefault("rails_default_file","README")
call s:SetOptDefault("rails_root_url",'http://localhost:3000/')
call s:SetOptDefault("rails_modelines",0)
View
1,037 plugin/surround.vim
@@ -1,7 +1,7 @@
" surround.vim - Surroundings
-" Author: Tim Pope <vimNOSPAM@tpope.info>
+" Author: Tim Pope <vimNOSPAM@tpope.org>
+" Version: 1.90
" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
-" $Id: surround.vim,v 1.33 2008-02-04 03:50:46 tpope Exp $
"
" See surround.txt for help. This can be accessed by doing
"
@@ -16,7 +16,7 @@
" - this plugin was already loaded or disabled
" - when 'compatible' is set
if (exists("g:loaded_surround") && g:loaded_surround) || &cp
- finish
+ finish
endif
let g:loaded_surround = 1
@@ -26,49 +26,49 @@ set cpo&vim
" Input functions {{{1
function! s:getchar()
- let c = getchar()
- if c =~ '^\d\+$'
- let c = nr2char(c)
- endif
- return c
+ let c = getchar()
+ if c =~ '^\d\+$'
+ let c = nr2char(c)
+ endif
+ return c
endfunction
function! s:inputtarget()
- let c = s:getchar()
- while c =~ '^\d\+$'
- let c = c . s:getchar()
- endwhile
- if c == " "
- let c = c . s:getchar()
- endif
- if c =~ "\<Esc>\|\<C-C>\|\0"
- return ""
- else
- return c
- endif
+ let c = s:getchar()
+ while c =~ '^\d\+$'
+ let c = c . s:getchar()
+ endwhile
+ if c == " "
+ let c = c . s:getchar()
+ endif
+ if c =~ "\<Esc>\|\<C-C>\|\0"
+ return ""
+ else
+ return c
+ endif
endfunction
function! s:inputreplacement()
- "echo '-- SURROUND --'
- let c = s:getchar()
- if c == " "
- let c = c . s:getchar()
- endif
- if c =~ "\<Esc>" || c =~ "\<C-C>"
- return ""
- else
- return c
- endif
+ "echo '-- SURROUND --'
+ let c = s:getchar()
+ if c == " "
+ let c = c . s:getchar()
+ endif
+ if c =~ "\<Esc>" || c =~ "\<C-C>"
+ return ""
+ else
+ return c
+ endif
endfunction
function! s:beep()
- exe "norm! \<Esc>"
- return ""
+ exe "norm! \<Esc>"
+ return ""
endfunction
function! s:redraw()
- redraw
- return ""
+ redraw
+ return ""
endfunction
" }}}1
@@ -76,510 +76,499 @@ endfunction
" Wrapping functions {{{1
function! s:extractbefore(str)
- if a:str =~ '\r'
- return matchstr(a:str,'.*\ze\r')
- else
- return matchstr(a:str,'.*\ze\n')
- endif
+ if a:str =~ '\r'
+ return matchstr(a:str,'.*\ze\r')
+ else
+ return matchstr(a:str,'.*\ze\n')
+ endif
endfunction
function! s:extractafter(str)
- if a:str =~ '\r'
- return matchstr(a:str,'\r\zs.*')
- else
- return matchstr(a:str,'\n\zs.*')
- endif
+ if a:str =~ '\r'
+ return matchstr(a:str,'\r\zs.*')
+ else
+ return matchstr(a:str,'\n\zs.*')
+ endif
endfunction
function! s:repeat(str,count)
- let cnt = a:count
- let str = ""
- while cnt > 0
- let str = str . a:str
- let cnt = cnt - 1
- endwhile
- return str
+ let cnt = a:count
+ let str = ""
+ while cnt > 0
+ let str = str . a:str
+ let cnt = cnt - 1
+ endwhile
+ return str
endfunction
function! s:fixindent(str,spc)
- let str = substitute(a:str,'\t',s:repeat(' ',&sw),'g')
- let spc = substitute(a:spc,'\t',s:repeat(' ',&sw),'g')
- let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g')
- if ! &et
- let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g')
- endif
- return str
+ let str = substitute(a:str,'\t',s:repeat(' ',&sw),'g')
+ let spc = substitute(a:spc,'\t',s:repeat(' ',&sw),'g')
+ let str = substitute(str,'\(\n\|\%^\).\@=','\1'.spc,'g')
+ if ! &et
+ let str = substitute(str,'\s\{'.&ts.'\}',"\t",'g')
+ endif
+ return str
endfunction
function! s:process(string)
- let i = 0
- while i < 7
- let i = i + 1
- let repl_{i} = ''
- let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i))
- if m != ''
- let m = substitute(strpart(m,1),'\r.*','','')
- let repl_{i} = input(substitute(m,':\s*$','','').': ')
- endif
- endwhile
- let s = ""
- let i = 0
- while i < strlen(a:string)
- let char = strpart(a:string,i,1)
- if char2nr(char) < 8
- let next = stridx(a:string,char,i+1)
- if next == -1
- let s = s . char
- else
- let insertion = repl_{char2nr(char)}
- let subs = strpart(a:string,i+1,next-i-1)
- let subs = matchstr(subs,'\r.*')
- while subs =~ '^\r.*\r'
- let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*")
- let subs = strpart(subs,strlen(sub)+1)
- let r = stridx(sub,"\r")
- let insertion = substitute(insertion,strpart(sub,0,r),strpart(sub,r+1),'')
- endwhile
- let s = s . insertion
- let i = next
- endif
- else
- let s = s . char
- endif
- let i = i + 1
- endwhile
- return s
+ let i = 0
+ while i < 7
+ let i = i + 1
+ let repl_{i} = ''
+ let m = matchstr(a:string,nr2char(i).'.\{-\}\ze'.nr2char(i))
+ if m != ''
+ let m = substitute(strpart(m,1),'\r.*','','')
+ let repl_{i} = input(substitute(m,':\s*$','','').': ')
+ endif
+ endwhile
+ let s = ""
+ let i = 0
+ while i < strlen(a:string)
+ let char = strpart(a:string,i,1)
+ if char2nr(char) < 8
+ let next = stridx(a:string,char,i+1)
+ if next == -1
+ let s = s . char
+ else
+ let insertion = repl_{char2nr(char)}
+ let subs = strpart(a:string,i+1,next-i-1)
+ let subs = matchstr(subs,'\r.*')
+ while subs =~ '^\r.*\r'
+ let sub = matchstr(subs,"^\r\\zs[^\r]*\r[^\r]*")