Merge 2cafba248c into 4a547e64fd
This commit is contained in:
commit
1a8050e03a
2 changed files with 28 additions and 6 deletions
|
|
@ -11,10 +11,11 @@ class Command
|
|||
|
||||
execute: (input) ->
|
||||
return unless input.characters.length > 0
|
||||
[command, args...] = input.characters.split(" ")
|
||||
|
||||
func = (new Ex)[input.characters]
|
||||
func = (new Ex)[command]
|
||||
if func?
|
||||
func()
|
||||
func(args)
|
||||
else
|
||||
throw new CommandError("#{input.characters}")
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue