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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user