These are settings taken from here and there. Turning on the mode-line, allowing the url completion (very handy) to access history and bookmarks, and displaying the url of a link (in hints mode).
buffer list, the second shows how many buffers are currently still loading, the third shows how many buffers are present and which buffer is the current buffer, the last simply disables the clock. The order of the first three is actually important; this order puts the buffer count on the far left, then the "loading buffer" count, then the favicon, (and then the url of the current buffer).
Managing/Navigating Tab-Buffers
// redefine C-f as "forwards" and C-b as "backwards"
// using F and B (that is Shift+F, Shift+B is actually rather inconvenient since
// many other command use Control and so requires shifting fingers)
define_key(content_buffer_normal_keymap, "C-f", "forward");
define_key(content_buffer_normal_keymap, "C-b", "back");
// make M-f and M-b switch to next and previous buffers
define_key(content_buffer_normal_keymap, "M-f", "buffer-next");
define_key(content_buffer_normal_keymap, "M-b", "buffer-previous");
// redefine l as "follow link" (like f)
// (too many of the keys are for the left hand, I like "l" for "link")
define_key(content_buffer_normal_keymap, "l", "follow");
// Use M-l to follow link in new background buffer
define_key(default_global_keymap, "M-l", "follow-new-buffer-background");
// open url in new background buffer (I can't think of a good keybinding for this)
interactive("find-url-new-background-buffer",
"Open a URL in a new background buffer",
alternates(follow_new_buffer_background, follow_new_window),
$browser_object = browser_object_url,
$prompt = "Find url");
The default keys for navigate forwards and navigate backwards are
F and
B, respectively. I imagine there are historic reasons behind this (it's
how W3 does it), but I find it annoying to have to switch from Ctrl to Shift (since most of the other keybindings involve Ctrl), so the initial bit above binds
C-f and
C-b to forwards and backwards (
F and
B still work too). And I bound
M-f and
M-b to "move to next tab-buffer", "move to previous tab-buffer", respectively. These seem to me to make sense as extensions of the normal behaviour of
C-f,
C-b,
M-f,
M-b, in Emacs. [Note: These bindings don't affect the how these keys behave in text boxes. All of these keys retain their expected Emacs-ish behaviour in text boxes.]
I prefer using
l for following links in hint mode, so that's another binding added above (
f still works too). And I added
M-l as "follow link in new background buffer" (works like middle-click).
The last bit is a new command for opening URLs in new background buffers, but I haven't thought of a good keybinding for it so far.
Yanking
// use M-y to google current selection in new buffer
// use M-Y to google current selection in new buffer "double-quoted"
// [ref: http://www.mozdev.org/pipermail/conkeror/2009-February/001334.html ]
// (See also "**c" for selecting text)
interactive("search-clipboard-contents", "Search in Google the content of the X clipboard (the selected text)",
"find-url",
$browser_object=
function(I) {
return "g "+ read_from_x_primary_selection();
}
);
interactive("search-clipboard-contents-doublequoted", "Search in Google the content of the X clipboard (the selected text) as a fixed string",
"find-url",
$browser_object=
function(I) {
return "g \""+ read_from_x_primary_selection()+"\"";
}
);
define_key(content_buffer_normal_keymap, "M-y", "search-clipboard-contents");
define_key(content_buffer_normal_keymap, "M-Y", "search-clipboard-contents-doublequoted");
By default, (outside of text boxes, where, again, Conkeror has the expected Emacs-ish behaviour),
M-w copies the selected area. And
C-y opens whatever's in the clipboard (I would say kill-ring, but it's not) in the current buffer---assuming that what's in the clipboard is a URL. The above code adds two new commands, performing a Google search on the current clipboard contents, and performing a Google search on the current clipboard contents double-quoted. I bound these to
M-y, and
M-Y, respectively.
Oh, in general, adding a
C-u prefix results in the command being executed in a new buffer. So
C-u M-y performs a Google search on the clipboard contents in a new (focussed) buffer.
More buffer management/misc. bindings
// make C-c C-c "submit form"
define_key(content_buffer_normal_keymap, "C-c C-c", "submit-form");
// make C-x 0 "kill current buffer"
define_key(default_global_keymap, "C-x 0", "kill-current-buffer");
// make C-x 1 "kill other buffers"
define_key(content_buffer_normal_keymap, "C-x 1", "kill-other-buffers");
// make C-x 2 "duplicate buffer"
interactive("duplicate-buffer", "Duplicate buffer",
function (I) {
browser_object_follow(I.buffer, OPEN_NEW_BUFFER, I.buffer.current_uri.spec);
});
define_key(content_buffer_normal_keymap, "C-x 2", "duplicate-buffer");
Use
C-c C-c to submit forms.
Now Conkeror doesn't have "windows" in the Emacs-sense. It has buffers/tabs. So the above commands depart somewhat from being truly parallel with Emacs behaviour, since in Emacs these commands all involve window management. But I still find it useful to have some keybinding for these commands, and these make a sort of sense to me.
C-x 0 closes the current tab-buffer (
C-x k is the command for "close buffer" in general; it defaults to the current buffer, but requires another keystroke (Enter));
C-x 1 closes all tab-buffers except for the current one;
C-x 2 duplicates the current tab-buffer in a new tab.
Set default download directory
// cwd
cwd=get_home_directory();
cwd.append("Downloads");
This sets the default download directory to "~/Downloads". "cwd" is useful, and can be used cross-platform. It gets the "home directory". The last line obviously appends "Downloads" to the home directory location.
Misc.
// xkcd add mouse-over text
xkcd_add_title = true;
// No new window for downloads
download_buffer_automatic_open_target=OPEN_NEW_BUFFER_BACKGROUND;
// Make sure I don't close by accident
add_hook("before_quit_hook",
function () {
var w = get_recent_conkeror_window();
var result = (w == null) ||
"y" == (yield w.minibuffer.read_single_character_option(
$prompt = "Quit Conkeror? (y/n)",
$options = ["y", "n"]));
yield co_return(result);
});
can_kill_last_buffer = false;
Show xkcd mouse-over text on the page below the cartoon (it would be nice to have another way of handling mouse-over text though).
The second command handles how the download info buffer is handled; here it opens in a new tab rather than opening a new window ("frame" in the Emacs sense).
The last bits makes sure that if by accident I hit
C-x C-c rather than
C-x C-v it doesn't close everything without asking me, and then final line disallows killing of the last buffer.
Webjumps
Webjumps are a useful feature of Conkeror. In the mini-buffer, instead of typing a url, one can type a webjump. A number of such webjumps are built-in to Conkeror already. For example, "google emacs" will open a google search for "emacs". Actually, "g emacs" will do the same thing, and that's preferable since it's relatively quick to type. Also, "wikipedia emacs" will open the wikipedia page on "emacs", etc. Conkeror also already has webjumps designed for use with del.icio.us (press
C-h i for more info).
And you can define your own webjumps.
Here's a good page of some other useful webjumps you can add. Webjumps are not limited simply to site names, but can include javascript code as well. Here are a couple relatively simple ones I wrote for adding favourites to Stumbleupon and adding stories to Digg:
// Define add favourite to Stumbleupon
define_webjump("astumble","javascript:location.href='http://www.stumbleupon.com/submit?url='+encodeURIComponent(location.href)+'&title='+"+"encodeURIComponent(document.title);");
// Define Digg story
define_webjump("adigg","javascript:location.href='http://www.digg.com/submit?url='+encodeURIComponent(location.href);");
And here's a screenshot: