Skip to content
Back to top
View this page
Edit this page

# Editor and IDE

## Sublime Text

There is a xonsh package for Sublime Text 4 (build > 4075). To install:

- Via Package Control: open (`^`/`⌘` `⇧` `P`) `Command Palette` → `Package Control: Install Package` → `xonsh`

- Manually: clone the repository to your Sublime Text packages directory and rename it to `xonsh`

      cd /path/to/sublime/packages/directory
      git clone https://github.com/eugenesvk/sublime-xonsh.git
      mv sublime-xonsh xonsh

## Visual Studio Code (VS Code)

There is a xonsh extension for VS Code. To install search “xonsh” using extensions menu or just press `F1` and run without > preceding:

    ext install jnoortheen.xonsh

Since version 1.86 of VS Code, the editor also supports loading the environment for users with xonsh as their default shell.

## JetBrains: IntelliJ IDEA, PyCharm

There is a xonsh-jetbrains plugin for JetBrains products.

## Emacs

### Emacs Xonsh mode

There is an emacs mode for editing xonsh scripts available from the MELPA repository. If you are not familiar see the installation instructions there.

Then just add this line to your emacs configuration file:

    (require 'xonsh-mode)

### Xonsh Comint buffer

You can use xonsh as your interactive shell in Emacs in a Comint buffer. This way you keep all the Emacs editing power in the shell, but you lose xonsh’s completion feature.

Make sure you install xonsh with readline support and in your xonsh RC define

    $SHELL_TYPE = 'readline'

Also, in Emacs set `explicit-shell-file-name` to your xonsh executable.

### Xonsh Ansi-term buffer

The second option is to run xonsh in an Ansi-term buffer inside Emacs. This way you have to switch modes if you want do Emacs-style editing, but you keep xonsh’s impressive completion.

For this it is preferred to have xonsh installed with the prompt-toolkit. Then you can leave `$SHELL_TYPE` at its default.

Emacs will prompt you for the path of the xonsh executable when you start up `ansi-term`.

## Vim

There is xonsh syntax file for vim. To install run:

    git clone --depth 1 https://github.com/linkinpark342/xonsh-vim ~/.vim

## Formatting xonsh code

Xonsh ships a built-in code formatter accessible as the `xonsh format` subcommand. It can be wired into any editor that lets you pipe the current buffer through an external command — point the editor at `xonsh format -` to read the buffer from stdin and replace it with the formatted output.

See Formatting xonsh code for the full set of invocations and flags.