10436649c1820387dd13c0512f1a55052d72534f

Author: AD7six

Date: 2010-01-31 21:10:16 +0100

use a function for logging activity

diff --git a/vendors/vim/plugins/cakephp.vim b/vendors/vim/plugins/cakephp.vim index 74f5f35..f1e5f15 100644 --- a/vendors/vim/plugins/cakephp.vim +++ b/vendors/vim/plugins/cakephp.vim @@ -59,6 +59,7 @@ let s:ConsoleLog = [] let s:CommandLog = [] let s:ConfigOpenCmd = 'tabe' "'sp' let s:ConfigCleanOnWrite = 1 +let s:LogActivity = '~/activity/' " Section: Utility functions " These functions are not/should not be directly accessible @@ -87,6 +88,19 @@ function s:DirectConsole(...) return split(substitute(system(cmd), s:junk, '', 'g'), '\n') endfunction +" Function: LogActivity() +" Log doing something +function s:LogActivity(action) + if s:LogActivity == '' + return + endif + let l:cmd = '!echo "' . strftime('%F %T') + let l:cmd = l:cmd . ' ' . a:action + let l:cmd = l:cmd . ' ' . substitute(b:Root, '.*/', '', 'g') + let l:cmd = l:cmd . ' ' . substitute(expand("%"), b:Root, '', 'g') . '"' + :silent exe l:cmd . ' >> ' . s:LogActivity . strftime('%y%m%d') . '.log' +endfunction + " Function: Return() " Parse the response and if necessary prompt the user to make a selection " If only a single result is found, that is the selection. @@ -179,7 +193,7 @@ function s:BufferWritePost() endif " :call DocTags(expand("%:p")) "disabled it's too slow endif - :silent exe '!echo "' . strftime('%F %T') . ' ' . 'write' . ' ' . substitute(b:Root, '.*/', '', 'g') . ' ' . substitute(expand("%"), b:Root, '', 'g') . ' ' . '" >> ~/vimActivity.' . strftime('%y%m%d') . '.log' + call s:LogActivity('write') endfunction " Function: SetupBuffer() @@ -224,7 +238,7 @@ function s:SetupBuffer() call s:SetupMenu() norm! zx let b:CakeBufferSetup=1 - :silent exe '!echo "' . strftime('%F %T') . ' ' . 'open ' . ' ' . substitute(b:Root, '.*/', '', 'g') . ' ' . substitute(expand("%"), b:Root, '', 'g') . ' ' . '" >> ~/vimActivity.' . strftime('%y%m%d') . '.log' + call s:LogActivity('open') endfunction " Section: Public functions