Skip to content

Instantly share code, notes, and snippets.

@aeberlin
Created November 24, 2015 15:12
Show Gist options
  • Save aeberlin/f652718898dc91fef564 to your computer and use it in GitHub Desktop.
Save aeberlin/f652718898dc91fef564 to your computer and use it in GitHub Desktop.
Atom Path Initialization
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
# console.log "Saved! #{editor.getPath()}"
window.childProcess = require('child_process')
window.fs = require('fs')
window.path = require('path')
window.spawn = require('child_process').spawn
window.spawnPath = atom.project.getPaths()[0]
if not fs.statSync(window.spawnPath).isDirectory()
window.spawnPath = path.dirname(dir)
cdCommand = 'cd ' + window.spawnPath
pathCommand = 'echo $PATH'
commandArgs = '-c "' + cdCommand + ' && ' + pathCommand + '"'
command = '/usr/local/bin/zsh ' + commandArgs
output = childProcess.execSync(command)
process.env.PATH = String.fromCharCode.apply(null, output)
# Open developer tools
# editor = atom.workspace.getActiveTextEditor()
# editorElement = atom.views.getView(editor)
# atom.commands.dispatch(editorElement, 'window:toggle-dev-tools')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment