Atom

Stephen Y.F. Wang

Updated: 10/10/2018


 

Atom (https://atom.io/) is “a hackable text editor for the 21st Century” 你好啊

其实也不是的啊,你是谁,打死你哈哈

Why use a third party Source Code Editor

  • Multi-Language environment, Multi-Document, Run inside and from the editor
  • Auto-completion, Syntax Highlighting 高亮显示
  • Linter
  • Regular Expression Enhanced Find and Replace

Auxiliary Package 软件包

  • Using proxy inside Atom, such as Goagent: apm config set https-proxy=http://127.0.0.1:8087/ apm config set strict-ssl false

  • Change Atom’s token limit for syntax highlighting: apm install grammar-token-limit

  • Minimap: apm install minimap

  • View pdf in Atom: apm install pdf-view

  • Open file using external program: apm install open-unsupported-files

  • Text-clicking: apm install hyperclick

  • Terminal: apm install open-conemu-here

  • Font spec: apm install fonts, then choose font in settings

  • Enhanced column selection: apm install column-select

  • Auto-encoding: apm install auto-encoding, and in the package setting disallow windows 1252, useful when deal with both Stata 14 and older versions

  • Run program using any Jupyter kernels inside Atom: apm install hydrogen, need Jupyter installed

  • Run program from Atom: apm install script

  • Show file-icon associated with file extension: apm install file-icons

  • Linter package for Atom: apm install linter

Language

Stata

  1. Language: apm install language-stata, with autocomplete inside, if want more key words, just add words in the grammar file
  2. Run inside Atom: using hydrogen, should install the stata-kernel package for IPython (https://github.com/jrfiedler/stata-kernel) as:
    1. Register Stata instance: cd to Stata installation directory, then type something like:
      StataMP-64.exe /Register
    2. pip install git+https://github.com/jrfiedler/stata-kernel
    3. python -m stata_kernel.install
  3. Run from Atom: use AutoIt program and Script:
    1. In file /.atom/packages/script/lib/grammars.coffee, replace the Stata section as

    2. In file /.atom/packages/script/lib/grammar-utils.js, add this:

    3. Create a file named Stata.js in /.atom/packages/script/lib/grammar-utils with content:

    4. The AutoIt program and the associated ini file can be download from http://pan.baidu.com/s/1eSsMYkE, make sure change the path of Stata program and Title of Stata window in the ini file, and also the AutoIt program path in script’s grammars.coffee

Python

  1. Language is build in
  2. Autocomplete enhanced (jedi): apm install autocomplete-python
  3. Run inside Atom by IPython: using hydrogen
  4. Run from Atom: use AutoIt program and Script
    1. In file /.atom/packages/script/lib/grammars.coffee, replace the Python section as

    2. In file /.atom/packages/script/lib/grammar-utils.js, add this:

    3. In /.atom/packages/script/lib/grammar-utils, create a file named Python.js with content:

    4. The AutoIt program and the associated ini file can be download from http://pan.baidu.com/s/1eSsMYkE, make sure change the path of IPythonexec program and Title of IPython window in the ini file, and also the AutoIt program path in script’s grammars.coffee
  5. Linter: apm install linter-pep8, should install pep8 within Python, pip install pep8 (note that there are various coding styles for Python)

Fortran

  1. Language: apm install language-fortran, apm install language-openmp
  2. Autocomplete: apm install autocomplete-fortran
  3. Compile: you can use Script, but it is better to use a makefile
  4. Linter: apm install linter-gfortran

R

  1. Language: apm install language-r
  2. Autocomplete: apm install autocomplete-r
  3. Run inside Atom: using hydrogen, should install IRkernel (https://github.com/IRkernel/IRkernel):
    1. install.packages(c('pbdZMQ', 'repr', 'devtools', 'stringr'))
    2. devtools::install_github('IRkernel/IRdisplay')
    3. devtools::install_github('IRkernel/IRkernel')
    4. IRkernel::installspec()
  4. Linter: apm install linter-lintr, should install lintr within R, install.packages("lintr")

LaTeX

  1. Language: apm install language-latex
  2. Compile: apm install latextools, with various autocomplete inside, note that latextools is build on the clever latexmk command, you can also use makefile to compile latex codes
  3. Inverse Search with SumatraPDF:
    SumatraPDF.exe -inverse-search "/"/AppData/Local/atom/bin/atom.cmd/" /"%f:%l/""
  4. Forward Search: apm install sumatra-forwardsearch, does not working now
  5. Extra utilities for LaTex editing: apm install latex-friend
  6. Linter: apm install linter-chktex

Pandoc Markdown

  1. Language: apm install language-pfm, and disable the built-in language-gfm,
    Assistant: apm install markdown-writer
  2. Preview: apm install markdown-preview-plus, disable the built-in markdown-preview Setting: enable math, use github.com style, enable pandoc parser, full path of pandoc.exe, markdown flavor choose markdown
    command line options: --mathjax --highlight-style=zenburn
    apm install markdown-scroll-sync
  3. Linter: apm install linter-markdown
  4. Markdown to Latex:
    1. Convert through CMD or makefile, makefile is better in project, for example

    2. Source Code highlight: minted, with pandoc-minted filter (https://github.com/nick-ulle/pandoc-minted)
      should install pandocfilters in python, and add %!TEX option = -shell-escape to the root latex document
  5. Convert Markdown to various format using init.coffee: