Created
November 24, 2015 15:12
-
-
Save aeberlin/f652718898dc91fef564 to your computer and use it in GitHub Desktop.
Atom Path Initialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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