Update commands

This commit is contained in:
jazzpi 2015-03-22 01:11:34 +01:00
parent 054473a3d1
commit 8b658db090

View file

@ -41,7 +41,9 @@ class Ex
q: => @quit() q: => @quit()
tabedit: (filePaths...) -> tabedit: (range, args) ->
args = args.trimLeft()
filePaths = args.split(' ')
pane = atom.workspace.getActivePane() pane = atom.workspace.getActivePane()
if filePaths? and filePaths.length > 0 if filePaths? and filePaths.length > 0
for file in filePaths for file in filePaths
@ -49,9 +51,9 @@ class Ex
else else
atom.workspace.openURIInPane('', pane) atom.workspace.openURIInPane('', pane)
tabe: (filePaths...) => @tabedit(filePaths...) tabe: (args...) => @tabedit(args...)
tabnew: (filePaths...) => @tabedit(filePaths...) tabnew: (args...) => @tabedit(args...)
tabclose: => @quit() tabclose: => @quit()
@ -69,13 +71,14 @@ class Ex
tabp: => @tabprevious() tabp: => @tabprevious()
edit: (filePath) => @tabedit(filePath) if filePath? edit: (range, filePath) => @tabedit(range, filePath) if filePath?
e: (filePath) => @edit(filePath) e: (args...) => @edit(args...)
enew: => @edit() enew: => @edit()
write: (filePath) -> write: (range, filePath) ->
filePath = filePath.trimLeft()
deferred = Promise.defer() deferred = Promise.defer()
projectPath = atom.project.getPath() projectPath = atom.project.getPath()
@ -111,18 +114,20 @@ class Ex
deferred.promise deferred.promise
w: (filePath) => w: (args...) =>
@write(filePath) @write(args...)
wq: (filePath) => wq: (args...) =>
@write(filePath).then => @quit() @write(args...).then => @quit()
x: => @wq() x: => @wq()
wa: -> wa: ->
atom.workspace.saveAll() atom.workspace.saveAll()
split: (filePaths...) -> split: (range, args) ->
args = args.trimLeft()
filePaths = args.splitLeft()
pane = atom.workspace.getActivePane() pane = atom.workspace.getActivePane()
if filePaths? and filePaths.length > 0 if filePaths? and filePaths.length > 0
newPane = pane.splitUp() newPane = pane.splitUp()
@ -132,9 +137,11 @@ class Ex
else else
pane.splitUp(copyActiveItem: true) pane.splitUp(copyActiveItem: true)
sp: (filePaths...) => @split(filePaths...) sp: (args...) => @split(args...)
vsplit: (filePaths...) -> vsplit: (range, args) ->
args = args.trimLeft()
filePaths = args.split(' ')
pane = atom.workspace.getActivePane() pane = atom.workspace.getActivePane()
if filePaths? and filePaths.length > 0 if filePaths? and filePaths.length > 0
newPane = pane.splitLeft() newPane = pane.splitLeft()
@ -144,6 +151,6 @@ class Ex
else else
pane.splitLeft(copyActiveItem: true) pane.splitLeft(copyActiveItem: true)
vsp: (filePaths...) => @vsplit(filePaths...) vsp: (args...) => @vsplit(args...)
module.exports = Ex module.exports = Ex