2014-06-27 26 views

回答

36

您可以将下面的代码添加到您的init.coffee文件:

atom.commands.add 'atom-text-editor', 'custom:cut-line', -> 
    editor = atom.workspace.getActiveTextEditor() 
    editor.selectLinesContainingCursors() 
    editor.cutSelectedText() 

可以让代码通过搜索命令面板串从源头上执行。一旦你有一个命令创建的,您可以通过编辑keymap.cson文件映射键一下:

'atom-text-editor': 
    'alt-cmd-z': 'custom:cut-line' 
+2

我发现的代码在原子/ src目录/ [register-default-commands.coffee]的命令(HTTPS ://github.com/atom/atom/blob/f376316d60b7b0e96ceaff8c631ea6458f31907c/src/register-default-commands.coffee) – pguardiario

+2

我想使用已安装的软件包进行组合命令。我如何去使用非编辑器命令? – Erich

+0

@Erich也许这个答案会帮助你? https://stackoverflow.com/a/27230783/6426778 – Tweakimp