T.Takahashi SublimeTextでショートカットを使ってブラウザを開く「ViewinBrowser」をインストールする 2017-06-23T03:07:25Z
0;ゼロからはじめる!

SublimeTextでショートカットを使ってブラウザを開く「ViewinBrowser」をインストールする

View in Browserのインストール

1.Packege Controlを開く

Tools > Command Palette...(mac Shift + Command + p/win ctrl + shift + p )からコマンドパレットを開き「Package Control:Install Package」を選択する。次に「View in browser」を選択しインストールを行う。 SublimeTextでインストールSublimeTextでインストール

2.インストールされたかの確認をする

Perference > Package Settings > View in Browserが表示されていればインストールが完了されている。

SublimeTextでSettings – Defaultを開く

3.キーバインドの登録

Perference > Key Bindingを開く。Key Binding Userの中に下記のコード記述を追加する。

View in Browserのキーバインド
1
2
3
4
5
6
7
8
9
[
{ "keys": [ "ctrl+shift+v" ], "command": "view_in_browser" },
{ "keys": [ "ctrl+shift+f" ], "command": "view_in_browser", "args": { "browser": "firefox" } },
{ "keys": [ "ctrl+shift+c" ], "command": "view_in_browser", "args": { "browser": "chrome" } },
{ "keys": [ "ctrl+shift+i" ], "command": "view_in_browser", "args": { "browser": "iexplore" } },
{ "keys": [ "ctrl+shift+s" ], "command": "view_in_browser", "args": { "browser": "safari" } }
]
SublimeTextでView in Browserのキーバインドの登録
キーバインドはview-in-browserのGitHubを参考にした。
SublimeTextでキーバインド登録をする

これで設定があっていれば下記のショートカットでブラウザが開く。

  • ctrl + shift + v:デフォルト設定ブラウザ
  • ctrl + shift + f:firefox
  • ctrl + shift + c:chrome
  • ctrl + shift + i:iexplore
  • ctrl + shift + s:safari

トラブルシューティング

ブラウザが開かなかった場合

ブラウザの保存場所が違っている可能性がある。Preference > Package Settings >View in Browser > Settings – Defaultを開き保存場所を確認する。

16〜20行目がmac、25〜29行目がwindowsの保存場所にあたるので、相違があればその部分を修正する。

SublimeTextでSettings – Defaultを開く
View in BrowserのSettings – Default
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{
  "posix": {
    "linux": {
      "firefox": "firefox -new-tab",
      "chrome": "google-chrome",
      "chrome64": "google-chrome",
      "chromium": "chromium"
    },
    "linux2": {
      "firefox": "firefox -new-tab",
      "chrome": "google-chrome",
      "chrome64": "google-chrome",
      "chromium": "chromium"
    },
    "darwin": {
      "firefox": "open -a \"/Applications/Firefox.app\"",
      "safari": "open -a \"/Applications/Safari.app\"",
      "chrome": "open -a \"/Applications/Google Chrome.app\"",
      "chrome64": "open -a \"/Applications/Google Chrome.app\"",
      "yandex": "open -a \"/Applications/Yandex.app\""
    }
  },
  "nt": {
    "win32": {
      "firefox": "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe -new-tab",
      "iexplore": "C:\\Program Files\\Internet Explorer\\iexplore.exe",
      "chrome": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
      "chrome64": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
      "yandex": "%Local AppData%\\Yandex\\YandexBrowser\\browser.exe"
    }
  },
 
  "browser": "chrome64"
}

スポンサーリンク

0 件のコメント :

コメントを投稿