Code

Changes between Version 29 and Version 30 of UsingVimWithDjango


Ignore:
Timestamp:
10/24/06 07:36:09 (7 years ago)
Author:
Lllama
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UsingVimWithDjango

    v29 v30  
    140140 * The Project plugin allows users to use a different project file from the default. It could be that the new plugin generates a project specific file when a new django project is created. 
    141141 
     142The following code can used to create Project entries in a buffer. Note that various settings will be altered by the call to DoSetup so it's probably best to use a new buffer. 
     143 
     144{{{ 
     145function! GetProjectSNR() 
     146    if exists(":Project") 
     147        let a_sav = @a 
     148        redir @a 
     149        exec "silent function" 
     150        redir END 
     151        let funclist = @a 
     152        let @a = a_sav 
     153        let func = split(split(matchstr(funclist,'.SNR.\{-}GenerateEntry'),'\n')[-1])[1] 
     154        return matchlist(func, '\(.*\)G')[1] 
     155    endif 
     156endfunction 
     157 
     158function! Test() 
     159    let SNR = GetProjectSNR() 
     160    call {SNR}DoSetup() 
     161    call {SNR}DoEntryFromDir(0, line("."), 'test', 'c:\temp', 'c:\temp', '', '', '*', 0, 0) 
     162    return '' 
     163endfunction 
     164}}} 
     165 
     166Grabbing the SNR isn't pretty but seems to work and prevents having to recreate the work done in Project. 
     167 
    142168It would be useful for the plugin to grab any tracebacks and place the cursor in a suitable spot.