Skip to content

Commit c678c7e

Browse files
authored
Merge pull request #95 from mizlan/master
Fix some problems with PR #94
2 parents a997a8f + 34c5224 commit c678c7e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

autoload/nnn.vim

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,17 @@ function! s:switch_back(opts, Cmd)
233233
\ || (type(l:layout) != v:t_string
234234
\ || (type(l:layout) == v:t_string && l:layout != 'enew'))
235235
" delete the nnn window and buffer
236-
if has('nvim')
237-
if nvim_win_is_valid(l:term_wins.term.winhandle)
238-
call nvim_win_close(l:term_wins.term.winhandle, v:false)
236+
try
237+
if has('nvim')
238+
if nvim_win_is_valid(l:term_wins.term.winhandle)
239+
call nvim_win_close(l:term_wins.term.winhandle, v:false)
240+
endif
241+
else
242+
execute win_id2win(l:term_wins.term.winhandle) . 'close'
239243
endif
240-
else
241-
call popup_close(l:term_wins.term.winhandle)
242-
endif
244+
catch /E444: Cannot close last window/
245+
" In case Vim complains it is the last window, fail silently.
246+
endtry
243247
if bufexists(l:term_wins.term.buf)
244248
execute 'bwipeout!' l:term_wins.term.buf
245249
endif

0 commit comments

Comments
 (0)