When I try to do this

:autocmd LocationChange .* echo document.title

the first page that gets displayed makes no echo. If I proceed to the next tab, the title of the last tab gets echoed.

Does anybody know how I can get for every landing on the page the title echoed instantly instead of when "leaving" the tab?

And it only works every two times. If I go through my tabs 1,2,3,4,5,6,7,8 (next tab) the output will be (being at 1 currently)

  • _blank
  • Title of 1
  • _
  • Title of 3
  • _
  • Title of 5
  • _
  • Title of 7
  • _

(now being at tab 8)

But I want

  • Title of 1
  • Title of 2
  • ...

Any ideas?


I did not experience the "Every second page title missing" part in my firefox (are you using some older version?). But the "leaving page title" part is same as you. It is understandable why this happen: this LocationChange event get fired as soon as you change the location, so it just get the current document title (which become leaving document for us!).
One way out would be adding some delay before getting the title. This is what I try: Put a javascript file in the vimperator/plugin directory where I add this method:

   commands.addUserCommand ("showtitle", "add some delay before showing it",
    function (args) {
        setTimeout(function() {
        }, 1);

This plugin will add a new command for the vimperator (after restarting FF). If you call this command it will show the current document title after 1 millisecond. Now we can use this new command for our auto command: autocmd LocationChange .* showtitle . After this you will see current document title (current doc for us) is getting echoed in most of the cases. you can increase the delay to become more accurate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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