From 65283686429c059643a414413d194a5bcad282c5 Mon Sep 17 00:00:00 2001 From: Tom Wiesing Date: Fri, 23 Jan 2015 12:28:36 +0100 Subject: [PATCH] Remove depracated calls (fixes karan/atom-terminal#22) and fallback to open-project-root when no file is open (partially handles karan/atom-terminal#20) --- keymaps/atom-terminal.cson | 2 +- lib/atom-terminal.coffee | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/keymaps/atom-terminal.cson b/keymaps/atom-terminal.cson index 56cbe3d..cacbd19 100644 --- a/keymaps/atom-terminal.cson +++ b/keymaps/atom-terminal.cson @@ -7,6 +7,6 @@ # For more detailed documentation see # https://atom.io/docs/latest/advanced/keymaps -'.workspace': +'atom-workspace': 'ctrl-shift-t': 'atom-terminal:open' 'alt-shift-t': 'atom-terminal:open-project-root' diff --git a/lib/atom-terminal.coffee b/lib/atom-terminal.coffee index 8a6925e..bcf816e 100644 --- a/lib/atom-terminal.coffee +++ b/lib/atom-terminal.coffee @@ -42,17 +42,19 @@ open_terminal = (dirpath) -> module.exports = activate: -> - atom.workspaceView.command "atom-terminal:open", => @open() - atom.workspaceView.command "atom-terminal:open-project-root", => @openroot() + atom.commands.add "atom-workspace", "atom-terminal:open", => @open() + atom.commands.add "atom-workspace", "atom-terminal:open-project-root", => @openroot() open: -> editor = atom.workspace.getActivePaneItem() - file = editor?.buffer.file + file = editor?.buffer?.file filepath = file?.path if filepath open_terminal path.dirname(filepath) + else + @openroot + openroot: -> - if atom.project.path - open_terminal atom.project.path + open_terminal path for path in atom.project.getPaths() # Set per-platform defaults if platform() == 'darwin'