Skip to content

Commit af42e0b

Browse files
floatwin: use win_execute in NeoVim for commands when it exists (#4532)
1 parent 0bc2ea0 commit af42e0b

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

autoload/ale/floating_preview.vim

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,21 @@ function! s:NvimShow(lines, options) abort
3737
endif
3838

3939
" Execute commands in window context
40-
let l:parent_window = nvim_get_current_win()
40+
if exists('*win_execute')
41+
for l:command in get(a:options, 'commands', [])
42+
call win_execute(w:preview['id'], l:command)
43+
endfor
44+
else
45+
let l:parent_window = nvim_get_current_win()
4146

42-
call nvim_set_current_win(w:preview['id'])
47+
call nvim_set_current_win(w:preview['id'])
4348

44-
for l:command in get(a:options, 'commands', [])
45-
call execute(l:command)
46-
endfor
49+
for l:command in get(a:options, 'commands', [])
50+
call execute(l:command)
51+
endfor
4752

48-
call nvim_set_current_win(l:parent_window)
53+
call nvim_set_current_win(l:parent_window)
54+
endif
4955

5056
" Return to parent context on move
5157
augroup ale_floating_preview_window

0 commit comments

Comments
 (0)