Skip to content

Commit

Permalink
Alternate implementation of "back to inital tab" (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
christianrondeau authored and junegunn committed Jan 20, 2017
1 parent eab0d5b commit 48b36ca
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions autoload/vader/window.vim
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@ function! vader#window#open()
let s:console_buffered = []
let b:vader_data = {}
nnoremap <silent> <buffer> <CR> :call <SID>action(line('.'))<CR>
if s:prev_winid
augroup vader/return
autocmd!
autocmd BufHidden <buffer>
\ let [s:t, s:w] = win_id2tabwin(s:prev_winid)
\| if s:t
\| execute printf('tabnext %d | %dwincmd w', s:t, s:w)
\| endif
\| autocmd! vader/return
augroup END
endif
tabnew
setlocal buftype=nofile
Expand Down Expand Up @@ -128,7 +117,7 @@ function! vader#window#cleanup()
execute 'silent! bd' s:workbench_bfr
call s:switch_to_console()
setlocal nomodifiable
nnoremap <silent> <buffer> q :tabclose<CR>
nnoremap <silent> <buffer> q :call <SID>quit()<CR><CR>
normal! Gzb
endfunction

Expand All @@ -138,7 +127,7 @@ function! vader#window#copen()
1wincmd w
normal! Gzb
2wincmd w
nnoremap <silent> <buffer> q :tabclose<CR>
nnoremap <silent> <buffer> q :call <SID>quit()<CR><CR>
nnoremap <silent> <buffer> <CR> :call <SID>move()<CR><CR>
endfunction

Expand Down Expand Up @@ -199,3 +188,14 @@ function! s:move()
execute wq . 'wincmd w'
endif
endfunction

function! s:quit()
if s:prev_winid
let [s:t, s:w] = win_id2tabwin(s:prev_winid)
if s:t
execute printf('tabnext %d | %dwincmd w | %dtabclose', s:t, s:w, s:console_tab)
return
endif
endif
tabclose
endfunction

0 comments on commit 48b36ca

Please sign in to comment.