In summer 2013 I set up Elinks text browser. To me it makes sense as a replacement for Opera browser component, because I use Opera primarily to read and type, not watch images or videos. So, this post is for those who don’t care so much about images and videos on the internet, but care a lot about text and urls.
Here are snippets from my elinks.conf file with comments. I mostly show the changes that emulate Opera plus some inevitable differences from Opera.
When you open up Elinks the first time, you can open up configuration options by pressing o and keyboard settings by pressing k. After some time and effort in those two dialogs, elinks.conf file becomes understandable and then it’s possible to edit the file directly.
## ELinks 0.12pre5 configuration file ## ui # User interface options. ## ui.startup_goto_dialog [0|1] # Pop up goto dialog in newly created tabs when there's no homepage set. This # means also showing goto dialog on startup. set ui.startup_goto_dialog = 0
At first startup, Elinks opens up the address field, called “go-to dialog”. It’s similar to Opera’s F2 address field. Since I don’t want this dialog at every startup and at every new tab (yep, Elinks does tabs), I have this setting at 0. Otherwise you’d have to press Esc to get rid of it at every startup and every new tab.
With go-to dialog at 0 and no homepage set, I have a blank page at Elinks startup. From here, I can:
– type g to open the go-to dialog (there’s no other address field but the go-to dialog; the blank page is really completely blank)
– h to browse history of visited pages
– s for bookmarks.
Those g, h, and s are default shortcuts which can also be changed.
Concerning the address field (go-to dialog), these keyboard bindings are handy:
bind "edit" "Shift-Insert" = "paste-clipboard" bind "edit" "Tab" = "auto-complete"
Paste-clipboard, obviously, pastes to the address field from clipboard. Rather than Ctrl+v it’s better to have it Shift+Ins because this is the regular shortcut in consoles.
Tab completes some typed text on the address field from history and bookmarks.
To make the webpage display sanely as per console logic and to remove unnecessary formatting, use these settings:
## document # Document options. ## document.colors # Default document color settings. ## document.colors.background <color|#rrggbb> # Default background color. set document.colors.background = "black" ## document.colors.use_document_colors <num> # Use colors specified in document: # 0 is use always the default settings # 1 is use document colors if available, except background # 2 is use document colors, including background. This can # mostly look very impressive, but some sites will appear # really ugly. Note, that obviously if the background is # not black, it will break the behaviour of transparency. set document.colors.use_document_colors = 0 ## document.css # Options concerning how to use CSS for styling documents. ## document.css.enable [0|1] # Enable adding of CSS style info to documents. set document.css.enable = 0 bind "main" "B" = "toggle-display-tables"
The toggle to render/ignore tables is the uppercase B. In the keybindings, lowercase and uppercase keys are different bindings. Again, change it to what you like. When you are in the keyboard bindings dialog in elinks, and you try to set a binding that already exists, you get a warning along with the opportunity to overwrite.
## document.browse # Document browsing options (mainly interactivity). ## document.browse.images # Options for handling of images. ## document.browse.images.show_as_links [0|1] # Display links to images without an alt attribute. If this option is # off, these images are completely invisible. set document.browse.images.show_as_links = 1
This makes images show up as [img] if they have no alt text. The [img] is a link that identifies the url when you select it. I have the setting this way just in case the text implies the image may be useful after all, so I can download it when really needed to see.
D. Moving around in a document
By default, Space moves the page down by a screen. PgUp goes up a screen in the document. To move up and down a row or line, use the default bindings Ins and Del. I saw no reason to change these. If the mouse is enabled, the scroll wheel can also scroll the document by rows, but sorry, no smooth scrolling.
By default, arrow keys have some conflicting functions that must be changed to emulate Opera’s spatial navigation jumping from link to link:
bind "main" "Down" = "move-link-down" bind "main" "Right" = "move-link-right-line" bind "main" "Up" = "move-link-up" bind "main" "Left" = "move-link-left-line" bind "main" "j" = "history-move-forward" bind "main" "u" = "history-move-back"
## document.browse.links # Options for handling of links to other documents. ## document.browse.links.numbering [0|1] # Display numbers next to the links. set document.browse.links.numbering = 0 bind "main" "/" = "toggle-numbered-links" bind "main" "l" = "link-menu" bind "main" "L" = "goto-url-current-link"
/ will give numbers to all links, so you can type the number to go to the link.
When a link is selected, l key (lowercase l) will open up a menu that contains options like Open, Open in new tab, new window, download, and more.
Uppercase L will extract the url in the link to the address field (goto-dialog) for full examination and editing. Of course, Elinks has a sensible status bar so that the url of any selected link can be examined immediately, but the screen width is not always enough.
bind "main" "Ctrl-D" = "add-bookmark" bind "main" "a" = "add-bookmark-link" bind "main" "Ctrl-S" = "save-url-as"
By default, lowercase t key opens up a new tab, but in a non-obvious way: It duplicates the current page. This is okay so you don’t have to have another keybinding for Duplicate page. You can see that a new tab has been opened because a tab bar appears above the status bar.
In the new tab situation, refer to instructions given under A. Startup. Just two Operatic keybindings from v.12:
bind "main" "Ctrl-W" = "tab-close" bind "main" "Shift-Ctrl-Alt-W" = "tab-close-all-but-current"
Some keybindings simply won’t work, I don’t know why. Ctrl+Tab to cycle tabs doesn’t work. The default keybindings to move between tabs are < and >.
G. Searching in the document
To search within a document , I have these bindings:
bind "main" "." = "search-typeahead-text" bind "main" "Ctrl-F" = "search" bind "main" "F3" = "find-next" bind "main" "Shift-F3" = "find-next-back"
With bindings like this, a simple . key will allow search-as-you-type like in Opera. Ctrl+F will open up a search dialog as in most graphical editors. The next item will be highlighted by F3 and the previous by Shift+F3.
Links don’t need specific search. Above there was a keybinding “/” to identify all links by number, so you can go to any of them by typing the number. Moving between links is as simple as pressing the arrow keys.
H. Search engines
There’s something called “dumb rewrite prefixes” and “smart rewrite prefixes” in Elinks. You are welcome to figure out the smart ones if you are smart. Here’s how to use the dumb ones to add search engines:
## protocol # Protocol specific options. ## protocol.rewrite ## protocol.rewrite.default_template <str> # Default URI template used when the string entered in the goto dialog does # not appear to be a URI or a filename (i.e. contains no '.', ':' or '/' # characters), and does not match any defined prefixes. Set the value to "" # to disable use of the default template rewrite rule. # # %c in the template means the current URL, # %s in the template means the whole string from the goto # dialog, # %0,%1,...,%9 mean the 1st,2nd,...,10th space-delimited part # of %s, # %% in the template means '%'. set protocol.rewrite.default_template = "https://duckduckgo.com/?t=ouk&q=%s" ## protocol.rewrite.dumb # Dumb prefixes, see enable-dumb description for details. ## protocol.rewrite.dumb.g <str> # Replacement URI for this dumbprefix: # %c in the string means the current URL # %% in the string means '%' set protocol.rewrite.dumb.g = "!g" ## protocol.rewrite.dumb.d <str> set protocol.rewrite.dumb.d = "http://dictionary.reference.com/dic?q=%s&search=search" ## protocol.rewrite.dumb.imdb <str> set protocol.rewrite.dumb.imdb = "http://www.imdb.com/find?s=all&q=%s"
Hopefully you see the pattern.
I have Duckduckgo set to conduct a search when I type something on the address field (go-to dialog) that isn’t an address.
When the typed string on the address field begins with “g ” (g plus space), then it will go to Google results via Duckduckgo.
When the typed string on the address field begins with “d “, it will conduct the Dictionary.com search, “imdb ” will search Imdb.com, for just a few examples. You can add and change as you like.