Search code examples
javascriptfirefoxvimperator

vimperator, how to set qmark differently based on operating system?


How can I achieve below with vimperator (possibly some javascript)?

  • on windows 10

    qmark d file:///E:/somedirectory

  • on linux

    qmark d file:///home/username/somedirectory

what kind of code should be put into my .vimperatorrc?


Solution

  • Maybe you could try something like this

    js if(options["shell"]=="/bin/bash"){quickmarks.add("d", "file:///home/username/somedirectory")}else{quickmarks.add("d","file:///E:/somedirectory")};
    

    Explanation: If /bin/bash is your shell you're running linux. If you're running windows this will probably be cmd.exe (It is on windows 7, I can't test on windows 10 unfortunately). The vimperator internal function quickmarks.add is then used to add the desired quickmark. If there are problems, try

    echo options["shell"]
    

    in the vimperator shell and then change the line accordingly.