I like Lynx as an everyday browser, but its prehistoric key bindings are a pain. Fortunately, we can change them.
Let's start with some saner keybindings for the arrow keys. We'll change the up and down arrows to unconditionally scroll the text two lines up or down. Not only is this more intuitive, but it also works better with the scroll wheel and touchscreen drag gestures. Why not one line, like in "less"? Lynx cannot scroll up or down by a single line. Seriously.
Next we'll redefine the left and right arrow keys to do what up and down did previously. That is, navigate to the previous and next links. Much saner. Arrow keys should be used for movement, not actions, especially not actions that trigger page loads.
Now it's time for some shuffling. Opening links was already duplicated under the Enter key, which is a good key for that. Unfortunately there is no intuitive alternative for navigating back, which was previously mapped under the left arrow key. Let's put that under backspace/delete instead. Ah, but because that already opened the history window, we'll place history under the 'h' key, overwriting the help. This is fine, because the same help function remains available under capital 'H' and '?'.
Finally, we'll make the spacebar scroll by half a page instead of a whole one, so we can keep some context in view while reading.
To achieve all this, we'll add the following to ~/.lynx/keymap
:
KEYMAP:UPARROW:UP_TWO # Move display up two lines KEYMAP:DNARROW:DOWN_TWO # Move display down two lines KEYMAP:0x20:DOWN_HALF # Move display down half a page KEYMAP:LTARROW:PREV_LINK # Move to the previous link or page KEYMAP:RTARROW:NEXT_LINK # Move to the next link or page KEYMAP:h:HISTORY # Show the history list KEYMAP:0x08:PREV_DOC # Return to the previous document in history stack KEYMAP:0x7F:PREV_DOC # Return to the previous document in history stack
(download)
You can also download a (full keymap file), which is the relevant subsection of lynx.cfg
with the above values edited in.
Now, a few more things. To make sure scrolling doesn't snag on text fields, we'll set TEXTFIELDS_NEED_ACTIVATION to TRUE. This means you can no longer simply start typing when a text field is selected, and need to press the Enter key first. Inconvenient, but the alternative is awful scrolling behavior.
Let's also make images downloadable by default, show the url of the currently selected link in the bottom status bar, and some other niceties.
Finally, we'll tighten up privacy by turning off cookies and the Referer: header. Caution: Many websites already don't work (well) with Lynx. This will break even more of them.
To achieve all this, add the following to /etc/lync/local.cfg
:
SET_COOKIES:FALSE ACCEPT_ALL_COOKIES:FALSE DEFAULT_USER_MODE:ADVANCED NO_FROM_HEADER:TRUE NO_REFERER_HEADER:TRUE NO_FILE_REFERER:TRUE MAKE_LINKS_FOR_ALL_IMAGES:TRUE SUBSTITUTE_UNDERSCORES:TRUE TEXTFIELDS_NEED_ACTIVATION:TRUE
(download)
Or you can run this awk script to automatically edit them directly into lynx.cfg
. See inside the script for usage.