added search and used promises for wq
This commit is contained in:
parent
2cafba248c
commit
0b2af22202
1 changed files with 17 additions and 12 deletions
|
|
@ -1,30 +1,35 @@
|
|||
class Ex
|
||||
quit: ->
|
||||
atom.workspace.getActivePane().destroyActiveItem()
|
||||
|
||||
q: =>
|
||||
@quit()
|
||||
|
||||
s: ->
|
||||
setTimeout(->
|
||||
atom.commands.dispatch(atom.views.getView(atom.workspace.getActiveEditor()), 'find-and-replace:show')
|
||||
, 100) # Timeout is for working around issue where the search area doesn't focus
|
||||
|
||||
tabedit: (filenames) ->
|
||||
if filenames? and filenames.length > 0
|
||||
atom.open(pathsToOpen: filenames)
|
||||
else
|
||||
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")
|
||||
|
||||
write: () =>
|
||||
dfd = Promise.defer()
|
||||
|
||||
if atom.workspace.getActiveTextEditor().getPath() isnt undefined
|
||||
atom.workspace.getActivePane().saveItem(atom.workspace.getActivePane().getActiveItem(), nextAction)
|
||||
atom.workspace.getActivePane().saveItem(atom.workspace.getActivePane().getActiveItem(), dfd.resolve)
|
||||
else
|
||||
atom.workspace.getActivePane().saveActiveItemAs(nextAction)
|
||||
atom.workspace.getActivePane().saveActiveItemAs(dfd.resolve)
|
||||
|
||||
dfd.promise
|
||||
|
||||
w: => @write()
|
||||
wq: =>
|
||||
@write(close=true)
|
||||
wq: => @write().then(=>@quit())
|
||||
|
||||
module.exports = Ex
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue