Merge pull request #120 from caiocutrim:master
Add :wall, :quitall and :wqall commands
This commit is contained in:
commit
c16576f08b
2 changed files with 47 additions and 2 deletions
|
|
@ -112,8 +112,13 @@ class Ex
|
||||||
quit: ->
|
quit: ->
|
||||||
atom.workspace.getActivePane().destroyActiveItem()
|
atom.workspace.getActivePane().destroyActiveItem()
|
||||||
|
|
||||||
|
quitall: ->
|
||||||
|
atom.close()
|
||||||
|
|
||||||
q: => @quit()
|
q: => @quit()
|
||||||
|
|
||||||
|
qall: => @quitall()
|
||||||
|
|
||||||
tabedit: (args) =>
|
tabedit: (args) =>
|
||||||
if args.args.trim() isnt ''
|
if args.args.trim() isnt ''
|
||||||
@edit(args)
|
@edit(args)
|
||||||
|
|
@ -216,20 +221,37 @@ class Ex
|
||||||
|
|
||||||
deferred.promise
|
deferred.promise
|
||||||
|
|
||||||
|
wall: ->
|
||||||
|
atom.workspace.saveAll()
|
||||||
|
|
||||||
w: (args) =>
|
w: (args) =>
|
||||||
@write(args)
|
@write(args)
|
||||||
|
|
||||||
wq: (args) =>
|
wq: (args) =>
|
||||||
@write(args).then => @quit()
|
@write(args).then => @quit()
|
||||||
|
|
||||||
|
wa: =>
|
||||||
|
@wall()
|
||||||
|
|
||||||
|
wqall: =>
|
||||||
|
@wall()
|
||||||
|
@quitall()
|
||||||
|
|
||||||
|
wqa: =>
|
||||||
|
@wqall()
|
||||||
|
|
||||||
|
xall: =>
|
||||||
|
@wqall()
|
||||||
|
|
||||||
|
xa: =>
|
||||||
|
@wqall()
|
||||||
|
|
||||||
saveas: (args) =>
|
saveas: (args) =>
|
||||||
args.saveas = true
|
args.saveas = true
|
||||||
@write(args)
|
@write(args)
|
||||||
|
|
||||||
xit: (args) => @wq(args)
|
xit: (args) => @wq(args)
|
||||||
|
|
||||||
wa: ->
|
|
||||||
atom.workspace.saveAll()
|
|
||||||
|
|
||||||
split: ({ range, args }) ->
|
split: ({ range, args }) ->
|
||||||
args = args.trim()
|
args = args.trim()
|
||||||
|
|
|
||||||
|
|
@ -162,6 +162,13 @@ describe "the commands", ->
|
||||||
expect(atom.notifications.notifications).toEqual([])
|
expect(atom.notifications.notifications).toEqual([])
|
||||||
expect(fs.readFileSync(existsPath, 'utf-8')).toEqual('abc\ndef')
|
expect(fs.readFileSync(existsPath, 'utf-8')).toEqual('abc\ndef')
|
||||||
|
|
||||||
|
describe ":wall", ->
|
||||||
|
it "saves all", ->
|
||||||
|
spyOn(atom.workspace, 'saveAll')
|
||||||
|
keydown(':')
|
||||||
|
submitNormalModeInputText('wall')
|
||||||
|
expect(atom.workspace.saveAll).toHaveBeenCalled()
|
||||||
|
|
||||||
describe ":saveas", ->
|
describe ":saveas", ->
|
||||||
describe "when editing a new file", ->
|
describe "when editing a new file", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
@ -288,6 +295,13 @@ describe "the commands", ->
|
||||||
submitNormalModeInputText('quit')
|
submitNormalModeInputText('quit')
|
||||||
expect(pane.promptToSaveItem).toHaveBeenCalled()
|
expect(pane.promptToSaveItem).toHaveBeenCalled()
|
||||||
|
|
||||||
|
describe ":quitall", ->
|
||||||
|
it "closes Atom", ->
|
||||||
|
spyOn(atom, 'close')
|
||||||
|
keydown(':')
|
||||||
|
submitNormalModeInputText('quitall')
|
||||||
|
expect(atom.close).toHaveBeenCalled()
|
||||||
|
|
||||||
describe ":tabclose", ->
|
describe ":tabclose", ->
|
||||||
it "acts as an alias to :quit", ->
|
it "acts as an alias to :quit", ->
|
||||||
spyOn(Ex, 'tabclose').andCallThrough()
|
spyOn(Ex, 'tabclose').andCallThrough()
|
||||||
|
|
@ -376,6 +390,15 @@ describe "the commands", ->
|
||||||
submitNormalModeInputText('xit')
|
submitNormalModeInputText('xit')
|
||||||
expect(Ex.wq).toHaveBeenCalled()
|
expect(Ex.wq).toHaveBeenCalled()
|
||||||
|
|
||||||
|
describe ":wqall", ->
|
||||||
|
it "calls :wall, then :quitall", ->
|
||||||
|
spyOn(Ex, 'wall')
|
||||||
|
spyOn(Ex, 'quitall')
|
||||||
|
keydown(':')
|
||||||
|
submitNormalModeInputText('wqall')
|
||||||
|
expect(Ex.wall).toHaveBeenCalled()
|
||||||
|
expect(Ex.quitall).toHaveBeenCalled()
|
||||||
|
|
||||||
describe ":edit", ->
|
describe ":edit", ->
|
||||||
describe "without a file name", ->
|
describe "without a file name", ->
|
||||||
it "reloads the file from the disk", ->
|
it "reloads the file from the disk", ->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue