diff options
author | Teddy Wing | 2018-03-05 21:09:41 +0100 |
---|---|---|
committer | Teddy Wing | 2018-03-05 21:09:41 +0100 |
commit | df89401ff6be8139c5be836f808a41984b3241c2 (patch) | |
tree | 7a0e3ff3031186ad9305c29c0731b6db9285b566 | |
parent | d1d8c6405a8241362c20c7d666d74c2c05863741 (diff) | |
download | vim-rails-locale-alternate-df89401ff6be8139c5be836f808a41984b3241c2.tar.bz2 |
Add comments to functions to describe what they do
-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>) |