4

For example, could I type something like

firefox open this is a search

where open is just passed to the vimperator command line?

2
  • Not sure about vimperator/pentadactyl options but if you want to open browser and pass string to default search engine you can do that: $ firefox -search 'this is a search'. – anlar Oct 4 '14 at 9:02
  • 1
    I asked this Q in the #vimperator IRC on freenode, nobody has responded thus far but I'll keep checking. I've also asked your Q on the Vimperator github project pg: github.com/vimperator/vimperator-labs/issues/48 – slm Oct 4 '14 at 13:13
4

Vimperator founder here:

Yes, it is possible. The complete syntax is here: https://github.com/vimperator/vimperator-labs/blob/master/common/locale/en-US/starting.xml or given in :help startup

So try that:

firefox -vimperator "+c 'javascript alert(\"from commandline\");'"

would show an prompt after starting firefox. For opening URLs or searching, you need a slight "hack" as there is a race condition and we need to add a slight delay like so:

firefox -vimperator "+c \
    'javascript liberator.sleep(1000) && liberator.open(\"this is a search\");'"

If it is really required to put that content into the command line and not executing it directly, you can try the normal command:

firefox -vimperator "+c 'normal \":open this is a search\"'"

In general, pay attention about the correct escaping of quotes. I recommend using the mixture of " ' and \" like in the above examples.

Simplifying things

You can use the following function to make this a single one-liner, like so:

$ function vimpopen () {
    firefox -vimperator "+c 'normal \":open $@\"'"
}
3
  • I'm still a command line/linux newbie. Is there something I could type into my bashrc to simplify this to a single command, like "vimpopen 'here is a search'"? – George Oct 4 '14 at 22:20
  • @George - see the example at the end, LMK if that works for you. – slm Oct 5 '14 at 18:07
  • Thanks for your respond(!), but it didn't work. I changed it to the following: function vimpopen() { firefox -vimperator "+c 'normal :open $@'"; } And it sort of worked. Firefox opens with what I type and I have to press enter. The terminal is also linked to the firefox window so that if I close out of the terminal, then firefox also closes -- which isn't desirable. – George Oct 11 '14 at 23:05

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.