Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

let s:terminal_view can be called from TerminalClose directly #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions plugin/terminal_help.vim
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ function! s:project_root()
return s:find_root(name, g:terminal_rootmarkers, 0)
endfunc

function! s:terminal_view(mode)
if a:mode == 0
let w:__terminal_view__ = winsaveview()
elseif exists('w:__terminal_view__')
call winrestview(w:__terminal_view__)
unlet w:__terminal_view__
endif
endfunc

"----------------------------------------------------------------------
" open a new/previous terminal
Expand All @@ -119,14 +127,6 @@ function! TerminalOpen(...)
let pos = get(g:, 'terminal_pos', 'rightbelow')
let height = get(g:, 'terminal_height', 10)
let succeed = 0
function! s:terminal_view(mode)
if a:mode == 0
let w:__terminal_view__ = winsaveview()
elseif exists('w:__terminal_view__')
call winrestview(w:__terminal_view__)
unlet w:__terminal_view__
endif
endfunc
let uid = win_getid()
keepalt noautocmd windo call s:terminal_view(0)
keepalt noautocmd call win_gotoid(uid)
Expand Down