diff options
author | Oskar Haarklou Veileborg <ohv1020@hotmail.com> | 2023-08-01 22:30:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-01 21:30:23 +0100 |
commit | af42e0b510365bb137567336386262565150f26b (patch) | |
tree | 83409dcfcb844d6fdd3c633954980e52225636c1 | |
parent | 0bc2ea0800f5be8aa3ea83d7dbf5a3e1df05217d (diff) | |
download | ale-af42e0b510365bb137567336386262565150f26b.zip |
floatwin: use win_execute in NeoVim for commands when it exists (#4532)
-rw-r--r-- | autoload/ale/floating_preview.vim | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/autoload/ale/floating_preview.vim b/autoload/ale/floating_preview.vim index d9172150..970a9b30 100644 --- a/autoload/ale/floating_preview.vim +++ b/autoload/ale/floating_preview.vim @@ -37,15 +37,21 @@ function! s:NvimShow(lines, options) abort endif " Execute commands in window context - let l:parent_window = nvim_get_current_win() + if exists('*win_execute') + for l:command in get(a:options, 'commands', []) + call win_execute(w:preview['id'], l:command) + endfor + else + let l:parent_window = nvim_get_current_win() - call nvim_set_current_win(w:preview['id']) + call nvim_set_current_win(w:preview['id']) - for l:command in get(a:options, 'commands', []) - call execute(l:command) - endfor + for l:command in get(a:options, 'commands', []) + call execute(l:command) + endfor - call nvim_set_current_win(l:parent_window) + call nvim_set_current_win(l:parent_window) + endif " Return to parent context on move augroup ale_floating_preview_window |