Skip to content

Commit d9ecc6a

Browse files
committed
On session restore, maintain cwd after loading NERDTree
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
1 parent db3f793 commit d9ecc6a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

autoload/xolox/session.vim

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Last Change: April 20, 2013
44
" URL: http://peterodding.com/code/vim/session/
55

6-
let g:xolox#session#version = '1.5.4'
6+
let g:xolox#session#version = '1.5.5'
77

88
" Public API for session persistence. {{{1
99

@@ -208,7 +208,8 @@ function! s:check_special_window(session)
208208
endif
209209
if exists('command')
210210
call s:jump_to_window(a:session, tabpagenr(), winnr())
211-
call add(a:session, 'let s:bufnr = bufnr("%")')
211+
call add(a:session, 'let s:bufnr_save = bufnr("%")')
212+
call add(a:session, 'let s:cwd_save = getcwd()')
212213
if argument == ''
213214
call add(a:session, command)
214215
else
@@ -218,7 +219,8 @@ function! s:check_special_window(session)
218219
endif
219220
call add(a:session, command . ' ' . fnameescape(argument))
220221
endif
221-
call add(a:session, 'execute "bwipeout" s:bufnr')
222+
call add(a:session, 'execute "bwipeout" s:bufnr_save')
223+
call add(a:session, 'execute "cd" fnameescape(s:cwd_save)')
222224
return 1
223225
endif
224226
endfunction

0 commit comments

Comments
 (0)