From 0baa8a98fbca4972cfc13475f3461ffd164b94ac Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Mon, 5 Mar 2018 20:22:33 +0100 Subject: Add commands to open an alternate Rails locale file Two new commands that will open an alternate Rails locale file in either a horizontal or vertical split. Takes the current filename and replaces the two-letter language code with the argument given to the command. --- ftplugin/ruby_rails_locale_alternate.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ftplugin/ruby_rails_locale_alternate.vim diff --git a/ftplugin/ruby_rails_locale_alternate.vim b/ftplugin/ruby_rails_locale_alternate.vim new file mode 100644 index 0000000..ef4934b --- /dev/null +++ b/ftplugin/ruby_rails_locale_alternate.vim @@ -0,0 +1,14 @@ +function! s:AlternateLocale(key) + let filename = expand('%') + let alternate = substitute(filename, '..\.yml', a:key . '.yml', '') + return alternate +endfunction + + +function! s:SplitAlternate(key) + execute 'split ' . s:AlternateLocale(a:key) +endfunction + + +command! -buffer -nargs=1 SRailsLocaleAlternate :call s:SplitAlternate() +command! -buffer -nargs=1 VRailsLocaleAlternate :call s:SplitAlternate() -- cgit v1.2.3