Automatisches laden und speichern von Sessions im Projekt

git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@145 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69
This commit is contained in:
stefan 2007-08-02 12:23:25 +00:00
parent 430d581779
commit a649161e03
2 changed files with 38 additions and 19 deletions

View File

@ -18,6 +18,7 @@ function s:ReportRev(Rev)
echo 'Neu seit Rev: 129' echo 'Neu seit Rev: 129'
echo 'Projekt laden über project.vim' echo 'Projekt laden über project.vim'
echo 'Einstellungen bleiben gespeichert' echo 'Einstellungen bleiben gespeichert'
echo 'Session wird im Projekt gespeichert, wenn g:sessionfile von project.vim gesetzt wird'
elseif a:Rev >= '129' elseif a:Rev >= '129'
echo 'Neu seit Rev: 129' echo 'Neu seit Rev: 129'
echo 'Tags für BMS-X' echo 'Tags für BMS-X'

View File

@ -122,12 +122,17 @@ function s:SetProject(projectfile)
let g:basedir = fnamemodify(projectfilePath, ':p:h') let g:basedir = fnamemodify(projectfilePath, ':p:h')
let projectfileName = fnamemodify(projectfilePath, ':t') let projectfileName = fnamemodify(projectfilePath, ':t')
" test if projectfile is a batch-script
let ext = fnamemodify(projectfileName, ':e') let ext = fnamemodify(projectfileName, ':e')
if ext == 'vim' if ext == 'vim'
" Projectfile is a vimscript. Execute and end
try
execute 'source ' . projectfilePath execute 'source ' . projectfilePath
return catch
elseif ext == 'bat' echom v:exception
endtry
else
" Projectfile is a makefile or a batchfile
if ext == 'bat'
let g:makeCommand = projectfilePath let g:makeCommand = projectfilePath
else else
let g:makeCommand = 'make -f ' . projectfilePath let g:makeCommand = 'make -f ' . projectfilePath
@ -146,6 +151,19 @@ function s:SetProject(projectfile)
call s:GetProjectVariables() call s:GetProjectVariables()
call s:EvalProjectVariables() call s:EvalProjectVariables()
endif
if exists('g:sessionfile')
" Vim-Session load
try
execute 'source' g:sessionfile
catch /^Vim\%((\a\+)\)\=:E484/ " file not found
catch " other error
echom 'Fehler in' g:sessionfile ':' v:exception
endtry
" Vim-Session autowrite
autocmd VimLeavePre * execute 'mksession!' g:sessionfile
endif
endfunction endfunction