I'm not sure about visiting the last-viewed URL: that might require a separate plugin that can track what you're viewing, and save (and restore) the most recent URL.
However, here's a simple command that does re-open the most recent link in your history, instead. If your browsing habits are like mine (open a bunch of tabs, work my way through them, close the browser), this might be enough:
:js history.list('', true, 1, '-date')
This says, "Sort my unfiltered history stack with the most recent links to the top. Open the top 1 of those URLs in a new tab."
To bind this to a command and a key-sequence, put this in your .pentadactylrc
:
command! -description 'Open the most-recently-visited link in a new tab' reopen-last-visited -javascript history.list('', true, 1, '-date')
nmap <Leader>R :reopen-last-visited<CR>
Now, when you start Firefox, your should be able to hit \R
and open up the last-visited URL.
Update: You can also try the :undo
command. The documentation doesn't specifically mention that the list of closed tabs is persistent across browser restarts, but my limited testing shows that it was. I opened and closed a tab, restarted the browsers and immediately tried :undo
. It opened the last tab for me.