Skip to content

Commit

Permalink
Try to restore quick-fix windows...
Browse files Browse the repository at this point in the history
The code seems simple enough and in fact works most of the time. The
problem is that it doesn't always work. I've added it anyway because
of its added value to my (and presumably others) work flow. If and when
I find a more reliable way to restore quick-fix windows I can always
switch to that.
  • Loading branch information
xolox committed Dec 25, 2010
1 parent 79c1823 commit 46962c2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
18 changes: 13 additions & 5 deletions autoload.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
" Vim script
" Author: Peter Odding
" Last Change: December 20, 2010
" Last Change: December 25, 2010
" URL: http://peterodding.com/code/vim/session/

let s:script = expand('<sfile>:p:~')
Expand Down Expand Up @@ -113,6 +113,7 @@ function! session#save_special_windows(session)
if exists('g:loaded_nerd_tree') && match(a:session, '\<NERD_tree_\d\+$') >= 0
\ || exists(':Project') == 2 && exists('g:proj_running')
\ || exists('g:loaded_netrw') && match(a:session, '^file sftp://')
\ || !empty(getqflist())
let tabpage = tabpagenr()
let window = winnr()
try
Expand Down Expand Up @@ -147,17 +148,24 @@ function! s:check_special_window(session)
elseif &filetype == 'netrw'
let command = 'edit'
let argument = bufname('%')
elseif &buftype == 'quickfix'
let command = 'cwindow'
let argument = ''
endif
if exists('command')
call s:jump_to_window(a:session, tabpagenr(), winnr())
if command != 'edit'
call add(a:session, 'bwipeout')
endif
let argument = fnamemodify(argument, ':~')
if &sessionoptions =~ '\<slash\>'
let argument = substitute(argument, '\', '/', 'g')
if argument == ''
call add(a:session, command)
else
let argument = fnamemodify(argument, ':~')
if &sessionoptions =~ '\<slash\>'
let argument = substitute(argument, '\', '/', 'g')
endif
call add(a:session, command . ' ' . fnameescape(argument))
endif
call add(a:session, command . ' ' . fnameescape(argument))
return 1
endif
endfunction
Expand Down
4 changes: 2 additions & 2 deletions session.vim
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
" Vim script
" Author: Peter Odding
" Last Change: December 20, 2010
" Last Change: December 25, 2010
" URL: http://peterodding.com/code/vim/session/
" Version: 1.3.5
" Version: 1.3.6

" Support for automatic update using the GLVS plug-in.
" GetLatestVimScripts: 3150 1 :AutoInstall: session.zip
Expand Down

0 comments on commit 46962c2

Please sign in to comment.