-
Notifications
You must be signed in to change notification settings - Fork 65
Get directory listing with globpath #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
ping @justinmk - let me know if there are any questions about this. |
| let paths = s:globlist(dir_esc.'*') | ||
| " Escape comma for globpath(). | ||
| let dir_esc = escape(a:dir, ',') | ||
| let paths = s:globlist(dir_esc, '*') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pavoljuhas the substitute(a:dir,'\[','[[]','g') was needed to handle paths with [ in the name (on Windows \ is a path separator so the [[] trick is needed to escape the [).
Do such paths work with this PR on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I was under impression that globpath() does not expand wildcards in path values, but that is not the case.
autoload/dirvish.vim
Outdated
| " Escape comma for globpath(). | ||
| let dir_esc = escape(a:dir, ',') | ||
| let paths = s:globlist(dir_esc, '*') | ||
| "Append dot-prefixed files. glob() cannot do both in 1 pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we avoid 2 passes now? will this work:
let paths = s:globlist(dir_esc, '*,.[^.]*')
edit: no, the globpath() {expr} syntax is same as glob() and doesn't support "alternative" expressions.
I don't totally understand this. Do you have a reference for this (doc, Vim issue, mailing list discussion)? |
autoload/dirvish.vim
Outdated
|
|
||
| function! s:list_dir(dir) abort | ||
| " Escape for glob(). | ||
| let dir_esc = escape(substitute(a:dir,'\[','[[]','g'),'{}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't we need to escape { and } anymore? Note also that #190 proposes to escape the \ character.
After more testing I found the problem happens when The @justinmk - are you OK with changing this PR to use the original |
...sure enough, from
classic Vim.
Would rather use globpath() than setting/unsetting an option. Is there any disadvantage to globpath()? |
Does not seem so. globpath() needs an extra escape for |
Fix dirvish when 'wildignorecase' is on. Avoid combining listings of case-equivalent directories.
Escape special characters `;*?` to prevent upward search and globing.
c177fa3 to
8e476a7
Compare
|
Here is the next iteration which keeps path escapes from master.
|
|
Thank you for fixing this! Nasty bug. |
Fix dirvish for auto-mounted paths where mount root does not glob.
Problem: vim
glob()does not match in subdirectories of some auto mounted paths, for example,in
/home/autouser/docs/. This is probably becauseautouserdoes not glob in/home/.Solution: use
globpathinstead ofglobto do glob expansion only in leaf directory.