Commits

ZyX_I committed 3f11df1

Fixed behavior when wildignore=*

  • Participants
  • Parent commits edc69da

Comments (0)

Files changed (5)

File doc/frawor.txt

         (for example, if paths are on different drives on windows).
 os.path.normpath :: path -> path                   *frawor-r-os.path.normpath*
         Normalize path by removing duplicate path separators and simplifying 
-        it (see |simplify()|).
+        it (see |simplify()|). It also adds leading `./' to the relative 
+        paths.
 os.path.basename :: path -> component              *frawor-r-os.path.basename*
         Returns the final component of a path.
 os.path.dirname :: path -> path                     *frawor-r-os.path.dirname*

File plugin/frawor.vim

 function s:F.normpath(path)
     return expand(fnameescape(substitute(resolve(a:path),
                 \                        '\V'.escape(s:sep, '\').'\+',
-                \                        escape(s:sep, '\&~'), 'g')))
+                \                        escape(s:sep, '\&~'), 'g')), 1)
 endfunction
 "▶1 parseplugpath   :: filename + FS → (plugtype, plid, runtimepath)
 let s:rtpcache={}

File plugin/frawor/fwc/intfuncs.vim

 "▶1 Path
 "▶2 getfiles
 function s:F.getfiles(arglead, filter, forcefilter)
-    let path=expand(escape(a:arglead, '\[]*?'))
+    let path=expand(escape(a:arglead, '\[]*?'), 1)
     let fragments=s:_r.os.path.split(path)
     let globstart=''
     if path[0] is# s:_r.os.sep
 "▶2 pipe
 function s:r.path.pipe(...)
     let curargstr=self.argstr()
-    call self.let(curargstr, 'expand(escape('.curargstr.', "\\[]?*"))')
+    call self.let(curargstr, 'expand(escape('.curargstr.', "\\[]?*"), 1)')
     return call(s:r.path.check, a:000, self)
 endfunction
 "▶2 complete

File plugin/frawor/os.vim

 let s:os.path={}
 "▶3 os.path.abspath   :: path + FS → path
 function s:os.path.abspath(path)
-    let components=s:os.path.split(expand(fnameescape(a:path)))
+    let components=s:os.path.split(expand(fnameescape(a:path), 1))
     if components[0] is# '.'
         let components[:0]=[fnamemodify('.', ':p')]
         if len(components[0])>1
 endfunction
 "▶3 os.path.exists    :: path + FS → Bool
 function s:os.path.exists(path)
-    return !empty(glob(fnameescape(a:path)))
+    return !empty(glob(fnameescape(a:path), 1))
 endfunction
 "▶3 os.path.isdir     :: path + FS → Bool
 function s:os.path.isdir(path)
 "▶3 s:F.globdir
 function s:F.globdir(directory, ...)
     let r=split(glob(fnameescape(a:directory.s:os.sep).
-               \     get(a:000, 0, '*')),
+               \     get(a:000, 0, '*'), 1),
                \"\n", 1)
     return ((len(r)==1 && empty(r[0]))?([]):(r))
 endfunction
 function s:os.chdir(path, ...)
     if s:os.path.isdir(a:path)
         try
-            execute ((a:0 && a:1)?('lcd'):('cd')) fnameescape(a:path)
+            " Normpath is needed because paths like `directory/' (without 
+            " preceding `/', `.' or `..') are subject to searching in &cdpath
+            execute ((a:0 && a:1)?('lcd'):('cd'))
+                        \ fnameescape(s:os.path.normpath(a:path))
             return 1
         catch
             return 0
 set encoding=utf-8
 set guifont=Courier_New:h10:cRUSSIAN
 set noswapfile
+" Make sure everything works with this weird option
+set wildignore=*
 function WriteFile(...)
     let r=[]
     if filereadable(s:outfile)