1. ZyX_I
  2. frawor


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

  • Participants
  • Parent commits 7e46575
  • Branches default

Comments (0)

Files changed (4)

File doc/frawor.txt

View file
  • Ignore whitespace
                             @           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|).
         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| 
     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.
     0.1: Added possibility to specify dictionaries in `strfunc' and `func' 

File plugin/frawor.vim

View file
  • Ignore whitespace
         let i+=1
     if !empty(foundrtp)
-        return [get(removedcomponents, 0, 'plugin'),
+        return [((len(removedcomponents)>1)?
+                    \ removedcomponents[0]:
+                    \ '/script'),
                     \join(removedcomponents, '/'), foundrtp]
         return ['/unknown', join(removedcomponents, '/'), '']
 "▶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)
-    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

File tools/gentestdir.zsh

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

File tools/profile.zsh

View file
  • Ignore whitespace
 : ${TESTDIR:=/tmp/frawor-profile}
+if [[ -z $RTP ]] ; then
 ./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 *' \