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

ex parser for use with .vimperatorrc, the command line and other sourced files. sourced files are no longer javascript code, but can use the new :javascript ex command to execute javascript. :javascript also supports multiline with heredocs (:js <<EOF). File completion for the :source command.

This commit is contained in:
Viktor Kojouharov
2007-04-22 14:17:28 +00:00
parent 6322db0107
commit 3ddfb11add
6 changed files with 179 additions and 54 deletions

View File

@@ -180,6 +180,27 @@ function completion_select_previous_item()/*{{{*/
}/*}}}*/
function get_file_completions(filter)/*{{{*/
{
g_completions = [];
var match = filter.match(/^(.*[\/\\])(.*?)$/);
var dir;
if (!match || !(dir = match[1])) return [];
var compl = match[2] || '';
var fd = fopen(dir, "<");
if (!fd) return [];
var entries = fd.read();
var delim = (fd.path.search(/\\/) != -1) ? "\\" : "/";
var reg = new RegExp("^" + fd.path + delim + compl);
entries.forEach(function(file) {
if (file.path.search(reg) != -1)
g_completions.push([file.path]);
});
return g_completions;
}/*}}}*/
/*
* filter a list of urls