Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

plugins aktualisiert

  • Loading branch information...
commit ec8f1a99fcef54dbe1eb6679c1e3977fdd34ee69 1 parent dc1ee9f
Timo Göllner authored
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
@@ -0,0 +1,1761 @@
+" fugitive.vim - A Git wrapper so awesome, it should be illegal
+" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
+" Version: 1.1
+" GetLatestVimScripts: 2975 1 :AutoInstall: fugitive.vim
+
+if exists('g:loaded_fugitive') || &cp
+ finish
+endif
+let g:loaded_fugitive = 1
+
+if !exists('g:fugitive_git_executable')
+ let g:fugitive_git_executable = 'git'
+endif
+
+" Utility {{{1
+
+function! s:function(name) abort
+ return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '<SNR>\d\+_'),''))
+endfunction
+
+function! s:sub(str,pat,rep) abort
+ return substitute(a:str,'\v\C'.a:pat,a:rep,'')
+endfunction
+
+function! s:gsub(str,pat,rep) abort
+ return substitute(a:str,'\v\C'.a:pat,a:rep,'g')
+endfunction
+
+function! s:shellesc(arg) abort
+ if a:arg =~ '^[A-Za-z0-9_/.-]\+$'
+ return a:arg
+ elseif &shell =~# 'cmd' && a:arg !~# '"'
+ return '"'.a:arg.'"'
+ else
+ return shellescape(a:arg)
+ endif
+endfunction
+
+function! s:fnameescape(file) abort
+ if exists('*fnameescape')
+ return fnameescape(a:file)
+ else
+ return escape(a:file," \t\n*?[{`$\\%#'\"|!<")
+ endif
+endfunction
+
+function! s:throw(string) abort
+ let v:errmsg = 'fugitive: '.a:string
+ throw v:errmsg
+endfunction
+
+function! s:warn(str)
+ echohl WarningMsg
+ echomsg a:str
+ echohl None
+ let v:warningmsg = a:str
+endfunction
+
+function! s:shellslash(path)
+ if exists('+shellslash') && !&shellslash
+ return s:gsub(a:path,'\\','/')
+ else
+ return a:path
+ endif
+endfunction
+
+function! s:add_methods(namespace, method_names) abort
+ for name in a:method_names
+ let s:{a:namespace}_prototype[name] = s:function('s:'.a:namespace.'_'.name)
+ endfor
+endfunction
+
+let s:commands = []
+function! s:command(definition) abort
+ let s:commands += [a:definition]
+endfunction
+
+function! s:define_commands()
+ for command in s:commands
+ exe 'command! -buffer '.command
+ endfor
+endfunction
+
+function! s:compatibility_check()
+ if exists('b:git_dir') && exists('*GitBranchInfoCheckGitDir') && !exists('g:fugitive_did_compatibility_warning')
+ let g:fugitive_did_compatibility_warning = 1
+ call s:warn("See http://github.com/tpope/vim-fugitive/issues#issue/1 for why you should remove git-branch-info.vim")
+ endif
+endfunction
+
+augroup fugitive_utility
+ autocmd!
+ autocmd User Fugitive call s:define_commands()
+ autocmd VimEnter * call s:compatibility_check()
+augroup END
+
+let s:abstract_prototype = {}
+
+" }}}1
+" Initialization {{{1
+
+function! s:ExtractGitDir(path) abort
+ let path = s:shellslash(a:path)
+ if path =~? '^fugitive://.*//'
+ return matchstr(path,'fugitive://\zs.\{-\}\ze//')
+ endif
+ let fn = fnamemodify(path,':s?[\/]$??')
+ let ofn = ""
+ let nfn = fn
+ while fn != ofn
+ if isdirectory(fn . '/.git')
+ return s:sub(simplify(fnamemodify(fn . '/.git',':p')),'\W$','')
+ elseif fn =~ '\.git$' && filereadable(fn . '/HEAD')
+ return s:sub(simplify(fnamemodify(fn,':p')),'\W$','')
+ endif
+ let ofn = fn
+ let fn = fnamemodify(ofn,':h')
+ endwhile
+ return ''
+endfunction
+
+function! s:Detect(path)
+ if exists('b:git_dir') && b:git_dir ==# ''
+ unlet b:git_dir
+ endif
+ if !exists('b:git_dir')
+ let dir = s:ExtractGitDir(a:path)
+ if dir != ''
+ let b:git_dir = dir
+ endif
+ endif
+ if exists('b:git_dir')
+ silent doautocmd User Fugitive
+ cnoremap <expr> <buffer> <C-R><C-G> fugitive#buffer().rev()
+ let buffer = fugitive#buffer()
+ if expand('%:p') =~# '//'
+ call buffer.setvar('&path',s:sub(buffer.getvar('&path'),'^\.%(,|$)',''))
+ endif
+ if b:git_dir !~# ',' && stridx(buffer.getvar('&tags'),b:git_dir.'/tags') == -1
+ call buffer.setvar('&tags',buffer.getvar('&tags').','.b:git_dir.'/tags')
+ endif
+ endif
+endfunction
+
+augroup fugitive
+ autocmd!
+ autocmd BufNewFile,BufReadPost * call s:Detect(expand('<amatch>:p'))
+ autocmd FileType netrw call s:Detect(expand('<afile>:p'))
+ autocmd VimEnter * if expand('<amatch>')==''|call s:Detect(getcwd())|endif
+ autocmd BufWinLeave * execute getwinvar(+winnr(), 'fugitive_restore')
+augroup END
+
+" }}}1
+" Repository {{{1
+
+let s:repo_prototype = {}
+let s:repos = {}
+
+function! s:repo(...) abort
+ let dir = a:0 ? a:1 : (exists('b:git_dir') && b:git_dir !=# '' ? b:git_dir : s:ExtractGitDir(expand('%:p')))
+ if dir !=# ''
+ if has_key(s:repos,dir)
+ let repo = get(s:repos,dir)
+ else
+ let repo = {'git_dir': dir}
+ let s:repos[dir] = repo
+ endif
+ return extend(extend(repo,s:repo_prototype,'keep'),s:abstract_prototype,'keep')
+ endif
+ call s:throw('not a git repository: '.expand('%:p'))
+endfunction
+
+function! s:repo_dir(...) dict abort
+ return join([self.git_dir]+a:000,'/')
+endfunction
+
+function! s:repo_tree(...) dict abort
+ if !self.bare()
+ let dir = fnamemodify(self.git_dir,':h')
+ return join([dir]+a:000,'/')
+ endif
+ call s:throw('no work tree')
+endfunction
+
+function! s:repo_bare() dict abort
+ return self.dir() !~# '/\.git$'
+endfunction
+
+function! s:repo_translate(spec) dict abort
+ if a:spec ==# '.' || a:spec ==# '/.'
+ return self.bare() ? self.dir() : self.tree()
+ elseif a:spec =~# '^/'
+ return fnamemodify(self.dir(),':h').a:spec
+ elseif a:spec =~# '^:[0-3]:'
+ return 'fugitive://'.self.dir().'//'.a:spec[1].'/'.a:spec[3:-1]
+ elseif a:spec ==# ':'
+ if $GIT_INDEX_FILE =~# '/[^/]*index[^/]*\.lock$' && fnamemodify($GIT_INDEX_FILE,':p')[0:strlen(s:repo().dir())] ==# s:repo().dir('') && filereadable($GIT_INDEX_FILE)
+ return fnamemodify($GIT_INDEX_FILE,':p')
+ else
+ return self.dir('index')
+ endif
+ elseif a:spec =~# '^:/'
+ let ref = self.rev_parse(matchstr(a:spec,'.[^:]*'))
+ return 'fugitive://'.self.dir().'//'.ref
+ elseif a:spec =~# '^:'
+ return 'fugitive://'.self.dir().'//0/'.a:spec[1:-1]
+ elseif a:spec =~# 'HEAD\|^refs/' && a:spec !~ ':' && filereadable(self.dir(a:spec))
+ return self.dir(a:spec)
+ elseif filereadable(s:repo().dir('refs/'.a:spec))
+ return self.dir('refs/'.a:spec)
+ elseif filereadable(s:repo().dir('refs/tags/'.a:spec))
+ return self.dir('refs/tags/'.a:spec)
+ elseif filereadable(s:repo().dir('refs/heads/'.a:spec))
+ return self.dir('refs/heads/'.a:spec)
+ elseif filereadable(s:repo().dir('refs/remotes/'.a:spec))
+ return self.dir('refs/remotes/'.a:spec)
+ elseif filereadable(s:repo().dir('refs/remotes/'.a:spec.'/HEAD'))
+ return self.dir('refs/remotes/'.a:spec,'/HEAD')
+ else
+ try
+ let ref = self.rev_parse(matchstr(a:spec,'[^:]*'))
+ let path = s:sub(matchstr(a:spec,':.*'),'^:','/')
+ return 'fugitive://'.self.dir().'//'.ref.path
+ catch /^fugitive:/
+ return self.tree(a:spec)
+ endtry
+ endif
+endfunction
+
+call s:add_methods('repo',['dir','tree','bare','translate'])
+
+function! s:repo_git_command(...) dict abort
+ let git = g:fugitive_git_executable . ' --git-dir='.s:shellesc(self.git_dir)
+ return git.join(map(copy(a:000),'" ".s:shellesc(v:val)'),'')
+endfunction
+
+function! s:repo_git_chomp(...) dict abort
+ return s:sub(system(call(self.git_command,a:000,self)),'\n$','')
+endfunction
+
+function! s:repo_git_chomp_in_tree(...) dict abort
+ let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
+ let dir = getcwd()
+ try
+ execute cd.'`=s:repo().tree()`'
+ return call(s:repo().git_chomp, a:000, s:repo())
+ finally
+ execute cd.'`=dir`'
+ endtry
+endfunction
+
+function! s:repo_rev_parse(rev) dict abort
+ let hash = self.git_chomp('rev-parse','--verify',a:rev)
+ if hash =~ '^\x\{40\}$'
+ return hash
+ endif
+ call s:throw('rev-parse '.a:rev.': '.hash)
+endfunction
+
+call s:add_methods('repo',['git_command','git_chomp','git_chomp_in_tree','rev_parse'])
+
+function! s:repo_dirglob(base) dict abort
+ let base = s:sub(a:base,'^/','')
+ let matches = split(glob(self.tree(s:gsub(base,'/','*&').'*/')),"\n")
+ call map(matches,'v:val[ strlen(self.tree())+(a:base !~ "^/") : -1 ]')
+ return matches
+endfunction
+
+function! s:repo_superglob(base) dict abort
+ if a:base =~# '^/' || a:base !~# ':'
+ let results = []
+ if a:base !~# '^/'
+ let heads = ["HEAD","ORIG_HEAD","FETCH_HEAD","MERGE_HEAD"]
+ let heads += sort(split(s:repo().git_chomp("rev-parse","--symbolic","--branches","--tags","--remotes"),"\n"))
+ call filter(heads,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base')
+ let results += heads
+ endif
+ if !self.bare()
+ let base = s:sub(a:base,'^/','')
+ let matches = split(glob(self.tree(s:gsub(base,'/','*&').'*')),"\n")
+ call map(matches,'s:shellslash(v:val)')
+ call map(matches,'v:val !~ "/$" && isdirectory(v:val) ? v:val."/" : v:val')
+ call map(matches,'v:val[ strlen(self.tree())+(a:base !~ "^/") : -1 ]')
+ let results += matches
+ endif
+ return results
+
+ elseif a:base =~# '^:'
+ let entries = split(self.git_chomp('ls-files','--stage'),"\n")
+ call map(entries,'s:sub(v:val,".*(\\d)\\t(.*)",":\\1:\\2")')
+ if a:base !~# '^:[0-3]\%(:\|$\)'
+ call filter(entries,'v:val[1] == "0"')
+ call map(entries,'v:val[2:-1]')
+ endif
+ call filter(entries,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base')
+ return entries
+
+ else
+ let tree = matchstr(a:base,'.*[:/]')
+ let entries = split(self.git_chomp('ls-tree',tree),"\n")
+ call map(entries,'s:sub(v:val,"^04.*\\zs$","/")')
+ call map(entries,'tree.s:sub(v:val,".*\t","")')
+ return filter(entries,'v:val[ 0 : strlen(a:base)-1 ] ==# a:base')
+ endif
+endfunction
+
+call s:add_methods('repo',['dirglob','superglob'])
+
+function! s:repo_keywordprg() dict abort
+ let args = ' --git-dir='.escape(self.dir(),"\\\"' ").' show'
+ if has('gui_running') && !has('win32')
+ return g:fugitive_git_executable . ' --no-pager' . args
+ else
+ return g:fugitive_git_executable . args
+ endif
+endfunction
+
+call s:add_methods('repo',['keywordprg'])
+
+" }}}1
+" Buffer {{{1
+
+let s:buffer_prototype = {}
+
+function! s:buffer(...) abort
+ let buffer = {'#': bufnr(a:0 ? a:1 : '%')}
+ call extend(extend(buffer,s:buffer_prototype,'keep'),s:abstract_prototype,'keep')
+ if buffer.getvar('git_dir') !=# ''
+ return buffer
+ endif
+ call s:throw('not a git repository: '.expand('%:p'))
+endfunction
+
+function! fugitive#buffer(...) abort
+ return s:buffer(a:0 ? a:1 : '%')
+endfunction
+
+function! s:buffer_getvar(var) dict abort
+ return getbufvar(self['#'],a:var)
+endfunction
+
+function! s:buffer_setvar(var,value) dict abort
+ return setbufvar(self['#'],a:var,a:value)
+endfunction
+
+function! s:buffer_getline(lnum) dict abort
+ return getbufline(self['#'],a:lnum)[0]
+endfunction
+
+function! s:buffer_repo() dict abort
+ return s:repo(self.getvar('git_dir'))
+endfunction
+
+function! s:buffer_type(...) dict abort
+ if self.getvar('fugitive_type') != ''
+ let type = self.getvar('fugitive_type')
+ elseif fnamemodify(self.spec(),':p') =~# '.\git/refs/\|\.git/\w*HEAD$'
+ let type = 'head'
+ elseif self.getline(1) =~ '^tree \x\{40\}$' && self.getline(2) == ''
+ let type = 'tree'
+ elseif self.getline(1) =~ '^\d\{6\} \w\{4\} \x\{40\}\>\t'
+ let type = 'tree'
+ elseif self.getline(1) =~ '^\d\{6\} \x\{40\}\> \d\t'
+ let type = 'index'
+ elseif isdirectory(self.spec())
+ let type = 'directory'
+ elseif self.spec() == ''
+ let type = 'null'
+ elseif filereadable(self.spec())
+ let type = 'file'
+ else
+ let type = ''
+ endif
+ if a:0
+ return !empty(filter(copy(a:000),'v:val ==# type'))
+ else
+ return type
+ endif
+endfunction
+
+function! s:buffer_spec() dict abort
+ let bufname = bufname(self['#'])
+ return s:shellslash(bufname == '' ? '' : fnamemodify(bufname,':p'))
+endfunction
+
+function! s:buffer_name() dict abort
+ return self.spec()
+endfunction
+
+function! s:buffer_commit() dict abort
+ return matchstr(self.spec(),'^fugitive://.\{-\}//\zs\w*')
+endfunction
+
+function! s:buffer_path(...) dict abort
+ let rev = matchstr(self.spec(),'^fugitive://.\{-\}//\zs.*')
+ if rev != ''
+ let rev = s:sub(rev,'\w*','')
+ else
+ let rev = self.spec()[strlen(self.repo().tree()) : -1]
+ endif
+ return s:sub(rev,'^/',a:0 ? a:1 : '')
+endfunction
+
+function! s:buffer_rev() dict abort
+ let rev = matchstr(self.spec(),'^fugitive://.\{-\}//\zs.*')
+ if rev =~ '^\x/'
+ return ':'.rev[0].':'.rev[2:-1]
+ elseif rev =~ '.'
+ return s:sub(rev,'/',':')
+ elseif self.spec() =~ '\.git/index$'
+ return ':'
+ elseif self.spec() =~ '\.git/refs/\|\.git/.*HEAD$'
+ return self.spec()[strlen(self.repo().dir())+1 : -1]
+ else
+ return self.path()
+ endif
+endfunction
+
+function! s:buffer_sha1() dict abort
+ if self.spec() =~ '^fugitive://' || self.spec() =~ '\.git/refs/\|\.git/.*HEAD$'
+ return self.repo().rev_parse(self.rev())
+ else
+ return ''
+ endif
+endfunction
+
+function! s:buffer_expand(rev) dict abort
+ if a:rev =~# '^:[0-3]$'
+ let file = a:rev.self.path(':')
+ elseif a:rev =~# '^-'
+ let file = 'HEAD^{}'.a:rev[1:-1].self.path(':')
+ elseif a:rev =~# '^@{'
+ let file = 'HEAD'.a:rev.self.path(':')
+ elseif a:rev =~# '^[~^]'
+ let commit = s:sub(self.commit(),'^\d=$','HEAD')
+ let file = commit.a:rev.self.path(':')
+ else
+ let file = a:rev
+ endif
+ return s:sub(file,'\%$',self.path())
+endfunction
+
+function! s:buffer_containing_commit() dict abort
+ if self.commit() =~# '^\d$'
+ return ':'
+ elseif self.commit() =~# '.'
+ return self.commit()
+ else
+ return 'HEAD'
+ endif
+endfunction
+
+call s:add_methods('buffer',['getvar','setvar','getline','repo','type','spec','name','commit','path','rev','sha1','expand','containing_commit'])
+
+" }}}1
+" Git {{{1
+
+call s:command("-bang -nargs=? -complete=customlist,s:GitComplete Git :execute s:Git(<bang>0,<q-args>)")
+
+function! s:ExecuteInTree(cmd) abort
+ let cd = exists('*haslocaldir') && haslocaldir() ? 'lcd ' : 'cd '
+ let dir = getcwd()
+ try
+ execute cd.'`=s:repo().tree()`'
+ execute a:cmd
+ finally
+ execute cd.'`=dir`'
+ endtry
+endfunction
+
+function! s:Git(bang,cmd) abort
+ let git = s:repo().git_command()
+ if has('gui_running') && !has('win32')
+ let git .= ' --no-pager'
+ endif
+ let cmd = matchstr(a:cmd,'\v\C.{-}%($|\\@<!%(\\\\)*\|)@=')
+ call s:ExecuteInTree('!'.git.' '.cmd)
+ call fugitive#reload_status()
+ return matchstr(a:cmd,'\v\C\\@<!%(\\\\)*\|\zs.*')
+endfunction
+
+function! s:GitComplete(A,L,P) abort
+ if !exists('s:exec_path')
+ let s:exec_path = s:sub(system(g:fugitive_git_executable.' --exec-path'),'\n$','')
+ endif
+ let cmds = map(split(glob(s:exec_path.'/git-*'),"\n"),'s:sub(v:val[strlen(s:exec_path)+5 : -1],"\\.exe$","")')
+ if a:L =~ ' [[:alnum:]-]\+ '
+ return s:repo().superglob(a:A)
+ elseif a:A == ''
+ return cmds
+ else
+ return filter(cmds,'v:val[0 : strlen(a:A)-1] ==# a:A')
+ endif
+endfunction
+
+" }}}1
+" Gcd, Glcd {{{1
+
+function! s:DirComplete(A,L,P) abort
+ let matches = s:repo().dirglob(a:A)
+ return matches
+endfunction
+
+call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Gcd :cd<bang> `=s:repo().bare() ? s:repo().dir(<q-args>) : s:repo().tree(<q-args>)`")
+call s:command("-bar -bang -nargs=? -complete=customlist,s:DirComplete Glcd :lcd<bang> `=s:repo().bare() ? s:repo().dir(<q-args>) : s:repo().tree(<q-args>)`")
+
+" }}}1
+" Gstatus {{{1
+
+call s:command("-bar Gstatus :execute s:Status()")
+
+function! s:Status() abort
+ try
+ Gpedit :
+ wincmd P
+ nnoremap <buffer> <silent> q :<C-U>bdelete<CR>
+ catch /^fugitive:/
+ return 'echoerr v:errmsg'
+ endtry
+ return ''
+endfunction
+
+function! fugitive#reload_status() abort
+ let mytab = tabpagenr()
+ for tab in [mytab] + range(1,tabpagenr('$'))
+ for winnr in range(1,tabpagewinnr(tab,'$'))
+ if getbufvar(tabpagebuflist(tab)[winnr-1],'fugitive_type') ==# 'index'
+ execute 'tabnext '.tab
+ if winnr != winnr()
+ execute winnr.'wincmd w'
+ let restorewinnr = 1
+ endif
+ try
+ if !&modified
+ call s:BufReadIndex()
+ endif
+ finally
+ if exists('restorewinnr')
+ wincmd p
+ endif
+ execute 'tabnext '.mytab
+ endtry
+ endif
+ endfor
+ endfor
+endfunction
+
+function! s:StageDiff(bang) abort
+ let section = getline(search('^# .*:$','bnW'))
+ let line = getline('.')
+ let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
+ if filename ==# '' && section == '# Changes to be committed:'
+ return 'Git diff --cached'
+ elseif filename ==# ''
+ return 'Git diff'
+ elseif line =~# '^#\trenamed:' && filename =~ ' -> '
+ let [old, new] = split(filename,' -> ')
+ execute 'Gedit '.s:fnameescape(':0:'.new)
+ return 'Gdiff'.a:bang.' HEAD:'.s:fnameescape(old)
+ elseif section == '# Changes to be committed:'
+ execute 'Gedit '.s:fnameescape(':0:'.filename)
+ return 'Gdiff'.a:bang.' -'
+ else
+ execute 'Gedit '.s:fnameescape('/'.filename)
+ return 'Gdiff'.a:bang
+ endif
+endfunction
+
+function! s:StageToggle(lnum1,lnum2) abort
+ try
+ let output = ''
+ for lnum in range(a:lnum1,a:lnum2)
+ let line = getline(lnum)
+ if getline('.') == '# Changes to be committed:'
+ return 'Gcommit'
+ endif
+ let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
+ if filename ==# ''
+ continue
+ endif
+ if !exists('first_filename')
+ let first_filename = filename
+ endif
+ execute lnum
+ let section = getline(search('^# .*:$','bnW'))
+ if line =~# '^#\trenamed:' && filename =~ ' -> '
+ let cmd = ['mv','--'] + reverse(split(filename,' -> '))
+ let filename = cmd[-1]
+ elseif section =~? ' to be '
+ let cmd = ['reset','-q','--',filename]
+ elseif line =~# '^#\tdeleted:'
+ let cmd = ['rm','--',filename]
+ else
+ let cmd = ['add','--',filename]
+ endif
+ let output .= call(s:repo().git_chomp_in_tree,cmd,s:repo())."\n"
+ endfor
+ if exists('first_filename')
+ let jump = first_filename
+ let f = matchstr(getline(a:lnum1-1),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
+ if f !=# '' | let jump = f | endif
+ let f = matchstr(getline(a:lnum2+1),'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
+ if f !=# '' | let jump = f | endif
+ silent! edit!
+ 1
+ redraw
+ call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.jump.'\$','W')
+ endif
+ echo s:sub(s:gsub(output,'\n+','\n'),'\n$','')
+ catch /^fugitive:/
+ return 'echoerr v:errmsg'
+ endtry
+ return 'checktime'
+endfunction
+
+function! s:StagePatch(lnum1,lnum2) abort
+ let add = []
+ let reset = []
+
+ for lnum in range(a:lnum1,a:lnum2)
+ let line = getline(lnum)
+ if line == '# Changes to be committed:'
+ return 'Git reset --patch'
+ elseif line == '# Changed but not updated:'
+ return 'Git add --patch'
+ endif
+ let filename = matchstr(line,'^#\t\%([[:alpha:] ]\+: *\)\=\zs.*')
+ if filename ==# ''
+ continue
+ endif
+ if !exists('first_filename')
+ let first_filename = filename
+ endif
+ execute lnum
+ let section = getline(search('^# .*:$','bnW'))
+ if line =~# '^#\trenamed:' && filename =~ ' -> '
+ let reset += [split(filename,' -> ')[1]]
+ elseif section =~? ' to be '
+ let reset += [filename]
+ elseif line !~# '^#\tdeleted:'
+ let add += [filename]
+ endif
+ endfor
+ try
+ if !empty(add)
+ execute "Git add --patch -- ".join(map(add,'s:shellesc(v:val)'))
+ endif
+ if !empty(reset)
+ execute "Git reset --patch -- ".join(map(add,'s:shellesc(v:val)'))
+ endif
+ if exists('first_filename')
+ silent! edit!
+ 1
+ redraw
+ call search('^#\t\%([[:alpha:] ]\+: *\)\=\V'.first_filename.'\$','W')
+ endif
+ catch /^fugitive:/
+ return 'echoerr v:errmsg'
+ endtry
+ return 'checktime'
+endfunction
+