Skip to content

Commit c67b421

Browse files
committed
let s:terminal_view can be called from TerminalClose directly
1 parent 4ae1772 commit c67b421

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

plugin/terminal_help.vim

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ function! s:project_root()
110110
return s:find_root(name, g:terminal_rootmarkers, 0)
111111
endfunc
112112

113+
function! s:terminal_view(mode)
114+
if a:mode == 0
115+
let w:__terminal_view__ = winsaveview()
116+
elseif exists('w:__terminal_view__')
117+
call winrestview(w:__terminal_view__)
118+
unlet w:__terminal_view__
119+
endif
120+
endfunc
113121

114122
"----------------------------------------------------------------------
115123
" open a new/previous terminal
@@ -119,14 +127,6 @@ function! TerminalOpen(...)
119127
let pos = get(g:, 'terminal_pos', 'rightbelow')
120128
let height = get(g:, 'terminal_height', 10)
121129
let succeed = 0
122-
function! s:terminal_view(mode)
123-
if a:mode == 0
124-
let w:__terminal_view__ = winsaveview()
125-
elseif exists('w:__terminal_view__')
126-
call winrestview(w:__terminal_view__)
127-
unlet w:__terminal_view__
128-
endif
129-
endfunc
130130
let uid = win_getid()
131131
keepalt noautocmd windo call s:terminal_view(0)
132132
keepalt noautocmd call win_gotoid(uid)

0 commit comments

Comments
 (0)