1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 11:58:00 +01:00

add 'wildignore' option

This commit is contained in:
Doug Kearns
2008-09-04 04:26:11 +00:00
parent 9dd8ca470f
commit 8f46fdb88e
5 changed files with 45 additions and 3 deletions

1
NEWS
View File

@@ -1,6 +1,7 @@
<pre> <pre>
2008-XX-XX: 2008-XX-XX:
* version 2.0 (probably) * version 2.0 (probably)
* add 'wildignore' option
* add :finish command * add :finish command
* new events BookmarkPost, ShellCmdPost, QuitPre * new events BookmarkPost, ShellCmdPost, QuitPre
* add 'cdpath' option * add 'cdpath' option

View File

@@ -225,6 +225,7 @@ liberator.Completion = function () //{{{
{ {
var dir = "", compl = ""; var dir = "", compl = "";
var matches = filter.match(/^(.*[\/\\])?(.*?)$/); var matches = filter.match(/^(.*[\/\\])?(.*?)$/);
if (matches) if (matches)
{ {
dir = matches[1] || ""; // "" is expanded inside readDirectory to the current dir dir = matches[1] || ""; // "" is expanded inside readDirectory to the current dir
@@ -232,9 +233,20 @@ liberator.Completion = function () //{{{
} }
var files = [], mapped = []; var files = [], mapped = [];
try try
{ {
files = liberator.io.readDirectory(dir); files = liberator.io.readDirectory(dir);
if (liberator.options["wildignore"])
{
var wimRegexp = new RegExp("(^" + liberator.options["wildignore"].replace(",", "|", "g") + ")$");
files = files.filter(function (f) {
return f.isDirectory() || !wimRegexp.test(f.leafName);
});
}
mapped = files.map(function (file) { mapped = files.map(function (file) {
return [tail ? file.leafName : (dir + file.leafName), file.isDirectory() ? "Directory" : "File"]; return [tail ? file.leafName : (dir + file.leafName), file.isDirectory() ? "Directory" : "File"];
}).sort(function (a, b) { }).sort(function (a, b) {

View File

@@ -340,6 +340,25 @@ liberator.CommandLine = function () //{{{
}, },
}); });
liberator.options.add(["wildignore", "wig"],
"List of file patterns to ignore when completing files",
"stringlist", "",
{
validator: function (value)
{
// TODO: allow for escaping the ","
try
{
new RegExp("^(" + value.replace(",", "|", "g") + ")$");
return true;
}
catch (e)
{
return false;
}
}
});
liberator.options.add(["wildoptions", "wop"], liberator.options.add(["wildoptions", "wop"],
"Change how command line completion is done", "Change how command line completion is done",
"stringlist", "", "stringlist", "",

View File

@@ -705,6 +705,16 @@ want no bell at all.
____ ____
|\'wildignore'| |\'wig'|
||'wildignore' 'wig'|| stringlist (default: "")
____
List of file patterns to ignore when completing files. E.g. to ignore object
files and Vim swap files [c]:set wildignore=.*\.o,\..*\.s[a-z]{2}[c]
Note: Unlike Vim each pattern is a regexp rather than a glob.
____
|\'wim'| |\'wildmode'| |\'wim'| |\'wildmode'|
||'wildmode' 'wim'|| stringlist (default: "list:full") ||'wildmode' 'wim'|| stringlist (default: "list:full")
____ ____

View File

@@ -1,7 +1,7 @@
" Vim syntax file " Vim syntax file
" Language: VIMperator configuration file " Language: VIMperator configuration file
" Maintainer: Doug Kearns <dougkearns@gmail.com> " Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2008 Sep 02 " Last Change: 2008 Sep 04
if exists("b:current_syntax") if exists("b:current_syntax")
finish finish
@@ -46,8 +46,8 @@ syn keyword vimperatorOption activate act activelinkfgcolor alfc activelinkbgcol
\ linkfgcolor lfc linksearch lks nolinksearch nolks loadplugins noloadplugins lpl nolpl more newtab nextpattern nomore \ linkfgcolor lfc linksearch lks nolinksearch nolks loadplugins noloadplugins lpl nolpl more newtab nextpattern nomore
\ pageinfo pa popups pps preload nopreload previewheight pvh previouspattern online noonline scroll scr shell sh shellcmdflag \ pageinfo pa popups pps preload nopreload previewheight pvh previouspattern online noonline scroll scr shell sh shellcmdflag
\ shcf showmode smd noshowmode nosmd showstatuslinks ssli showtabline stal smartcase scs nosmartcase noscs suggestengines \ shcf showmode smd noshowmode nosmd showstatuslinks ssli showtabline stal smartcase scs nosmartcase noscs suggestengines
\ titlestring usermode um nousermode noum urlseparator verbose vbs visualbell vb novisualbell novb visualbellstyle wildmode \ titlestring usermode um nousermode noum urlseparator verbose vbs visualbell vb novisualbell novb visualbellstyle wildignore
\ wim wildoptions wop wordseparators wsp \ wig wildmode wim wildoptions wop wordseparators wsp
\ contained \ contained
syn region vimperatorJavascript start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=" end="$" contains=@javascriptTop keepend oneline syn region vimperatorJavascript start="\%(^\s*\%(javascript\|js\)\s\+\)\@<=" end="$" contains=@javascriptTop keepend oneline