added new commands for quitting, opening tabs and added argument functionality for commands

This commit is contained in:
Dave de Fijter 2015-02-22 16:09:40 +01:00
parent 4a547e64fd
commit 2cafba248c
2 changed files with 28 additions and 6 deletions

View file

@ -1,9 +1,30 @@
class Ex
write: ->
if atom.workspace.getActiveTextEditor().getPath() isnt undefined
atom.workspace.getActiveEditor().save()
quit: ->
atom.workspace.getActivePane().destroyActiveItem()
q: =>
@quit()
tabedit: (filenames) ->
if filenames? and filenames.length > 0
atom.open(pathsToOpen: filenames)
else
atom.workspace.getActivePane().saveActiveItemAs()
atom.open()
tabe: (filenames) =>
@tabedit(filenames)
write: (close=false) =>
if close
nextAction = ->
atom.notifications.addSuccess("Saved and closed")
atom.workspace.getActivePane().destroyActiveItem()
else
nextAction = ->
atom.notifications.addSuccess("Saved")
if atom.workspace.getActiveTextEditor().getPath() isnt undefined
atom.workspace.getActivePane().saveItem(atom.workspace.getActivePane().getActiveItem(), nextAction)
else
atom.workspace.getActivePane().saveActiveItemAs(nextAction)
w: => @write()
wq: =>
@write(close=true)
module.exports = Ex