File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments