название для официального сайта inFlowia Lab
  • помощь 4 free! :)
  • делаем добро :)
  • делаю сайты, скрипты и хорошее настроение :)
  • всё поправимо! :)
  • Свобода и OPENsource!
  • Linux - это любовь!
  • Linux - это Lюбовь
  • творим добро с 2019/03/22 :)

Atom :: Горячие клавиши для быстрой вставки HTML-тэгов и кое чего ещё

Это динамическая статья. Время от времени она может пополнятся новым контентом, а старый может изменяться или исчезать.

Чтобы понять, появилось ли что-то новенькое взгляните на дату.
Первая дата - дата выхода первой версии статьи.
Вторая дата - дата последних изменений.
Правда, иногда, я забываю обновлять вторую дату... ':)
Чтобы было проще найти новое воспользуйтесь кнопками для подсветки свежих изменений. Заголовки новых добавленных глав, либо фрагменты текста целиком станут выделены в тексте вот таким образом[ NEW! ]. Так что вы сможете либо найти их глазами, либо, если текста много, можете воспользоваться поиском меток [ NEW! ] при помощи поиска по странице.
Если тема для вас очень важна и совсем не хочется пропустить обновления информации лучше будет подписаться на новости и обновления: в группе VK.


Это скрипты для того чтобы по горячим клавишам быстро вставлять в текст HTML-тэги, либо оборачивать ими выделение в текстовом редакторе Atom. (+ Ещё кое какие полезные для меня). Какая клавиша куда относится разберётесь сами. Выж программисты :)

В init.coffee

wrapSelection = (selection, before, after) -> after ?= before selectedText = selection.getText() selection.insertText("#{before}#{selectedText}#{after}") atom.commands.add 'atom-text-editor', 'custom:insert-html-a', -> editor = @getModel() editor.transact -> wrapSelection(selection, '<a target = \'_blank\' href = \'\'>', '</a>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-b': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<b>', '</b>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-p': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<p>', '</p>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-ul': -> atom.workspace.getActiveTextEditor()?.insertText('<ul class = \'minus\'>\n <li></li>\n</ul>') atom.commands.add 'atom-text-editor', 'custom:insert-html-li': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<li>', '</li>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-span': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<span class = \'\' style = \'\'>', '</span>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-br': -> atom.workspace.getActiveTextEditor()?.insertText('<br>') atom.commands.add 'atom-text-editor', 'custom:insert-html-h1': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<h1>', '</h1>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-h2': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<h2>', '</h2>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-h3': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<h3>', '</h3>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-h4': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<h4>', '</h4>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-tr': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<tr>', '</tr>') for selection in editor.getSelections() atom.commands.add 'atom-text-editor', 'custom:insert-html-td': -> editor = @getModel() editor.transact -> wrapSelection(selection, '<td>', '</td>') for selection in editor.getSelections()

Там где вы видите пустые строчки можно делать сколько угодно переносов строки. Прокатит ли в других местах - не уверен. Синтаксис Atom остаётся для меня загадкой и тот факт что замена пробелов на табуляции у меня приводила к ошибкам намекает, на то что привычные вольности здесь могут не прокатить.

В keymap.cson

'atom-text-editor': 'alt-a': 'custom:insert-html-a' 'alt-b': 'custom:insert-html-b' 'alt-p': 'custom:insert-html-p' 'alt-l': 'custom:insert-html-li' 'alt-u': 'custom:insert-html-ul' 'alt-n': 'custom:insert-html-br' 'alt-z': 'custom:insert-html-span' 'ctrl-shift-q': 'custom:insert-html-h1' 'ctrl-shift-w': 'custom:insert-html-h2' 'ctrl-shift-e': 'custom:insert-html-h3' 'ctrl-shift-r': 'custom:insert-html-h4' 'alt-r': 'custom:insert-html-tr' 'alt-d': 'custom:insert-html-td' 'atom-workspace atom-text-editor:not([mini])': 'ctrl-alt-]': 'editor:fold-all' 'ctrl-alt-[': 'editor:unfold-all' 'body': 'ctrl-shift-S': 'window:save-all'

Работало так на:


  • Atom 1.26.1 x64
  • Ubuntu Studio 18.04.3 64-bit

Помогло? :)

Черкани Инфловии пару строк если нашёл здесь помощь. Можешь писать под любым постом в группе VK или по старинке на почту: inFlowia@netc.it :)

inFlowia Lab. не делает добро за деньги, но знать, что её труды кому-то помогают очень классно. Если тебе помогли - не поленись, всего пара слов: "Спасибо! Помогло :)" сделают дни инфловии светлее. ^^

Количество откликнувшихся: 8