utils 0.0.57 → 0.0.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -608,7 +608,7 @@ endfunction
608
608
 
609
609
  function! s:buffer_name() dict abort
610
610
  let app = self.app()
611
- let f = s:gsub(resolve(fnamemodify(bufname(self.number()),':p')),'\\ @!','/')
611
+ let f = s:gsub(fnamemodify(bufname(self.number()),':p'),'\\ @!','/')
612
612
  let f = s:sub(f,'/$','')
613
613
  let sep = matchstr(f,'^[^\\/]\{3,\}\zs[\\/]')
614
614
  if sep != ""
@@ -942,9 +942,12 @@ function! s:BufCommands()
942
942
  command! -buffer -bar -nargs=? -complete=customlist,s:Complete_environments Rdbext :call s:BufDatabase(2,<q-args>)|let b:dbext_buffer_defaulted = 1
943
943
  endif
944
944
  let ext = expand("%:e")
945
+ Decho ext
945
946
  if ext =~ s:viewspattern()
946
947
  " TODO: complete controller names with trailing slashes here
947
948
  command! -buffer -bar -bang -nargs=? -range -complete=customlist,s:controllerList Rextract :<line1>,<line2>call s:Extract(<bang>0,<f-args>)
949
+ elseif ext == "rb"
950
+ command! -buffer -bar -bang -nargs=? -range -complete=customlist,s:controllerList,s:modelList Rextract :<line1>,<line2>call s:ExtractConcern(<bang>0,<f-args>)
948
951
  endif
949
952
  if RailsFilePath() =~ '\<db/migrate/.*\.rb$'
950
953
  command! -buffer -bar Rinvert :call s:Invert(<bang>0)
@@ -1030,8 +1033,6 @@ function! s:app_tags_command() dict
1030
1033
  let cmd = "exuberant-ctags"
1031
1034
  elseif executable("ctags-exuberant")
1032
1035
  let cmd = "ctags-exuberant"
1033
- elseif executable("exctags")
1034
- let cmd = "exctags"
1035
1036
  elseif executable("ctags")
1036
1037
  let cmd = "ctags"
1037
1038
  elseif executable("ctags.exe")
@@ -1274,9 +1275,9 @@ function! s:readable_default_rake_task(lnum) dict abort
1274
1275
  let ver = matchstr(self.name(),'\<db/migrate/0*\zs\d*\ze_')
1275
1276
  if ver != ""
1276
1277
  let method = self.last_method(lnum)
1277
- if method == "down" || lnum == 1
1278
+ if method == "down"
1278
1279
  return "db:migrate:down VERSION=".ver
1279
- elseif method == "up" || lnum == line('$')
1280
+ elseif method == "up"
1280
1281
  return "db:migrate:up VERSION=".ver
1281
1282
  elseif lnum > 0
1282
1283
  return "db:migrate:down db:migrate:up VERSION=".ver
@@ -1690,19 +1691,19 @@ endfunction
1690
1691
  function! s:BufNavCommands()
1691
1692
  command! -buffer -bar -nargs=? -complete=customlist,s:Complete_cd Rcd :cd `=rails#app().path(<q-args>)`
1692
1693
  command! -buffer -bar -nargs=? -complete=customlist,s:Complete_cd Rlcd :lcd `=rails#app().path(<q-args>)`
