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
|
class Ex
|
||||||
quit: ->
|
quit: ->
|
||||||
atom.workspace.getActivePane().destroyActiveItem()
|
atom.workspace.getActivePane().destroyActiveItem()
|
||||||
|
|
||||||
q: =>
|
q: =>
|
||||||
@quit()
|
@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) ->
|
tabedit: (filenames) ->
|
||||||
if filenames? and filenames.length > 0
|
if filenames? and filenames.length > 0
|
||||||
atom.open(pathsToOpen: filenames)
|
atom.open(pathsToOpen: filenames)
|
||||||
else
|
else
|
||||||
atom.open()
|
atom.open()
|
||||||
|
|
||||||
tabe: (filenames) =>
|
tabe: (filenames) =>
|
||||||
@tabedit(filenames)
|
@tabedit(filenames)
|
||||||
write: (close=false) =>
|
|
||||||
if close
|
write: () =>
|
||||||
nextAction = ->
|
dfd = Promise.defer()
|
||||||
atom.notifications.addSuccess("Saved and closed")
|
|
||||||
atom.workspace.getActivePane().destroyActiveItem()
|
|
||||||
else
|
|
||||||
nextAction = ->
|
|
||||||
atom.notifications.addSuccess("Saved")
|
|
||||||
|
|
||||||
if atom.workspace.getActiveTextEditor().getPath() isnt undefined
|
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
|
else
|
||||||
atom.workspace.getActivePane().saveActiveItemAs(nextAction)
|
atom.workspace.getActivePane().saveActiveItemAs(dfd.resolve)
|
||||||
|
|
||||||
|
dfd.promise
|
||||||
|
|
||||||
w: => @write()
|
w: => @write()
|
||||||
wq: =>
|
wq: => @write().then(=>@quit())
|
||||||
@write(close=true)
|
|
||||||
|
|
||||||
module.exports = Ex
|
module.exports = Ex
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue