前端工程師編輯器 - Atom < 客製化程式碼 + 快速鍵 >

最近再使用 Atom editor 但發現快速鍵沒有自己想要!所以研究了一下自訂快速鍵產生程式碼。
整理如下:
主要透過兩個atom功能,一是init.coffee功能註冊,二是keymap自訂快速鍵。


點選init.coffee加入以下的程式

atom.commands.add 'atom-text-editor', 'user:insert-console': (event) ->
  editor = atom.workspace.getActiveTextEditor()
  selection = editor.getLastSelection()
  curText = selection.getText()
  selection.insertText('console.log('+curText+');')









點選keymap設定快速建
PS: alt+1 可以換自己想要的快速鍵

  'atom-text-editor':
      'alt-1': 'user:insert-console'









完成以上設定後按下 ctrl+alt+R 刷新 atom 就可以使用快速鍵新增程式碼囉!

enjoy it!



FYI.
short cut list
https://gist.github.com/jcouyang/10816025

留言