py-vterm-interaction.el/README.org

3.9 KiB

julia-vterm

Julia-vterm provides a major-mode for inferior Julia process that runs in vterm, and a minor-mode that extends julia-mode with the ability to interact with the inferior Julia process.

Should I use this?

There's julia-repl. But it had a display performance issue due to the limited performance of its backend terminal emulator, term.el. That's the reason why I made julia-vterm. Actually, julia-repl seems to have added support for vterm in January 2021, so I think one doesn't need to choose julia-vterm for display performance now.

Another possible reason might be Org Babel support by ob-julia-vterm. It is still under development but you might be interested.

Currently, julia-vterm offers minimum functionalities for basic interaction with the REPL. A few more functions may be added in the future, but you may want to check julia-repl if you need more features. If the simplicity of this package fits your preference, please give it a try!

Installation

Just install it from MELPA. The package name is julia-vterm.

Then, evaluate the following add-hook line to turn on julia-vterm-mode in newly opened julia-mode buffers. A symbol "⁂" in the mode line indicates that the julia-mode buffer is ready to interact with the vterm-powered Julia REPL. Add this line to your init file to enable julia-vterm-mode in future sessions.

(add-hook 'julia-mode-hook #'julia-vterm-mode)

You can install the package manually if necessary. First make sure julia-mode and emacs-libvterm are installed and working properly. Download julia-vterm.el into somewhere in your local directory and install it with the following. You also need to configure the hook described above.

(package-install-file "/path/to/julia-vterm.el")

By default, the command named julia in your PATH is used. If you want to specify a different location, add the directory to the PATH environment variable or set the julia-vterm-repl-program variable to the absolute path to the command. You can also pass parameters to the command by the variable. For example, you can use julia command in a certain path, with 4 threads enabled, by the line like the following.

(setq julia-vterm-repl-program "/path/to/julia -t 4")

How to use

In a julia script buffer with julia-vterm-mode on, you can open an inferior Julia REPL buffer with M-x julia-vterm-switch-to-repl-buffer (or C-c C-z).

Key bindings

julia-mode with julia-vterm-mode enabled

Key Binding
C-c C-z julia-vterm-switch-to-repl-buffer
C-<return> julia-vterm-send-region-or-current-line
C-c C-b julia-vterm-send-buffer
C-c C-i julia-vterm-send-include-buffer-file
C-c C-d julia-vterm-send-cd-to-buffer-directory

julia-vterm-repl-mode

Key Binding
C-c C-z julia-vterm-repl-switch-to-script-buffer
M-k julia-vterm-repl-clear-buffer
C-c C-t julia-vterm-repl-copy-mode

julia-vterm-repl-mode (copy mode)

Key Binding
C-c C-t julia-vterm-repl-copy-mode
<return> julia-vterm-repl-copy-mode-done
C-c C-r vterm-reset-cursor-point