mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 00:07:58 +01:00
added :buffer(s) commands
This commit is contained in:
@@ -92,6 +92,20 @@ var g_commands = [/*{{{*/
|
|||||||
function(args, special) { bmshow(args, special); },
|
function(args, special) { bmshow(args, special); },
|
||||||
function(filter) { return get_bookmark_completions(filter); }
|
function(filter) { return get_bookmark_completions(filter); }
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
["buffer", "bu"],
|
||||||
|
"Go to buffer number n. Full completion works.",
|
||||||
|
null,
|
||||||
|
function (args) { tab_go(args.split(":")[0]); preview_window.hidden = true; },
|
||||||
|
function (filter) {return get_buffer_completions(filter);}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
["buffers", "files", "ls"],
|
||||||
|
"Shows a list of all buffers.",
|
||||||
|
null,
|
||||||
|
function (args) {bushow("");},
|
||||||
|
null
|
||||||
|
],
|
||||||
[
|
[
|
||||||
["downloads", "dl"],
|
["downloads", "dl"],
|
||||||
"Show progress of current downloads",
|
"Show progress of current downloads",
|
||||||
@@ -322,7 +336,7 @@ var g_commands = [/*{{{*/
|
|||||||
null
|
null
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
["xall", "xa", "wqall", "wqa"],
|
["xall", "xa", "wqall", "wqa", "wq"],
|
||||||
"Save the session and quit",
|
"Save the session and quit",
|
||||||
"Quit Vimperator, no matter how many tabs/windows are open. The session is stored.",
|
"Quit Vimperator, no matter how many tabs/windows are open. The session is stored.",
|
||||||
function (args) { quit(true); },
|
function (args) { quit(true); },
|
||||||
@@ -355,6 +369,12 @@ var g_mappings = [/*{{{*/
|
|||||||
"This may not work correctly for frames with lots of CSS code.",
|
"This may not work correctly for frames with lots of CSS code.",
|
||||||
function(count) { focusNextFrame(); }
|
function(count) { focusNextFrame(); }
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
["b"],
|
||||||
|
"Open a prompt to switch buffers",
|
||||||
|
"Typing the corresponding number opens switches to this buffer",
|
||||||
|
function (args) { bushow(""); openVimperatorBar('buffer '); }
|
||||||
|
],
|
||||||
[
|
[
|
||||||
["d"],
|
["d"],
|
||||||
"Delete current buffer (=tab)",
|
"Delete current buffer (=tab)",
|
||||||
@@ -1113,6 +1133,13 @@ function hsshow(filter, fullmode)
|
|||||||
preview_window.hidden = false;
|
preview_window.hidden = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function bushow(filter)
|
||||||
|
{
|
||||||
|
items = get_buffer_completions(filter);
|
||||||
|
preview_window_fill(items);
|
||||||
|
preview_window.hidden = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// url marks functions //////////////////////////////////////////// {{{1
|
// url marks functions //////////////////////////////////////////// {{{1
|
||||||
|
|||||||
@@ -423,6 +423,33 @@ function get_settings_completions(filter)/*{{{*/
|
|||||||
return settings_completions;
|
return settings_completions;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
|
function get_buffer_completions(filter)
|
||||||
|
{
|
||||||
|
var reg = new RegExp("^"+filter,"i");
|
||||||
|
items=new Array();
|
||||||
|
var num = getBrowser().browsers.length;
|
||||||
|
for(var i=0; i<num;i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
title = getBrowser().getBrowserAtIndex(i).contentDocument.getElementsByTagName('title')[0].text;
|
||||||
|
}
|
||||||
|
catch (e)
|
||||||
|
{
|
||||||
|
title = "";
|
||||||
|
}
|
||||||
|
if (title == "")
|
||||||
|
title = "(Untitled)";
|
||||||
|
|
||||||
|
if(title.search(reg) != -1)
|
||||||
|
{
|
||||||
|
var title;
|
||||||
|
items.push([(i+1)+": "+title]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
////////// COMMAND HISTORY HANDLING ////////////
|
////////// COMMAND HISTORY HANDLING ////////////
|
||||||
|
|
||||||
function add_to_command_history(str)
|
function add_to_command_history(str)
|
||||||
|
|||||||
Reference in New Issue
Block a user