diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/rails_locale_alternate.vim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/autoload/rails_locale_alternate.vim b/autoload/rails_locale_alternate.vim new file mode 100644 index 0000000..bf33b89 --- /dev/null +++ b/autoload/rails_locale_alternate.vim @@ -0,0 +1,18 @@ +function! s:AlternateLocale(key) + let filename = expand('%') + let alternate = substitute(filename, '\a\{2}\.yml', a:key . '.yml', '') + return alternate +endfunction + + +function! s:SplitAlternate(key, modifiers) + execute a:modifiers . ' split ' . s:AlternateLocale(a:key) +endfunction + + +function! rails_locale_alternate#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 |