1693
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rfind :call s:warn( 'Rfind has been deprecated in favor of :1R or :find' )|call s:Find(<count>,'<bang>' ,<f-args>)
1694
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find REfind :call s:warn('REfind has been deprecated in favor of :1RE or :find')|call s:Find(<count>,'E<bang>',<f-args>)
1695
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RSfind :call s:warn('RSfind has been deprecated in favor of :1RS or :find')|call s:Find(<count>,'S<bang>',<f-args>)
1696
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RVfind :call s:warn('RVfind has been deprecated in favor of :1RV or :find')|call s:Find(<count>,'V<bang>',<f-args>)
1697
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RTfind :call s:warn('RTfind has been deprecated in favor of :1RT or :find')|call s:Find(<count>,'T<bang>',<f-args>)
1698
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rsfind :call s:warn('Rsfind has been deprecated in favor of :1RS or :sfind')|<count>RSfind<bang> <args>
1699
- command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rtabfind :call s:warn('Rtabfind has been deprecated in favor of :1RT or :tabfind')|<count>RTfind<bang> <args>
1700
- command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit Redit :call s:warn( 'Redit has been deprecated in favor of :R')|call s:Edit(<count>,'<bang>' ,<f-args>)
1701
- command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit REedit :call s:warn('REedit has been deprecated in favor of :RE')|call s:Edit(<count>,'E<bang>',<f-args>)
1702
- command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RSedit :call s:warn('RSedit has been deprecated in favor of :RS')|call s:Edit(<count>,'S<bang>',<f-args>)
1703
- command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RVedit :call s:warn('RVedit has been deprecated in favor of :RV')|call s:Edit(<count>,'V<bang>',<f-args>)
1704
- command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RTedit :call s:warn('RTedit has been deprecated in favor of :RT')|call s:Edit(<count>,'T<bang>',<f-args>)
1705
- command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_edit RDedit :call s:warn('RDedit has been deprecated in favor of :RD')|call s:Edit(<count>,'<line1>D<bang>',<f-args>)
1694
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rfind :call s:Find(<count>,'<bang>' ,<f-args>)
1695
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find REfind :call s:Find(<count>,'E<bang>',<f-args>)
1696
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RSfind :call s:Find(<count>,'S<bang>',<f-args>)
1697
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RVfind :call s:Find(<count>,'V<bang>',<f-args>)
1698
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find RTfind :call s:Find(<count>,'T<bang>',<f-args>)
1699
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rsfind :<count>RSfind<bang> <args>
1700
+ command! -buffer -bar -nargs=* -count=1 -complete=customlist,s:Complete_find Rtabfind :<count>RTfind<bang> <args>
1701
+ command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit Redit :call s:Edit(<count>,'<bang>' ,<f-args>)
1702
+ command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit REedit :call s:Edit(<count>,'E<bang>',<f-args>)
1703
+ command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RSedit :call s:Edit(<count>,'S<bang>',<f-args>)
1704
+ command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RVedit :call s:Edit(<count>,'V<bang>',<f-args>)
1705
+ command! -buffer -bar -nargs=* -bang -complete=customlist,s:Complete_edit RTedit :call s:Edit(<count>,'T<bang>',<f-args>)
1706
+ command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_edit RDedit :call s:Edit(<count>,'<line1>D<bang>',<f-args>)
1706
1707
  command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_related A :call s:Alternate('<bang>', <line1>,<line2>,<count>,<f-args>)
1707
1708
  command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_related AE :call s:Alternate('E<bang>',<line1>,<line2>,<count>,<f-args>)
1708
1709
  command! -buffer -bar -nargs=* -range=0 -complete=customlist,s:Complete_related AS :call s:Alternate('S<bang>',<line1>,<line2>,<count>,<f-args>)
@@ -2134,7 +2135,6 @@ function! s:BufFinderCommands()
2134
2135
  call s:addfilecmds("controller")
2135
2136
  call s:addfilecmds("mailer")
2136
2137
  call s:addfilecmds("migration")
2137
- call s:addfilecmds("schema")
2138
2138
  call s:addfilecmds("observer")
2139
2139
  call s:addfilecmds("helper")
2140
2140
  call s:addfilecmds("layout")
@@ -2290,14 +2290,6 @@ function! s:migrationList(A,L,P)
2290
2290
  endif
2291
2291
  endfunction
2292
2292
 
