Commits

ZyX_I committed 2eb6fda

@frawor: Added isftplugin key to plugdict
Adjusted the way plugin type is determined
tools/gentestdir.zsh: Made it first remove temp directory
tools/profile.zsh: Added support for additional runtimepaths

Comments (0)

Files changed (4)

                             @           plugin/
         There two special cases: `^' gets expanded to plugin id without one 
         component (but with trailing slash) and `@.' gets expanded to plugin 
-        id (both only for {dependencies} dictionary).
+        id (both only for {dependencies} dictionary and |frawor-f-require|).
                                                      *frawor-anonymous-plugin*
         You may specify 0 instead of {version}. In this case plugin type will 
         be `/anonymous', plugin id will be equal to `file' argument (possibly 
 plugdict :: {}                                             *frawor-t-plugdict*
         Dictionary which describes plugin. It has the following keys:
         Key           Description ~
-        type          Plugin type (first path component after runtimepath, 
-                      string "/unknown" if detection of runtimepath failed and 
-                      string "/anonymous" if |FraworRegister()| got zero 
+        type          Plugin type (first path component after runtimepath if 
+                      there are at least two of them, string "/unknown" if 
+                      detection of runtimepath failed, string "/script" if 
+                      there were not more then one component after runtimepath 
+                      and string "/anonymous" if |FraworRegister()| got zero 
                       instead of version).
         id            Plugin id.
         runtimepath   Plugin runtimepath, empty if detection of rtp failed or 
                       |FraworRegister()| got zero instead of version.
         version       Plugin version, see |frawor-t-version|.
+        isfiletype    Bool, true if plugin is devoted to some filetype 
+                      (determined by chekcing whether plugin id starts with 
+                      ftplugin/, syntax/ or indent/).
         oneload       Bool, true if plugin should be loaded only once.
         file          Path to plugin file ({file} argument to 
                       |FraworRegister()| for non-anonymous plugins, |s:_sfile| 
 @frawor:
     0.1: Added |frawor-f-require| and |frawor-fk-depadd|
     0.2: Added |s:_loading| variable
+    0.3: Added isftplugin key to |frawor-t-plugdict|,
+         adjusted the way plugin type is determined.
 @/mappings:
     0.1: Added possibility to specify dictionaries in `strfunc' and `func' 
          keys.

plugin/frawor.vim

         let i+=1
     endfor
     if !empty(foundrtp)
-        return [get(removedcomponents, 0, 'plugin'),
+        return [((len(removedcomponents)>1)?
+                    \ removedcomponents[0]:
+                    \ '/script'),
                     \join(removedcomponents, '/'), foundrtp]
     else
         return ['/unknown', join(removedcomponents, '/'), '']
     endif
 endfunction
 "▶1 newplugin       :: version, sid, file, dependencies, oneload, g → +s:pls,
+let s:ftplugtypes=['ftplugin', 'syntax', 'indent']
 function s:F.newplugin(version, sid, file, dependencies, oneload, g)
     "▶2 Checking whether a:file is a string
     if type(a:file)!=type('')
                 \           'id': plid,
                 \  'runtimepath': plrtp,
                 \      'version': plversion,
+                \   'isftplugin': index(s:ftplugtypes, plugtype)!=-1,
                 \      'oneload': !!a:oneload,
                 \         'file': ((a:version is 0)?(get(a:g, '_sfile', 0)):
                 \                                   (a:file)),
 let s:features[s:newfeature.id]=s:newfeature
 let s:featordered.all+=[s:newfeature]
 "▶1 Plugin registration
-call s:F.newplugin([0, 2], s:Eval('+matchstr(expand("<sfile>"), ''\d\+'')'),
+call s:F.newplugin([0, 3], s:Eval('+matchstr(expand("<sfile>"), ''\d\+'')'),
             \      expand('<sfile>:p'), {}, 1, s:)
 let s:shadow[s:_frawor.id].features.newfeature.newfeature=s:newfeature
 unlet s:newfeature
         call s:_f.throw('thrownbool', a:dplid, a:plugdict.id)
     endif
     "▲2
-    let dplid=s:F.expandplid(a:dplid)
+    let dplid=s:F.expandplid(a:dplid, a:plugdict.id)
     if has_key(a:plugdict.dependencies, dplid)
         return 2
     endif

tools/gentestdir.zsh

 emulate -L zsh
 typeset -xr TESTDIR=$1
 shift
-test -d $TESTDIR || mkdir -p $TESTDIR
+rm -rf $TESTDIR
+mkdir -p $TESTDIR
 local -r REV=${1:-.}
 (( $# )) && shift
 if [[ $REV == '.' ]] ; then

tools/profile.zsh

 #!/bin/zsh
 : ${TESTDIR:=/tmp/frawor-profile}
+if [[ -z $RTP ]] ; then
+    RTP=$TESTDIR
+else
+    RTP+=,$TESTDIR
+fi
 ./gentestdir.zsh $TESTDIR $1
 (( $# )) && shift
-typeset -x TESTDIR
+typeset -x TESTDIR RTP
 pushd $TESTDIR
-vim -u <(<<< 'set nocompatible rtp=$TESTDIR') -U NONE \
+vim -u <(<<< 'let &rtp=$RTP') -N -U NONE -i NONE \
     --startuptime starttime.dat \
     --cmd 'profile start profile.dat' \
     --cmd 'profile func *' \
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.