Skip to content
This repository
Browse code

Fix several commands on Vim 7.0

Older versions of Vim choked on :call foo().bar().

Closes #132.
  • Loading branch information...
commit 1ef4da7a162cbeeb69a9578639dd664b6cca7433 1 parent 91f2287
Tim Pope authored

Showing 1 changed file with 19 additions and 13 deletions. Show diff stats Hide diff stats

  1. +19 13 autoload/rails.vim
32 autoload/rails.vim
@@ -850,12 +850,12 @@ function! s:app_background_script_command(cmd) dict abort
850 850 else
851 851 exe "!".cmd
852 852 endif
853   - return v:shell_error
  853 + return ''
854 854 endfunction
855 855
856 856 function! s:app_execute_script_command(cmd) dict abort
857 857 exe '!'.s:esccmd(self.script_shell_command(a:cmd))
858   - return v:shell_error
  858 + return ''
859 859 endfunction
860 860
861 861 function! s:app_lightweight_ruby_eval(ruby,...) dict abort
@@ -918,7 +918,7 @@ function! s:BufCommands()
918 918 command! -buffer -bar -nargs=? -bang -range -complete=customlist,s:Complete_preview Rpreview :call s:Preview(<bang>0,<line1>,<q-args>)
919 919 command! -buffer -bar -nargs=? -bang -complete=customlist,s:Complete_environments Rlog :call s:Log(<bang>0,<q-args>)
920 920 command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_set Rset :call s:Set(<bang>0,<f-args>)
921   - command! -buffer -bar -nargs=0 Rtags :call rails#app().tags_command()
  921 + command! -buffer -bar -nargs=0 Rtags :execute rails#app().tags_command()
922 922 " Embedding all this logic directly into the command makes the error
923 923 " messages more concise.
924 924 command! -buffer -bar -nargs=? -bang Rdoc :
@@ -1028,12 +1028,14 @@ function! s:app_tags_command() dict
1028 1028 elseif executable("ctags.exe")
1029 1029 let cmd = "ctags.exe"
1030 1030 else
1031   - return s:error("ctags not found")
  1031 + call s:error("ctags not found")
  1032 + return ''
1032 1033 endif
1033 1034 if !isdirectory(self.path('tmp'))
1034 1035 call mkdir(self.path('tmp'), 'p')
1035 1036 endif
1036 1037 exe '!'.cmd.' -f '.s:escarg(self.path("tmp/tags")).' -R --langmap="ruby:+.rake.builder.rjs" '.g:rails_ctags_arguments.' '.s:escarg(self.path())
  1038 + return ''
1037 1039 endfunction
1038 1040
1039 1041 call s:add_methods('app',['tags_command'])
@@ -1046,7 +1048,7 @@ function! s:Refresh(bang)
1046 1048 silent! ruby ActiveRecord::Base.clear_reloadable_connections! if defined?(ActiveRecord)
1047 1049 endif
1048 1050 endif
1049   - call rails#app().cache.clear()
  1051 + let _ = rails#app().cache.clear()
1050 1052 silent doautocmd User BufLeaveRails
1051 1053 if a:bang
1052 1054 for key in keys(s:apps)
@@ -1451,14 +1453,14 @@ endfunction
1451 1453 " Script Wrappers {{{1
1452 1454
1453 1455 function! s:BufScriptWrappers()
1454   - command! -buffer -bar -nargs=* -complete=customlist,s:Complete_script Rscript :call rails#app().script_command(<bang>0,<f-args>)
1455   - command! -buffer -bar -nargs=* -complete=customlist,s:Complete_generate Rgenerate :call rails#app().generate_command(<bang>0,<f-args>)
1456   - command! -buffer -bar -nargs=* -complete=customlist,s:Complete_destroy Rdestroy :call rails#app().destroy_command(<bang>0,<f-args>)
1457   - command! -buffer -bar -nargs=? -bang -complete=customlist,s:Complete_server Rserver :call rails#app().server_command(<bang>0,<q-args>)
1458   - command! -buffer -bang -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Rrunner :call rails#app().runner_command(<bang>0 ? -2 : (<count>==<line2>?<count>:-1),<f-args>)
1459   - command! -buffer -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Rp :call rails#app().runner_command(<count>==<line2>?<count>:-1,'p begin '.<f-args>.' end')
1460   - command! -buffer -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Rpp :call rails#app().runner_command(<count>==<line2>?<count>:-1,'require %{pp}; pp begin '.<f-args>.' end')
1461   - command! -buffer -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Ry :call rails#app().runner_command(<count>==<line2>?<count>:-1,'y begin '.<f-args>.' end')
  1456 + command! -buffer -bar -nargs=* -complete=customlist,s:Complete_script Rscript :execute rails#app().script_command(<bang>0,<f-args>)
  1457 + command! -buffer -bar -nargs=* -complete=customlist,s:Complete_generate Rgenerate :execute rails#app().generate_command(<bang>0,<f-args>)
  1458 + command! -buffer -bar -nargs=* -complete=customlist,s:Complete_destroy Rdestroy :execute rails#app().destroy_command(<bang>0,<f-args>)
  1459 + command! -buffer -bar -nargs=? -bang -complete=customlist,s:Complete_server Rserver :execute rails#app().server_command(<bang>0,<q-args>)
  1460 + command! -buffer -bang -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Rrunner :execute rails#app().runner_command(<bang>0 ? -2 : (<count>==<line2>?<count>:-1),<f-args>)
  1461 + command! -buffer -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Rp :execute rails#app().runner_command(<count>==<line2>?<count>:-1,'p begin '.<f-args>.' end')
  1462 + command! -buffer -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Rpp :execute rails#app().runner_command(<count>==<line2>?<count>:-1,'require %{pp}; pp begin '.<f-args>.' end')
  1463 + command! -buffer -nargs=1 -range=0 -complete=customlist,s:Complete_ruby Ry :execute rails#app().runner_command(<count>==<line2>?<count>:-1,'y begin '.<f-args>.' end')
1462 1464 endfunction
1463 1465
1464 1466 function! s:app_generators() dict
@@ -1504,6 +1506,7 @@ function! s:app_runner_command(count,args) dict
1504 1506 exe a:count.'put =res'
1505 1507 endif
1506 1508 endif
  1509 + return ''
1507 1510 endfunction
1508 1511
1509 1512 function! s:getpidfor(bind,port)
@@ -1553,6 +1556,7 @@ function! s:app_server_command(bang,arg) dict
1553 1556 call self.execute_script_command('server '.a:arg." -d")
1554 1557 endif
1555 1558 call s:setopt('a:root_url','http://'.(bind=='0.0.0.0'?'localhost': bind).':'.port.'/')
  1559 + return ''
1556 1560 endfunction
1557 1561
1558 1562 function! s:app_destroy_command(bang,...) dict
@@ -1569,6 +1573,7 @@ function! s:app_destroy_command(bang,...) dict
1569 1573 endwhile
1570 1574 call self.execute_script_command('destroy'.str)
1571 1575 call self.cache.clear('user_classes')
  1576 + return ''
1572 1577 endfunction
1573 1578
1574 1579 function! s:app_generate_command(bang,...) dict
@@ -1598,6 +1603,7 @@ function! s:app_generate_command(bang,...) dict
1598 1603 endif
1599 1604 edit `=self.path(file)`
1600 1605 endif
  1606 + return ''
1601 1607 endfunction
1602 1608
1603 1609 call s:add_methods('app', ['generators','script_command','runner_command','server_command','destroy_command','generate_command'])

0 comments on commit 1ef4da7

Please sign in to comment.
Something went wrong with that request. Please try again.