diff options
author | w0rp <w0rp@users.noreply.github.com> | 2018-12-20 16:15:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-20 16:15:57 +0000 |
commit | 5345a5dd81513f68f7b45258a5ca1e0010cb1d35 (patch) | |
tree | ae1294a8f9b4e5b240fdc4148aab59a04f7351ff /autoload | |
parent | f1ed654ca5318de5a24b37d882e55e04e4e566c8 (diff) | |
parent | 73a204dd006c1ad1d7562e5970dbb41975b94727 (diff) | |
download | ale-5345a5dd81513f68f7b45258a5ca1e0010cb1d35.zip |
Merge pull request #2141 from benjaminjkraft/master
Add versions of ALEGoToDefinition that open in splits
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 |