Sublime Text 2 Keyboard shortcut to open file in Chrome/firefox in windows

后端 未结 4 1641
余生分开走
余生分开走 2021-01-16 17:15

I followed the instruction for windows 7 to setup chrome. No luck!

{
 \"cmd\":[\"C:\\Program Files (x86)\\Google\\Chrome\\Application\", \"$C:\\Users\\gmu\\D         


        
相关标签:
4条回答
  • 2021-01-16 17:44

    Install the Sublime View In Browser extension that, quote:

    View In Browser is a Sublime Text 2 plugin that will open whatever is in your current view/tab.

    Installation in using instructions in tne README.md file.

    0 讨论(0)
  • 2021-01-16 17:59

    I was having the same problem and found this post ! My problem was fixed by just typing this:

    {
        "cmd": ["C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "$file"]
    }
    

    Notice that double \\ solved my problem ..

    And then I saved it as Chrome.sublime-build on:

    C:\Users\YourUsername\AppData\Roaming\Sublime Text 2\Packages\User
    
    0 讨论(0)
  • 2021-01-16 18:03
    1. preferences > key bindings-user should look like this in windows:

      [
      // *RIGHT* { "keys": ["f12"], "command": "open_browser" },
      // *WRONG* { "keys": ["f12"], "ctrl": "open_browser" }, 
      
      { "keys": ["f12"], "command": "open_browser" },
      { "keys": ["ctrl+e"], "command": "HtmlDialect" },
      { "keys": ["/"], "command": "close_tag_on_slash" }
      ]
      
    2. look in your packages folder for a folder called 'openbrow' then open the openbrow.py file in sublime

    find the icon for the browser you want to use and goto it's properties to copy the path to it's location on your computer

    then in the openbrow file your gonna paste that path where it should go. for instance ([r'C:\path to your browser', '-new-tab', self.view.file_name()])

    here's what my openbrow.py file looks like:

        import sublime, sublime_plugin
        import subprocess
    
        class OpenBrowserCommand(sublime_plugin.TextCommand):
        def run(self,edit):
        subprocess.call([r'C:\Program Files 
        (x86)\Mozilla Firefox\firefox.exe','-new-tab', self.view.file_name()])
    

    hope this helps! KCCO

    0 讨论(0)
  • 2021-01-16 18:03

    In my Windows this code is working. Go to Tools > Build System > New Build System Then put the code with your browser file path.

    {
        "cmd": ["C:\\Program Files\\Mozilla Firefox\\firefox.exe", "$file"]
    }
    

    Please use double '\\' for '\'. Hope it will work.

    0 讨论(0)
提交回复
热议问题