aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugin/rails_locale_alternate.vim16
1 files changed, 12 insertions, 4 deletions
diff --git a/plugin/rails_locale_alternate.vim b/plugin/rails_locale_alternate.vim
index 0fa0d23..b0a82f0 100644
--- a/plugin/rails_locale_alternate.vim
+++ b/plugin/rails_locale_alternate.vim
@@ -10,7 +10,15 @@ function! s:SplitAlternate(key, modifiers)
endfunction
-command! -buffer -nargs=1 RailsLocaleAlternate :call s:SplitAlternate(<q-args>, <q-mods>)
-command! -buffer -nargs=1 ERailsLocaleAlternate :execute 'edit ' . s:AlternateLocale(<q-args>)
-command! -buffer -nargs=1 SRailsLocaleAlternate :call s:SplitAlternate(<q-args>, '')
-command! -buffer -nargs=1 VRailsLocaleAlternate :call s:SplitAlternate(<q-args>, 'vertical')
+function! s:CreateCommands()
+ command! -buffer -nargs=1 RailsLocaleAlternate :call s:SplitAlternate(<q-args>, <q-mods>)
+ command! -buffer -nargs=1 ERailsLocaleAlternate :execute 'edit ' . s:AlternateLocale(<q-args>)
+ command! -buffer -nargs=1 SRailsLocaleAlternate :call s:SplitAlternate(<q-args>, '')
+ command! -buffer -nargs=1 VRailsLocaleAlternate :call s:SplitAlternate(<q-args>, 'vertical')
+endfunction
+
+augroup rails_locale_alternate
+ autocmd!
+
+ autocmd BufNewFile,BufRead config/locales/*.\a\a.yml call s:CreateCommands()
+augroup END