0

Is there a command/command set to go back to the last viewed page in Pentadactyl? I often close my browser and then decide that it was to early, so I want to turn it on again and to go the last viewed tab. Ideally to the same place on page that I was when I closed it (but I'm not sure if this is possible).

I know there is an option in Firefox itself to open with last viewed tabs, but I don't want this behaviour to be default, because I don't want the last viewed page to appear when I start a new task, as I get very easily distracted.

1 Answer 1

1

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.

1
  • This is indeed sufficient. (I only added <CR> to the end of the second line, so that the command is automatically confirmed.) Many thanks! Commented Apr 6, 2014 at 19:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .