Skip to content

Configuring Editors

timholy edited this page Nov 3, 2012 · 9 revisions

Configuring editors to display the code nicely is always good.

Emacs

julia-mode.el

In the git version c contains a julia-mode path-to-julia/contrib/julia-mode.el.(Note: that may change, please in that case update) Adding the following to ~/.emacs should work:

(add-to-list 'load-path "path-to-julia/contrib/") ;Tell emacs to look for the file there.
(require 'julia-mode)                             ;Tell it to load it.
(setq auto-mode-alist                             ;Tell it to go to julia-mode when a Julia file(.jl) is spotted.
      (append '(("\\.jl$" . julia-mode)) auto-mode-alist))

Maybe you do not want to add the folder, alternatively omit the first line and

cd where-you-keep-your-elisp-files
ln -s path-to-julia/contrib/julia-mode.el julia-mode.el

ESS

Development version of ESS supports julia editing and sub-process interaction. It includes an improved version of julia-mode.el from above. Installation and usage instructions can be found here.

Vim

Instructions for installing Vim support for Julia can be found in the julia-vim repo, which provides pathogen, vbundle, and manual installation options.

TextMate

Copy (or symlink) the TextMate Julia bundle into the TextMate application support directory:

cp -r JULIA_PATH/contrib/Julia.tmbundle ~/Library/Application\ Support/TextMate/Bundles/

where JULIA_PATH is the location of the top-level julia directory. Now select from the menu in TextMate Bundles > Bundle Editor > Reload Bundles. Julia should appear as a file type and be automatically detected for files with the .jl extension.

TextMate 2

Copy the TextMate Julia bundle into the Avian application support directory from JULIA_PATH, which is assumed to be the location of the top-level Julia directory:

mkdir ~/Library/Application\ Support/Avian
mkdir ~/Library/Application\ Support/Avian/Pristine\ Copy
mkdir ~/Library/Application\ Support/Avian/Pristine\ Copy/Bundles
cp -r JULIA_PATH/contrib/Julia.tmbundle/ ~/Library/Application\ Support/Avian/Pristine\ Copy/Bundles/Julia.tmbundle
mate .

The Julia bundle will now provide syntax highlighting. Just select it for one .jl document and you should be set up from then on.

#Sublime Text 2

The TextMate bundle also works with Sublime Text 2. Copy it into the packages directory:

cp -r JULIA_PATH/contrib/Julia.tmbundle ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/

#Notepad++ (Windows)

Syntax highlighting definitions for Notepad++ are available at https://gist.github.com/3858496. (My apologies for not making a pull request to /contrib -- our firewall is not very github friendly). Copy it into /users/{username}/AppData/Roaming/Notepad++/. There is a companion Autohotkey file at https://gist.github.com/3858529 to streamline copy/paste from Notepad++ to the Julia console, RGUI style, for REPL-oriented development.

Kate

The Julia syntax highlighting file is now bundled with Kate. To download/update, in Kate choose Settings->Configure Kate...->Open/Save. Open the tab "Modes&Filetypes", then click "Download Highlighting Files..." and "Install".

Alternatively, use the highlighting file in contrib/julia.xml. Make a symbolic link to this file in /usr/share/kde4/apps/katepart/syntax (at least, this is the right directory for (K)Ubuntu).

To set up indentation, there's one additional step: under "Modes&Filetypes", for the Sources/Julia filetype put the following in the Variables field:

kate: space-indent on; indent-width 4; mixed-indent off; indent-mode cstyle;

Other editors

If you figured out how to do it for other editors, dont hold back!

Clone this wiki locally