# 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 make opened Markdown files always be soft wrapped: # # path = require 'path' # # atom.workspaceView.eachEditorView (editorView) -> # editor = editorView.getEditor() # if path.extname(editor.getPath()) is '.md' # editor.setSoftWrap(true) os = require 'os' hostname = os.hostname() childProcess = require 'child_process' # Problem: Atom won't inherit the $PATH variable set in your default OS X shell (Terminal). # Solution: Launch an interactive shell and return $PATH from that. The interactive # shell will run through all your various .files (.zshrc, .zshenv, etc.) before # returning. Works well if your path is changed by NVM or RVM. Some existing solutions # don't work if your shells output a MOTD or any other text before executing # 'echo $PATH', as that will also be returned. Since your path _should_ be the last # line output we can grab all text after the last newline character and use that as Atom's path. # # Some related issues: # https://github.com/atom/atom/issues/6956 # https://github.com/atom-community/linter/issues/726 shellOutput = childProcess.execFileSync(process.env.SHELL, ['-i', '-c', 'echo $PATH']).toString().trim().split('\n') process.env.PATH = shellOutput[shellOutput.length - 1] # TODO: read this from my $HOME/.zshrc file if hostname is 'lgml-mupshur1' console.log "Init for #{hostname}" if hostname is 'Adamantium' console.log "Init for #{hostname}"