2293
- function! s:schemaList(A,L,P)
2294
- let tables = s:readfile(rails#app().path('db/schema.rb'))
2295
- let table_re = '^\s\+create_table\s["'':]\zs[^"'',]*\ze'
2296
- call map(tables,'matchstr(v:val, table_re)')
2297
- call filter(tables,'strlen(v:val)')
2298
- return s:autocamelize(tables, a:A)
2299
- endfunction
2300
-
2301
2293
  function! s:unittestList(A,L,P)
2302
2294
  let found = []
2303
2295
  if rails#app().has('test')
@@ -2527,15 +2519,6 @@ function! s:migrationEdit(cmd,...)
2527
2519
  endif
2528
2520
  endfunction
2529
2521
 
2530
- function! s:schemaEdit(cmd,...)
2531
- let cmd = s:findcmdfor(a:cmd)
2532
- let schema = 'db/'.s:environment().'_structure.sql'
2533
- if rails#app().has_file('db/schema.rb') || !rails#app().has_file(schema)
2534
- let schema = 'db/schema.rb'
2535
- endif
2536
- call s:findedit(cmd,schema.(a:0 ? '#'.a:1 : ''))
2537
- endfunction
2538
-
2539
2522
  function! s:fixturesEdit(cmd,...)
2540
2523
  if a:0
2541
2524
  let c = rails#underscore(a:1)
@@ -3315,6 +3298,11 @@ function! s:Extract(bang,...) range abort
3315
3298
  silent! exe '%substitute?\%(\w\|[@:"'."'".'-]\)\@<!'.var.'\>?'.name.'?g'
3316
3299
  1
3317
3300
  endfunction
3301
+ " }}}1
3302
+
3303
+ " Extract into concern {{{1
3304
+ function! s:ExtractConcern(bang,...) range abort
3305
+ endfunction
3318
3306
 
3319
3307
  " }}}1
3320
3308
  " Migration Inversion {{{1
@@ -3494,26 +3482,26 @@ endfunction
3494
3482
 
3495
3483
  function! s:helpermethods()
3496
3484
  return ""
3497
- \."action_name atom_feed audio_path audio_tag auto_discovery_link_tag "
3498
- \."button_tag button_to button_to_function "
3499
- \."cache capture cdata_section check_box check_box_tag collection_select concat content_for content_tag content_tag_for controller controller_name controller_path convert_to_model cookies csrf_meta_tag csrf_meta_tags current_cycle cycle "
3500
- \."date_select datetime_select debug distance_of_time_in_words distance_of_time_in_words_to_now div_for dom_class dom_id "
3501
- \."email_field email_field_tag escape_javascript escape_once excerpt "
3502
- \."favicon_link_tag field_set_tag fields_for file_field file_field_tag flash form_for form_tag "
3485
+ \."atom_feed audio_path audio_tag auto_discovery_link_tag auto_link "
3486
+ \."button_to button_to_function "
3487
+ \."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 "
3488
+ \."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 "
3489
+ \."email_field email_field_tag error_message_on error_messages_for escape_javascript escape_once excerpt "
3490
+ \."favicon_link_tag field_set_tag fields_for file_field file_field_tag form form_for form_tag "
3503
3491
  \."grouped_collection_select grouped_options_for_select "
3504
- \."headers hidden_field hidden_field_tag highlight "
3505
- \."image_alt image_path image_submit_tag image_tag "
3506
- \."j javascript_cdata_section javascript_include_tag javascript_path javascript_tag "
3507
- \."l label label_tag link_to link_to_function link_to_if link_to_unless link_to_unless_current localize logger "
3492
+ \."hidden_field hidden_field_tag highlight "
3493
+ \."image_path image_submit_tag image_tag input "
3494
+ \."javascript_cdata_section javascript_include_tag javascript_path javascript_tag "
3495
+ \."l label label_tag link_to link_to_function link_to_if link_to_unless link_to_unless_current localize "
3508
3496
  \."mail_to "
3509
3497
  \."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 "
3510
3498
  \."option_groups_from_collection_for_select options_for_select options_from_collection_for_select "
3511
- \."params 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 provide "
3512
- \."radio_button radio_button_tag range_field range_field_tag raw render request request_forgery_protection_token reset_cycle response "
3513
- \."safe_concat safe_join 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 session simple_format strip_links strip_tags stylesheet_link_tag stylesheet_path submit_tag "
3514
- \."t tag telephone_field telephone_field_tag text_area text_area_tag text_field text_field_tag time_ago_in_words time_select time_tag time_zone_options_for_select time_zone_select translate truncate "
3515
- \."url_field url_field_tag url_for url_options "
3516
- \."video_path video_tag "
3499
+ \."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 "
3500
+ \."radio_button radio_button_tag range_field range_field_tag raw remote_function reset_cycle "
3501
+ \."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 "
3502
+ \."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 "
3503
+ \."update_page update_page_tag url_field url_field_tag url_for url_options "
3504
+ \."video_path video_tag visual_effect "
3517
3505
  \."word_wrap"
3518
3506
  endfunction
3519
3507
 
@@ -3580,23 +3568,24 @@ function! s:BufSyntax()
3580
3568
  syn keyword rubyRailsRenderMethod mail render
3581
3569
  syn keyword rubyRailsControllerMethod attachments default helper helper_attr helper_method
3582
3570
  endif
3571
+ if buffer.type_name('controller','view','helper')
3572
+ syn keyword rubyRailsMethod params request response session headers cookies flash
3573
+ syn keyword rubyRailsRenderMethod render
3574
+ syn keyword rubyRailsMethod logger polymorphic_path polymorphic_url
3575
+ endif
3583
3576
  if buffer.type_name('helper','view')
3584
- syn keyword rubyRailsViewMethod polymorphic_path polymorphic_url
3585
3577
  exe "syn keyword rubyRailsHelperMethod ".s:gsub(s:helpermethods(),'<%(content_for|select)\s+','')
3586
3578
  syn match rubyRailsHelperMethod '\<select\>\%(\s*{\|\s*do\>\|\s*(\=\s*&\)\@!'
3587
3579
  syn match rubyRailsHelperMethod '\<\%(content_for?\=\|current_page?\)'
3588
- syn match rubyRailsViewMethod '\.\@<!\<\(h\|html_escape\|u\|url_encode\)\>'
3580
+ syn match rubyRailsViewMethod '\.\@<!\<\(h\|html_escape\|u\|url_encode\|controller\)\>'
3589
3581
  if buffer.type_name('view-partial')
3590
3582
  syn keyword rubyRailsMethod local_assigns
3591
3583
  endif
3592
3584
  elseif buffer.type_name('controller')
3593
- syn keyword rubyRailsMethod params request response session headers cookies flash
3594
- syn keyword rubyRailsRenderMethod render
3595
- syn keyword rubyRailsMethod logger polymorphic_path polymorphic_url
3596
3585
  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
3597
3586
  syn keyword rubyRailsRenderMethod head redirect_to render_to_string respond_with
3598
3587
  syn match rubyRailsRenderMethod '\<respond_to\>?\@!'
3599
- 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 skip_filter
3588
+ 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
3600
3589
  syn keyword rubyRailsFilterMethod verify
3601
3590
  endif
3602
3591
  if buffer.type_name('db-migration','db-schema')
@@ -3614,13 +3603,13 @@ function! s:BufSyntax()
3614
3603
  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
3615
3604
  endif
3616
3605
  elseif buffer.type_name('spec')
3617
- syn keyword rubyRailsTestMethod describe context it its specify shared_examples_for it_should_behave_like before after around subject fixtures controller_name helper_name scenario feature background
3606
+ syn keyword rubyRailsTestMethod describe context it its specify shared_examples_for it_should_behave_like before after around subject fixtures controller_name helper_name
3618
3607
  syn match rubyRailsTestMethod '\<let\>!\='
3619
3608
  syn keyword rubyRailsTestMethod violated pending expect double mock mock_model stub_model
3620
3609
  syn match rubyRailsTestMethod '\.\@<!\<stub\>!\@!'
3621
3610
  if !buffer.type_name('spec-model')
3622
3611
  syn match rubyRailsTestControllerMethod '\.\@<!\<\%(get\|post\|put\|delete\|head\|process\|assigns\)\>'
3623
- syn keyword rubyRailsTestControllerMethod integrate_views render_views
3612
+ syn keyword rubyRailsTestControllerMethod integrate_views
3624
3613
  syn keyword rubyRailsMethod params request response session flash
3625
3614
  syn keyword rubyRailsMethod polymorphic_path polymorphic_url
3626
3615
  endif
@@ -3681,8 +3670,9 @@ function! s:BufSyntax()
3681
3670
  exe 'syn keyword '.&syntax.'RailsHelperMethod '.s:gsub(s:helpermethods(),'<%(content_for|select)\s+','').' contained containedin=@'.&syntax.'RailsRegions'
3682
3671
  exe 'syn match '.&syntax.'RailsHelperMethod "\<select\>\%(\s*{\|\s*do\>\|\s*(\=\s*&\)\@!" contained containedin=@'.&syntax.'RailsRegions'
3683
3672
  exe 'syn match '.&syntax.'RailsHelperMethod "\<\%(content_for?\=\|current_page?\)" contained containedin=@'.&syntax.'RailsRegions'
3684
- exe 'syn keyword '.&syntax.'RailsMethod debugger polymorphic_path polymorphic_url contained containedin=@'.&syntax.'RailsRegions'
3685
- exe 'syn match '.&syntax.'RailsViewMethod "\.\@<!\<\(h\|html_escape\|u\|url_encode\)\>" contained containedin=@'.&syntax.'RailsRegions'
3673
+ exe 'syn keyword '.&syntax.'RailsMethod debugger logger polymorphic_path polymorphic_url contained containedin=@'.&syntax.'RailsRegions'
3674
+ exe 'syn keyword '.&syntax.'RailsMethod params request response session headers cookies flash contained containedin=@'.&syntax.'RailsRegions'
3675
+ exe 'syn match '.&syntax.'RailsViewMethod "\.\@<!\<\(h\|html_escape\|u\|url_encode\|controller\)\>" contained containedin=@'.&syntax.'RailsRegions'
3686
3676
  if buffer.type_name('view-partial')
3687
3677
  exe 'syn keyword '.&syntax.'RailsMethod local_assigns contained containedin=@'.&syntax.'RailsRegions'
3688
3678
  endif
@@ -3699,10 +3689,10 @@ function! s:BufSyntax()
3699
3689
  syn include @rubyTop syntax/ruby.vim
3700
3690
  unlet g:main_syntax
3701
3691
  syn cluster yamlRailsRegions contains=yamlRailsOneLiner,yamlRailsBlock,yamlRailsExpression
3702
- syn region yamlRailsOneLiner matchgroup=yamlRailsDelimiter start="^%%\@!" end="$" contains=@rubyRailsTop containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment keepend oneline
3703
- syn region yamlRailsBlock matchgroup=yamlRailsDelimiter start="<%%\@!" end="%>" contains=@rubyTop containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment
3704
- syn region yamlRailsExpression matchgroup=yamlRailsDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment
3705
- syn region yamlRailsComment matchgroup=yamlRailsDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment keepend
3692
+ syn region yamlRailsOneLiner matchgroup=yamlRailsDelimiter start="^%%\@!" end="$" contains=@rubyRailsTop containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment keepend oneline
3693
+ syn region yamlRailsBlock matchgroup=yamlRailsDelimiter start="<%%\@!" end="%>" contains=@rubyTop containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment
3694
+ syn region yamlRailsExpression matchgroup=yamlRailsDelimiter start="<%=" end="%>" contains=@rubyTop containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment
3695
+ syn region yamlRailsComment matchgroup=yamlRailsDelimiter start="<%#" end="%>" contains=rubyTodo,@Spell containedin=ALLBUT,@yamlRailsRegions,yamlRailsComment keepend
3706
3696
  syn match yamlRailsMethod '\.\@<!\<\(h\|html_escape\|u\|url_encode\)\>' contained containedin=@yamlRailsRegions
3707
3697
  if classes != ''
3708
3698
  exe "syn keyword yamlRailsUserClass ".classes." contained containedin=@yamlRailsRegions"
@@ -3719,9 +3709,6 @@ function! s:BufSyntax()
3719
3709
  set isk+=$
3720
3710
  exe "syn keyword javascriptRailsFunction ".s:javascript_functions
3721
3711
 
3722
- elseif &syntax == "scss" || &syntax == "sass"
3723
- syn match sassFunction "\<\%(\%(asset\|image\|font\|video\|audio\|javascript\|stylesheet\)-\%(url\|path\)\)\>(\@=" contained
3724
- syn match sassFunction "\<\asset-data-url\>(\@=" contained
3725
3712
  endif
3726
3713
  endif
3727
3714
  call s:HiDefaults()
@@ -3827,10 +3814,12 @@ endfunction
3827
3814
  " Mappings {{{1
3828
3815
 
3829
3816
  function! s:BufMappings()
3830
- nnoremap <buffer> <silent> <Plug>RailsFind :<C-U>call <SID>Find(v:count1,'E')<CR>
3831
- nnoremap <buffer> <silent> <Plug>RailsSplitFind :<C-U>call <SID>Find(v:count1,'S')<CR>
3832
- nnoremap <buffer> <silent> <Plug>RailsVSplitFind :<C-U>call <SID>Find(v:count1,'V')<CR>
3833
- nnoremap <buffer> <silent> <Plug>RailsTabFind :<C-U>call <SID>Find(v:count1,'T')<CR>
3817
+ nnoremap <buffer> <silent> <Plug>RailsAlternate :<C-U>A<CR>
3818
+ nnoremap <buffer> <silent> <Plug>RailsRelated :<C-U>R<CR>
3819
+ nnoremap <buffer> <silent> <Plug>RailsFind :<C-U>REfind<CR>
3820
+ nnoremap <buffer> <silent> <Plug>RailsSplitFind :<C-U>RSfind<CR>
3821
+ nnoremap <buffer> <silent> <Plug>RailsVSplitFind :<C-U>RVfind<CR>
3822
+ nnoremap <buffer> <silent> <Plug>RailsTabFind :<C-U>RTfind<CR>
3834
3823
  if g:rails_mappings
3835
3824
  if !hasmapto("<Plug>RailsFind")
3836
3825
  nmap <buffer> gf <Plug>RailsFind
@@ -3841,6 +3830,12 @@ function! s:BufMappings()
3841
3830
  if !hasmapto("<Plug>RailsTabFind")
3842
3831
  nmap <buffer> <C-W>gf <Plug>RailsTabFind
3843
3832
  endif
3833
+ if !hasmapto("<Plug>RailsAlternate")
3834
+ nmap <buffer> [f <Plug>RailsAlternate
3835
+ endif
3836
+ if !hasmapto("<Plug>RailsRelated")
3837
+ nmap <buffer> ]f <Plug>RailsRelated
3838
+ endif
3844
3839
  if exists("$CREAM")
3845
3840
  imap <buffer> <C-CR> <C-O><Plug>RailsFind
3846
3841
  imap <buffer> <M-[> <C-O><Plug>RailsAlternate
@@ -4021,15 +4016,15 @@ function! s:BufAbbreviations()
4021
4016
  Rabbrev coo[ cookies
4022
4017
  Rabbrev fl[ flash
4023
4018
  Rabbrev rr( render
4024
- Rabbrev ra( render :action\ =>\
4025
- Rabbrev rc( render :controller\ =>\
4026
- Rabbrev rf( render :file\ =>\
4027
- Rabbrev ri( render :inline\ =>\
4028
- Rabbrev rj( render :json\ =>\
4029
- Rabbrev rl( render :layout\ =>\
4030
- Rabbrev rp( render :partial\ =>\
4031
- Rabbrev rt( render :text\ =>\
4032
- Rabbrev rx( render :xml\ =>\
4019
+ Rabbrev ra( render :action\ =>\
4020
+ Rabbrev rc( render :controller\ =>\
4021
+ Rabbrev rf( render :file\ =>\
4022
+ Rabbrev ri( render :inline\ =>\
4023
+ Rabbrev rj( render :json\ =>\
4024
+ Rabbrev rl( render :layout\ =>\
4025
+ Rabbrev rp( render :partial\ =>\
4026
+ Rabbrev rt( render :text\ =>\
4027
+ Rabbrev rx( render :xml\ =>\
4033
4028
  endif
4034
4029
  if buffer.type_name('view','helper')
4035
4030
  Rabbrev dotiw distance_of_time_in_words
@@ -4037,8 +4032,8 @@ function! s:BufAbbreviations()
4037
4032
  endif
4038
4033
  if buffer.type_name('controller')
4039
4034
  Rabbrev re( redirect_to
4040
- Rabbrev rea( redirect_to :action\ =>\
4041
- Rabbrev rec( redirect_to :controller\ =>\
4035
+ Rabbrev rea( redirect_to :action\ =>\
4036
+ Rabbrev rec( redirect_to :controller\ =>\
4042
4037
  Rabbrev rst( respond_to
4043
4038
  endif
4044
4039
  if buffer.type_name() ==# 'model' || buffer.type_name('model-arb')
@@ -4076,13 +4071,13 @@ function! s:BufAbbreviations()
4076
4071
  Rabbrev asre( assert_response
4077
4072
  Rabbrev art( assert_redirected_to
4078
4073
  endif
4079
- Rabbrev :a :action\ =>\
4074
+ Rabbrev :a :action\ =>\
4080
4075
  " hax
4081
- Rabbrev :c :co________\ =>\
4076
+ Rabbrev :c :co________\ =>\
4082
4077
  inoreabbrev <buffer> <silent> :c <C-R>=<SID>TheCWord()<CR>
4083
- Rabbrev :i :id\ =>\
4084
- Rabbrev :o :object\ =>\
4085
- Rabbrev :p :partial\ =>\
4078
+ Rabbrev :i :id\ =>\
4079
+ Rabbrev :o :object\ =>\
4080
+ Rabbrev :p :partial\ =>\
4086
4081
  Rabbrev logd( logger.debug
4087
4082
  Rabbrev logi( logger.info
4088
4083
  Rabbrev logw( logger.warn
@@ -4375,7 +4370,7 @@ function! RailsBufInit(path)
4375
4370
  call app.source_callback("config/syntax.vim")
4376
4371
  if expand('%:t') =~ '\.yml\.example$'
4377
4372
  setlocal filetype=yaml
4378
- elseif expand('%:e') =~ '^\%(rjs\|rxml\|builder\|jbuilder\)$'
4373
+ elseif expand('%:e') =~ '^\%(rjs\|rxml\|builder\)$'
4379
4374
  setlocal filetype=ruby
4380
4375
  elseif firsttime
4381
4376
  " Activate custom syntax
@@ -4474,7 +4469,7 @@ function! s:BufSettings()
4474
4469
  call self.setvar('&includeexpr','RailsIncludeexpr()')
4475
4470
  call self.setvar('&suffixesadd', ".rb,.".join(s:view_types,',.'))
4476
4471
  let ft = self.getvar('&filetype')
4477
- if ft =~ '^\%(e\=ruby\|[yh]aml\|coffee\|css\|s[ac]ss\|lesscss\)$'
4472
+ if ft =~ '^\%(e\=ruby\|[yh]aml\|javascript\|coffee\|css\|s[ac]ss\|lesscss\)$'
4478
4473
  call self.setvar('&shiftwidth',2)
4479
4474
  call self.setvar('&softtabstop',2)
4480
4475
  call self.setvar('&expandtab',1)
@@ -4559,7 +4554,9 @@ augroup railsPluginAuto
4559
4554
  autocmd BufWritePost */tasks/**.rake call rails#cache_clear("rake_tasks")
4560
4555
  autocmd BufWritePost */generators/** call rails#cache_clear("generators")
4561
4556
  autocmd FileType * if exists("b:rails_root") | call s:BufSettings() | endif
4562
- autocmd Syntax ruby,eruby,yaml,haml,javascript,coffee,railslog,sass,scss if exists("b:rails_root") | call s:BufSyntax() | endif
4557
+ autocmd Syntax ruby,eruby,yaml,haml,javascript,coffee,railslog if exists("b:rails_root") | call s:BufSyntax() | endif
4558
+ autocmd QuickFixCmdPre *make* call s:push_chdir()
4559
+ autocmd QuickFixCmdPost *make* call s:pop_command()
4563
4560
  augroup END
4564
4561
 
4565
4562
  " }}}1