diff options
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/definition.vim | 2 | ||||
-rw-r--r-- | autoload/ale/util.vim | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/autoload/ale/definition.vim b/autoload/ale/definition.vim index 984a4f9d..79d12596 100644 --- a/autoload/ale/definition.vim +++ b/autoload/ale/definition.vim @@ -86,7 +86,7 @@ function! s:OnReady(linter, lsp_details, line, column, options, ...) abort let l:request_id = ale#lsp#Send(l:id, l:message) let s:go_to_definition_map[l:request_id] = { - \ 'open_in_tab': get(a:options, 'open_in_tab', 0), + \ 'open_in': get(a:options, 'open_in', 'current-buffer'), \} endfunction diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim index bb478957..ee9359f8 100644 --- a/autoload/ale/util.vim +++ b/autoload/ale/util.vim @@ -87,12 +87,25 @@ function! ale#util#GetFunction(string_or_ref) abort return a:string_or_ref endfunction +" Open the file (at the given line). +" options['open_in'] can be: +" current-buffer (default) +" tab +" vertical-split +" horizontal-split function! ale#util#Open(filename, line, column, options) abort - if get(a:options, 'open_in_tab', 0) - call ale#util#Execute('tabedit +' . a:line . ' ' . fnameescape(a:filename)) + let l:open_in = get(a:options, 'open_in', 'current-buffer') + let l:args_to_open = '+' . a:line . ' ' . fnameescape(a:filename) + + if l:open_in is# 'tab' + call ale#util#Execute('tabedit ' . l:args_to_open) + elseif l:open_in is# 'horizontal-split' + call ale#util#Execute('split ' . l:args_to_open) + elseif l:open_in is# 'vertical-split' + call ale#util#Execute('vsplit ' . l:args_to_open) elseif bufnr(a:filename) isnot bufnr('') " Open another file only if we need to. - call ale#util#Execute('edit +' . a:line . ' ' . fnameescape(a:filename)) + call ale#util#Execute('edit ' . l:args_to_open) else normal! m` endif |