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

2.インストールされたかの確認をする
Perference > Package Settings > View in Browserが表示されていればインストールが完了されている。

3.キーバインドの登録
Perference > Key Bindingを開く。Key Binding Userの中に下記のコード記述を追加する。
[
{ "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" } }
]

キーバインドはview-in-browserのGitHubを参考にした。

これで設定があっていれば下記のショートカットでブラウザが開く。
- 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の保存場所にあたるので、相違があればその部分を修正する。

{
"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 件のコメント :
コメントを投稿