Yanking URLs in w3m

Set the “External Browser” option to

sh -c 'printf %s "$0" | xsel'

You can use xsel -b to use the clipboard instead of the primary selection. An alternative to xsel is xclip (xclip for the primary selection, xclip -selection CLIPBOARD for the clipboard).

In ~/.w3m/config, that's the extbrowser setting.

Then press M to copy (yank) the URL of the current page, or ESC M to copy the URL of the link under the cursor.

You can use the second or third external browser for that instead; then the key combination is 2 M or 3 M or 2 ESC M or 3 ESC M.