Merge branch 'quit_tabs_and_args'.
Conflicts: lib/command.coffee lib/ex.coffee
This commit is contained in:
commit
55bb9f6319
2 changed files with 43 additions and 12 deletions
|
|
@ -1,15 +1,46 @@
|
|||
class Ex
|
||||
write: ->
|
||||
if atom.workspace.getActiveTextEditor().getPath() isnt undefined
|
||||
atom.workspace.getActiveEditor().save()
|
||||
else
|
||||
atom.workspace.getActivePane().saveActiveItemAs()
|
||||
path = require 'path'
|
||||
|
||||
class Ex
|
||||
quit: ->
|
||||
atom.workspace.getActivePane().destroyActiveItem()
|
||||
|
||||
q: =>
|
||||
@quit()
|
||||
|
||||
tabedit: (filePaths...) ->
|
||||
pane = atom.workspace.getActivePane()
|
||||
if filePaths? and filePaths.length > 0
|
||||
for file in filePaths
|
||||
do -> atom.workspace.openURIInPane file, pane
|
||||
else
|
||||
atom.workspace.openURIInPane('', pane)
|
||||
|
||||
tabe: (filePaths...) =>
|
||||
@tabedit(filePaths...)
|
||||
|
||||
write: (filePath) =>
|
||||
projectPath = atom.project.getPath()
|
||||
pane = atom.workspace.getActivePane()
|
||||
editor = atom.workspace.getActiveEditor()
|
||||
if atom.workspace.getActiveTextEditor().getPath() isnt undefined
|
||||
if filePath?
|
||||
editorPath = editor.getPath()
|
||||
editor.saveAs(path.join(projectPath, filePath))
|
||||
editor.buffer.setPath(editorPath)
|
||||
else
|
||||
editor.save()
|
||||
else
|
||||
if filePath?
|
||||
editor.saveAs(path.join(projectPath, filePath))
|
||||
else
|
||||
pane.saveActiveItemAs()
|
||||
|
||||
w: (filePath) => @write(filePath)
|
||||
|
||||
w: => @write()
|
||||
wa: ->
|
||||
atom.workspace.saveAll()
|
||||
|
||||
split: (filePaths) ->
|
||||
split: (filePaths...) ->
|
||||
pane = atom.workspace.getActivePane()
|
||||
if filePaths? and filePaths.length > 0
|
||||
newPane = pane.splitUp()
|
||||
|
|
@ -19,9 +50,9 @@ class Ex
|
|||
else
|
||||
pane.splitUp(copyActiveItem: true)
|
||||
|
||||
sp: (filePaths) => @split(filePaths)
|
||||
sp: (filePaths...) => @split(filePaths...)
|
||||
|
||||
vsplit: (filePaths) ->
|
||||
vsplit: (filePaths...) ->
|
||||
pane = atom.workspace.getActivePane()
|
||||
if filePaths? and filePaths.length > 0
|
||||
newPane = pane.splitLeft()
|
||||
|
|
@ -31,6 +62,6 @@ class Ex
|
|||
else
|
||||
pane.splitLeft(copyActiveItem: true)
|
||||
|
||||
vsp: (filePaths) => @vsplit(filePaths)
|
||||
vsp: (filePaths...) => @vsplit(filePaths...)
|
||||
|
||||
module.exports = Ex
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue