Skip to content

Commit

Permalink
On session restore, maintain cwd after loading NERDTree
Browse files Browse the repository at this point in the history
From Matthew:

  There's a NERDTree option which will change the working directory to
  its root directory when opened. Our sessions should keep their working
  directory despite this option.

  This change records the working directory before loading NERDTree,
  load it, then cd to this saved directory.

Pull request #37: #37
  • Loading branch information
xolox committed Apr 20, 2013
1 parent db3f793 commit d9ecc6a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions autoload/xolox/session.vim
Expand Up @@ -3,7 +3,7 @@
" Last Change: April 20, 2013
" URL: http://peterodding.com/code/vim/session/

let g:xolox#session#version = '1.5.4'
let g:xolox#session#version = '1.5.5'

" Public API for session persistence. {{{1

Expand Down Expand Up @@ -208,7 +208,8 @@ function! s:check_special_window(session)
endif
if exists('command')
call s:jump_to_window(a:session, tabpagenr(), winnr())
call add(a:session, 'let s:bufnr = bufnr("%")')
call add(a:session, 'let s:bufnr_save = bufnr("%")')
call add(a:session, 'let s:cwd_save = getcwd()')
if argument == ''
call add(a:session, command)
else
Expand All @@ -218,7 +219,8 @@ function! s:check_special_window(session)
endif
call add(a:session, command . ' ' . fnameescape(argument))
endif
call add(a:session, 'execute "bwipeout" s:bufnr')
call add(a:session, 'execute "bwipeout" s:bufnr_save')
call add(a:session, 'execute "cd" fnameescape(s:cwd_save)')
return 1
endif
endfunction
Expand Down

0 comments on commit d9ecc6a

Please sign in to comment.