ZyX_I avatar ZyX_I committed 3f11df1

Fixed behavior when wildignore=*

Comments (0)

Files changed (5)

         (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*

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={}

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

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)
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.