diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/rails_locale_alternate.vim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/autoload/rails_locale_alternate.vim b/autoload/rails_locale_alternate.vim index bf33b89..10bebe1 100644 --- a/autoload/rails_locale_alternate.vim +++ b/autoload/rails_locale_alternate.vim @@ -1,3 +1,8 @@ +" Transform the current filename into a variant with key. +" +" Example: +" config/locales/posts.en.yml +" s:AlternateLocale('fr') => 'config/locales/posts.fr.yml' function! s:AlternateLocale(key) let filename = expand('%') let alternate = substitute(filename, '\a\{2}\.yml', a:key . '.yml', '') @@ -5,11 +10,14 @@ function! s:AlternateLocale(key) endfunction +" Open a new split window containing the file named `s:AlternateLocale(a:key)` function! s:SplitAlternate(key, modifiers) execute a:modifiers . ' split ' . s:AlternateLocale(a:key) endfunction +" Create user-facing commands to open the alternate locale file in a different +" window configurations. 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>) |