blob: fe169529ef5e598906212b50994655986e913831 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// vim:ft=javascript
require("session.js");
session_auto_save_auto_load = true;
require("favicon.js");
require("new-tabs.js");
tab_bar_show_icon = true;
tab_bar_show_index = true;
url_completion_use_history = true;
define_opensearch_webjump("ddg", "ddg.xml");
/////////////////////////////////////////////////////////////////////////////////
// reopening closed buffers
var my_closed_buffers = new Array();
//save the URL of the current buffer before closing it
interactive("my-close-and-save-current-buffer",
"close and save the current buffer for later restore",
function(I) {
if(my_closed_buffers.length==10){
my_closed_buffers.shift(); // remove older item to save
// memory, just save maximum 10 buffers
}
my_closed_buffers.push(I.buffer.document.URL);
kill_buffer(I.buffer); //kill the current buffer
});
undefine_key(default_global_keymap, "q");
define_key(default_global_keymap, "q", "my-close-and-save-current-buffer");
interactive("my-open-closed-buffer",
"open the last closed buffer",
function(I){
// check if the array length > 0
if(my_closed_buffers.length>0){
// load the URL in new windows
load_url_in_new_buffer(
my_closed_buffers[my_closed_buffers.length - 1], I.window);
// remove the first item in the array
my_closed_buffers.pop();
}
});
define_key(default_global_keymap, "A-W", "my-open-closed-buffer")
/////////////////////////////////////////////////////////////////////////////////
|