- View in browser sublime text 3 не работает
- Not working open with chrome on windows Sublime Text 3 #31
- Comments
- nramirez commented Apr 16, 2014
- adampresley commented Apr 17, 2014
- nramirez commented Apr 19, 2014
- mickeo4 commented Jul 7, 2015
- graphitivity commented Sep 2, 2015
- captix commented Mar 11, 2016
- Jack-Dandy commented Nov 18, 2016 •
- dahol commented Jan 31, 2017
- korutx commented Oct 19, 2017
- PGFracing commented Nov 24, 2017
- Открытие в браузере HTML файла, редактируемого в Sublime Text
- 5 ответов 5
- Второй вариант
- Первый вариант
- Третий вариант
- View In Browser
- Details
- Installs
- Readme
- Sublime Text — View In Browser
- Installation
- Configuring Browsers
- Other Browsers
- Windows Considerations
- Configure to View on Local Server
- Change History
- Contributors
- License
View in browser sublime text 3 не работает
Поставь плагин Sublime Text — View In Browser
Его пожно поставить при помощи Package Control. Если он еще не установлено то в sublime3 его можно поставить так:
1.Открываем консоль путем нажатия ctrl+` или тыкаем в View > Show Console menu.
2.Копируем туда эту команду:
3.Ждем пока пакеты установятся и перезапускаем Sublime Text3.
Теперь используем Package Control что бы поставить View In Browser:
1.Жмем Command-Shift-P (Mac OS X) или Ctrl-Shift-P (Windows) что бы открыть Command Palette.
2.Начинаем набирать фразу Package Control пока не появится подходящая команда.
3. Вводим Install Package, пока не увидите «пакет управления: Установите пакет». Выбрать его и нажать Return/Enter.
3. В текстовом поле начинайте набирать фразу View In Browser пока не появится, когда появится нажмите Enter, чтобы установить его.
4.Перезапуск Sublime Text.
Теперь что бы посмотреть открытую Sublime Text вебстраницу можно при помощи комбинации клавишь Ctrl-Alt-V
View In Browser я пробовал, но он почему-то не открывает страницу в браузере не через горячую кнопку ни через верхнее меню.
SideBarEnhancements спустя пол дня я нашел в коде почему не работало отображение в браузерах. Оказывается пути к браузерам нужно вручную исправлять в коде. Если кто-то подскажет в каком формате в этом плагине забиваются хоткеи будит совсем хорошо)))
Попробоуй поставить вручную:
Жми Tools > Build System > New Build System.
Откроется новый таб который называется untitled.sublime-build вот с таким текстом:
Если у тебя мак замени его следующим:
Если у тебя винда то следующим:
Сохрани его с именем «Choose Browser.sublime-build» в следующем месте:
/Library/Application Support/Sublime Text 2/Packages/User
Windows: вот тут я не подскажу, очень давно не видел эту ОS. Очень важно что бы это было место которое Sublime Text знает и БУДЕТ там искать.
Рестарт Sublime Text.
Теперь что бы увидеть проект в броузере, иди в Tools > Build и нажми Command-B (Mac) or Ctrl-B (Windows).
По клавившам: Command-B это хреновая комбинация потому что в маке это по умолчанию «сделать выделенный текст болдовым». Каждый юзер OS X это может легко поменять в System Preferance, а вот как это организовано в Windows я без понятия.
На и немножко не в тему но маленькое ИМХО, для вебстраниц Espresso значительно лучше чем Sublime Text. Я и курс на Линде посмотрел и OS вроде хорошо знаю, но изучить этот редактор — 🤪
Ты ставил его через так как я написал или скопировал файлы с гитхаба?
Источник
Not working open with chrome on windows Sublime Text 3 #31
Comments
nramirez commented Apr 16, 2014
Hello,
I have sublime Text 3 and I can’t edit the Browser.sublime-settings file. I set chrome as my default browser, but as I couldn’t change «%Local AppData%» to my actual route «C:\Program Files (x86)» It isn’t working.
How can I go through this?
Thanks in advance.
PS: It’s working with the other browsers, and I’m using windows 8.1.
The text was updated successfully, but these errors were encountered:
adampresley commented Apr 17, 2014
Are you editing your own user version of the View In Browser.sublime-settings file (described in https://github.com/adampresley/sublime-view-in-browser/wiki/Configuring-Browsers)? If so can you paste it in a comment here so I can look at it?
nramirez commented Apr 19, 2014
thanks @adampresley. My bad :/ I didn’t know I had to copy the default [View In Browser.sublime-settings and paste them to the user [View In Browser.sublime-settings]. So I could overwrite the «%Local AppData%» to my real chrome file location.
Now It’s working 🙂 , I appreciate your help.
mickeo4 commented Jul 7, 2015
This is a really old post but for anyone trying to get this working, this is how I got around it. If u want to use chrome then you set up your user preferences file as mentioned above (changing the default path to chrome to be something like C:/Program Files (x86)/Google/Chrome/Application/chrome.exe and the selectedBrowser at the bottom to ‘chrome’).
In sublime under ‘Preferences->PackageSettings->View in Browser->Settings-Default’, change the bottom section from «browser»: «firefox» to «browser»: «chrome64»
graphitivity commented Sep 2, 2015
Gwad i tried so many things and almost pulled out all the hair on my head but Yay! finally this worked for me. thanks mickeo4.
captix commented Mar 11, 2016
won’t let me edit «Settings-Default», if I browser to the folder where it claims to be stored it’s not there / right click > open containing folder takes to c:/.
to work, left it all as supplied then added this as the only contents of the settings-user:
Jack-Dandy commented Nov 18, 2016 •
Dangit.. Still not working for me.
I tried everything detailed here.
Made the following file in the Packages\User folder:
Edited everything related to Chrome so it will point at the right program location.. and I still can’t get «Open in Browser» to work with it.
dahol commented Jan 31, 2017
@captaininbox Thanks, that solution worked for me 🙂
in «View In Browser.sublime-settings»-file.
korutx commented Oct 19, 2017
|
- I opened the file ViewInBrowserCommand.py line 137, I changed:
value.encode(«ascii») for value.encode(«utf-8»)
PGFracing commented Nov 24, 2017
and I changed the default to firefox, safari, chrome, tried them all nothing happens, it doesn’t open a browser any suggestions?
Источник
Открытие в браузере HTML файла, редактируемого в Sublime Text
Народ, может, кто знает, как запустить html файл из Sublime Text? В NotePad++ это можно выполнить шорткатом Ctrl + Alt + Shift + X .
5 ответов 5
А насколько мне известно Sublime для того и создан что бы добавлять нужный для себя функционал 😉
Все достасточно просто и немного зависит от вашей ОС
Для начала создадим новую систему сборки
в открывшемся нужно написать:
Для Windows (у меня 8.1 но должно работать почти на всех)
При этом двойной слеш нужен для экранирования
Собственно все, сохраняем файл как Chrome.sublime-build
Закрываем и открываем снова SublimeText
Выбираем Chrome и запускать открытые файлы в нем можно нажатием Ctrl+B
Второй вариант
Использование Build System — функции, позволяющей открывать редактируемые в Sublime Text файлы через другие программы.
Лично у меня не заработал вариант, предложенный ув-мым Виктором. Открылся Chrome, но не редактируемый документ. В консоли вывелось следующее:
В моём браузере Pale Moon Portable на Windows 10 файлы открываются, когда в файле «билда» с расширением sublime-build прямые и обратные слэши скомбинированы следующим образом:
$file — системная переменная, означающая открытый на данную минуту файл.
Также в сравнении с ответом Виктора я добавил новый параметр selector . При значении «text.html.basic, text.xml» когда у нас включено автоматическое переключение между Build System: ( Tools → Build System → Automatic ), в браузере при вызове Build будут открываться только XML и HTML-файлы (а также HTM, XHTML). Значения параметра — начальная часть «областей видимости»: открываем пустой файл → View → Syntax → выбираем требуемый синтаксис → получаем scope в нашем пустом файле — как это сделать, подробно расписано здесь, — вставляем нашу область видимости напротив selector . В HTML, HTM, и XHTML область видимости — text.html.basic , в XML, соответственно, text.xml . Перечисление, как видно на примере, ведётся через запятую.
Да, и чтобы не нажимать каждый раз Ctrl+B , имеются дополнительные инструменты быстрого предпросмотра, однако их обзор выходит за пределы поставленного вопроса.
Первый вариант
Для меня наиболее предпочтительный. SublimeServer — HTTP-сервер, реализованный как плагин для Sublime Text. С его использованием может отпасть нужда в Open Server, WAMP Server, Денвере, Mongoose или их альтернативах. Примеры преимуществ использования SublimeServer в сравнении с обычным открытием HTML-файла через Build System:
- Корректное отображение сторонних виджетов,
- Доступность проверки настроек файла .htaccess ,
- Возможность проверки, как выглядит веб-страница на разных экранах, сервисом Screenfly,
- Размеры шрифтов совпадают с теми, которые будут видеть на сайте, а не меньшие,
- Корректная вставка кода с привязкой видео ко времени, полученного на видеохостингах.
Устанавливаем его как и все другие плагины через Package Control → Ctrl+Shift+P → SublimeServer: Start SublimeServer . Автоматически запускать SublimeServer вместе с Sublime Text у меня не выходит. В файле, где работаем, кликаем куда-нибудь правой кнопкой мыши, и в контекстном меню выбираем View in SublimeServer . Можно задать хоткей: Preferences → Key Bindings — User → в открывшийся файл Default(Ваша операционная система).sublime-keymap вставляем < "keys": ["alt+home"], "command": "sublimeserver_browser" >, где alt+home → выбранное вами сочетание горячих клавиш. В файле используется синтаксис JSON, следите за правильной расстановкой <фигурных>, [квадратных] скобок и запятых. Корректный пример файла sublime-keymap :
Третий вариант
Файлы запускаются и из сайдбара, если установлен плагин Sidebar Enhacements. Кликаем правой кнопкой мыши по имени файла в сайдбаре → Open Run → файл откроется в сопоставленной ему программе, для HTML это обычно браузер по умолчанию.
Если желаете открыть файл в другом браузере, требуется произвести настройки: кликаем правой кнопкой мыши по имени файла в сайдбаре → Open With → Edit Applications. → в открывшийся файл вставляем код и сохраняем его:
- «caption»: «Firefox Portable» — отображаемое имя Вашего браузера. Можно задать любое, какое удобно.
- «id»: «side-bar-files-open-with-firefoxportable» — необходимо написать side-bar-files-open-with- , а дальше задаёте имя по собственному усмотрению.
- «E:\\Firefox\\FirefoxPortable.exe» — путь к исполняемому файлу браузера. Проще указывать абсолютный, нежели относительный. Слэши обратные и дублируются.
«extensions»:»html|htm» — в контекстном меню после клика правой кнопкой мыши по имени файла пункт Firefox Portable будет показываться только, если файл имеет расширение html или htm , расширения отделяются друг от друга через пайп. Параметр extensions может принимать и другие значения:
«extensions»: «» — пункт Firefox Portable будет показываться в контекстном меню, если мы в сайдбаре кликнем правой кнопкой мыши по файлу с любым расширением или папке.
«extensions» :». *» — пункт Firefox Portable будет показываться в контекстном меню, когда мы в сайдбаре кликнем правой кнопкой мыши по файлу с любым расширением, но не папке.
Кликаем в сайдбаре правой кнопкой мыши по файлу с расширением html или htm → Open With → Firefox Portable → файл откроется в портативной версии Firefox.
Источник
View In Browser
Open the contents of your current view/tab in a web browser
Details
- Version 2021.02.24.01.47.56
- Homepage github.com
- Issues github.com
- Modified 8 months ago
- Last Seen 3 hours ago
- First Seen 9 years ago
Installs
- Total 446K
- Win 323K
- Mac 91K
- Linux 32K
| Oct 18 | Oct 17 | Oct 16 | Oct 15 | Oct 14 | Oct 13 | Oct 12 | Oct 11 | Oct 10 | Oct 9 | Oct 8 | Oct 7 | Oct 6 | Oct 5 | Oct 4 | Oct 3 | Oct 2 | Oct 1 | Sep 30 | Sep 29 | Sep 28 | Sep 27 | Sep 26 | Sep 25 | Sep 24 | Sep 23 | Sep 22 | Sep 21 | Sep 20 | Sep 19 | Sep 18 | Sep 17 | Sep 16 | Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 68 | 61 | 58 | 58 | 92 | 92 | 84 | 95 | 71 | 70 | 85 | 74 | 81 | 72 | 75 | 44 | 119 | 68 | 80 | 100 | 128 | 100 | 77 | 76 | 98 | 115 | 96 | 71 | 77 | 61 | 134 | 123 | 103 | 130 | 167 | 126 | 75 | 73 | 184 | 176 | 148 | 151 | 137 | 66 | 72 | 148 |
| Mac | 8 | 12 | 8 | 6 | 9 | 23 | 20 | 17 | 6 | 3 | 20 | 17 | 18 | 15 | 11 | 9 | 7 | 17 | 16 | 28 | 20 | 28 | 11 | 15 | 26 | 15 | 27 | 16 | 14 | 10 | 11 | 17 | 13 | 12 | 18 | 19 | 9 | 14 | 13 | 14 | 19 | 22 | 16 | 5 | 12 | 16 |
| Linux | 3 | 5 | 3 | 7 | 10 | 11 | 7 | 5 | 3 | 6 | 5 | 12 | 10 | 6 | 7 | 3 | 6 | 7 | 3 | 6 | 14 | 13 | 7 | 8 | 10 | 5 | 11 | 6 | 9 | 5 | 6 | 6 | 4 | 11 | 7 | 5 | 1 | 3 | 6 | 13 | 6 | 3 | 6 | 4 | 3 | 9 |
Readme
Sublime Text — View In Browser
View In Browser is a Sublime Text plugin that will open whatever is in your current view/tab. If the file current open is new and has not been saved a temporary file is created (in your default temp directory for your OS) with the extension of .htm and your browser will open it. However if the current open file is saved and has a name this plugin will open it in whatever you have set to handle its type.
By default the keystroke assigned to this plugin is CTRL + ALT + V.
Installation
Using the Sublime Text Package Control plugin (http://wbond.net/sublime_packages/package_control) press CTRL + SHIFT + P and find Package Control: Install Package and press Enter. Find this plugin in the list by name View In Browser.
Configuring Browsers
By default this plugin will open files in Firefox. You can configure it to open using another browser of your choice. To do this, choose Settings — User from Preferences > Package Settings > View In Browser.
The browser you wish to use to open files is set in the key named browser. The following is a list of browsers configured for use out of the box.
- Firefox — Mac OS, Linux, Windows
- Chrome — Mac OS, Linux, Windows
- Chrome64 — Windows
- Yandex — Windows
- Safari — Mac OS
- Internet Explorer — Windows
- Chromium — Linux
Other Browsers
View In Browser also provides key bindings to open your current view in browser other than your browser setting. Below is a listing of the keys and what browser open with those key bindings.
- CTRL + ALT + F — Firefox
- CTRL + ALT + C — Chrome
- CTRL + ALT + I — Internet Explorer
- CTRL + ALT + S — Safari
Like any other key binding in Sublime these can be changed. Below is an example of the key configuration. You can remap these in your User key bindings configuration file.
Windows Considerations
One of the things you may notice in the Windows configuration for chrome is a variable in the command path that looks like: %Local AppData%. This is a reference to your Windows installation’s AppData folder in your user profile directory. There is a variable there because this value will differ for each user on your computer, and Chrome installs to your AppData folder.
Here is a list of supported variables:
- AppData — Your main application data folder for your profile (usually roaming)
- Personal — Your documents location
- Desktop — The path to your Desktop location (may be unreliable)
- Start Menu — The path to your Start Menu items location
- Local AppData — Your local application data folder for your profile
- My Video — Path to your videos location
- My Pictures — Path to your pictures location
- My Music — Path to your music location
Note that many of these are not terribly useful for determining browser location, unless you have decided to install Firefox in your My Music folder.
Configure to View on Local Server
The View In Browser plugin also supports the ability to view files in the context of a local server. So if you have a local Apache, Tomcat, or some other server application running you can configure this plugin to open your file prefixed with a URL.
To configure this the View In Browser plugin reads the configuration of your currently loaded project. You can edit a project file by opening the sublime-project file by choosing Project -> Edit Project. In your project file you will need to specify two things:
- baseUrl — The root URL to prefix files with
- basePath — The base path where your site/application lives
Here’s how that looks.
Notice the key named settings which is a dictionary that contains another key named sublime-view-in-browser. This is where you will put your baseUrl and basePath settings.
Now when you activate View In Browser your file will open with the HTTP protocol instead of the FILE protocol.
Change History
- 03/11/2016:
- Fix issue where parenthesis in paths would cause a failure to load. Solves #52
- 10/06/2014:
- Rewrite for version 2.0.0
- Using subprocess instead of webbrowser. Seems to solve #19
- Smaller, simplier sublime-settings file
- 05/15/2014:
- Current view only saves if there are modifications
- 07/03/2013:
- Changes to support Sublime Text 3 and Python 3
- 06/15/2013:
- Backslashes in Windows are now converted to forward slashes when using a local server configuration. Closes #16
- 04/16/2013:
- Added support for muliple paths per browser configuration (jadient #14)
- 03/08/2013:
- Avoid loading Windows special folder references when on a Mac
- Added Mac Chrome to the supported browsers list
- 02/18/2013:
- Added ability to use Windows special folder references to browser commands. Closes #10
- 01/30/2013:
- All settings for this plugin now live in the file View In Browser.sublime-settings. This allows for a user to override them in their User directory. The old settings.json file is no longer used.
- 01/28/2013:
- Merged in change from imaginationac to remove menu nesting
- 12/26/2012:
- Added Linux Chromium to the supported browsers list
- 11/01/2012:
- Altered command to open Safari on Mac
- When invoked the current view is auto-saved
- 10/25/2012:
- New settings.json file to map browser/commands to OSes
- Plugin will use the specified browser to open files, or default to OS default when browser is unsupported
- Addressed encoding issue when calling open_new_tab
- Added ability to specify and respect local server config per project
- 05/21/2012:
- Temp file only created if view is unsaved
- 05/18/2012:
- Initial code
Contributors
- Dorian Patterson — imaginationac
- Neil Freeman — fitnr
- Michael MacDonald — schlick
- Jadient — jadient
License
The MIT License (MIT) Copyright © 2012 Adam Presley
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Источник