Skip to content

Commit 3d1e875

Browse files
committed
Remove default position option
Use window split mods only
1 parent e44085b commit 3d1e875

File tree

3 files changed

+7
-50
lines changed

3 files changed

+7
-50
lines changed

autoload/i18n_rails.vim

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,6 @@
66
" Licence: BSD-3-Clause
77
" ==============================================================
88

9-
let s:positions = {
10-
\ 'current': 'edit',
11-
\ 'tab': 'tabedit',
12-
\ 'top': 'leftabove split',
13-
\ 'bottom': 'rightbelow split',
14-
\ 'left': 'leftabove vsplit',
15-
\ 'right': 'rightbelow vsplit',
16-
\ 'top-full': 'topleft split',
17-
\ 'bottom-full': 'botright split',
18-
\ 'left-full': 'topleft vsplit',
19-
\ 'right-full': 'botright vsplit'
20-
\ }
21-
229
let s:errors_messages = {
2310
\ 'directory': "Directory '{directory}' does not exists!",
2411
\ 'file': "File '{file}' does not exists!",
@@ -71,7 +58,7 @@ func! i18n_rails#translations(has_selection) abort
7158
endif
7259
endfunc
7360

74-
func! i18n_rails#open(has_selection, split) abort
61+
func! i18n_rails#open(has_selection, mods) abort
7562
let l:locale_directory = s:locale_directory()
7663
if !isdirectory(l:locale_directory)
7764
call s:show_error(s:errors_messages.directory, { 'directory': l:locale_directory }) | return
@@ -91,7 +78,7 @@ func! i18n_rails#open(has_selection, split) abort
9178
if s:is_empty(l:line_number)
9279
call s:show_error(s:errors_messages.translation, { 'locale_key': l:locale_key })
9380
else
94-
call s:open_locale(l:locale_file, a:split)
81+
call s:open_locale(l:locale_file, a:mods)
9582
call s:goto_line(l:line_number)
9683
endif
9784
endfunc
@@ -212,17 +199,8 @@ func! s:selection()
212199
endtry
213200
endfunc
214201

215-
func! s:open_locale(locale_file, split) abort
216-
let l:position = s:position(a:split)
217-
silent exec l:split . a:locale_file
218-
endfunc
219-
220-
func! s:position(split)
221-
if len(a:split)
222-
return a:split . ' split'
223-
endif
224-
225-
return get(s:positions, g:i18n_rails_position, s:positions.tab)
202+
func! s:open_locale(locale_file, mods) abort
203+
silent exec a:mods . ' split ' . a:locale_file
226204
endfunc
227205

228206
func! s:goto_line(line_number)

doc/i18n_rails.txt

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ COMMANDS *vim-i18n-rails-commands*
5454
*:I18nOpen*
5555

5656
:I18nOpen Open locale file on a line with translation.
57+
Window split modes (|leftabove|, |rightbelow|,
58+
|topleft|, |botright|, |vsplit|, |tab|, etc)
59+
are available.
5760

5861
===============================================================================
5962
OPTIONS *vim-i18n-rails-options*
@@ -64,26 +67,6 @@ Name of the default locale.
6467

6568
Default value: ''
6669

67-
*g:I18n_rails_position*
68-
69-
A position where locale file will be opened.
70-
71-
current - edit
72-
tab - tabedit
73-
top - leftabove split
74-
bottom - rightbelow split
75-
left - leftabove vsplit
76-
right - rightbelow vsplit
77-
top-full - topleft split
78-
bottom-full - botright split
79-
left-full - topleft vsplit
80-
right-full - botright vsplit
81-
82-
Possible values: 'current', 'tab', 'top', 'bottom', 'left', 'right',
83-
'top-full', 'bottom-full', 'left-full', 'right-full'
84-
85-
Default value: 'tab'
86-
8770
*g:i18n_rails_mappings*
8871

8972
Default mappings for all locales window.

plugin/i18n_rails.vim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ if !exists('g:i18n_rails_default_locale')
1515
let g:i18n_rails_default_locale = ''
1616
endif
1717

18-
if !exists('g:i18n_rails_position')
19-
let g:i18n_rails_position = 'tab'
20-
endif
21-
2218
let s:default_mappings = {
2319
\ 'o': '<CR>',
2420
\ 'O': '<CR><C-W>p<C-W>c',

0 commit comments

Comments
 (0)