Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
This is indeed sufficient. (I only added <CR> to the end of the second line, so that the command is automatically confirmed.) Many thanks! –  nuoritoveri Apr 6 at 19:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.