Integrated Terminal
Onivim features an integrated terminal, with support for modal navigation via 'normal mode'.
:term ++curwin
To open the terminal:
- :termto open a terminal in a horizontal split
- :term ++curwinto open the terminal in the current window
- :term <cmd>to open a terminal running a command other than the default shell
- From the Command Palette Cmd/Ctrl+Shift+P - use the Terminal: Open terminal in new horizontal split command.
Moving between windows
The terminals support the same window movement commands as other windows:
- Move left a window: Ctrl+W, Ctrl+H
- Move right a window: Ctrl+W, Ctrl+L
- Move up a window: Ctrl+W, Ctrl+K
- Move down a window: Ctrl+W, Ctrl+J
To change the current working directory, which will also update the file explorer root, you can use the :cd command - for example: :cd ~/my/project.
Normal Mode
Terminal Normal mode and back
To switch to Terminal Normal mode, use the following command:
- Ctrl+\, Ctrl+N
NOTE: In
Terminal Normalmode, the buffer is read-only.
To switch back to Terminal Insert mode, use any command that would transition
to Insert mode - for example, i.
Configuration
The terminal font can be configured independently from the editor font, via the following settings:
Appearance
- terminal.integrated.fontFamily(string) - The font family used by the editor surface. This must be a monospace font. The font may be specified by either the name of the font, or an absolute path to the font file.
- terminal.integrated.fontSize(int default:- 12) - The font size used by the editor surface.
- terminal.integrated.fontSmoothing("none"|"antialiased"|"subpixel-antialised")__ - The smoothing strategy used when rendering fonts. The- "antialised"setting smooths font edges, and- "subpixel-antialiased"means characters may be positioned fractionally on the pixel grid.
Shell command & arguments
- terminal.integrated.shell.windows(string default:- powershell.exe) - The shell command to run on Windows.
- terminal.integrated.shell.linux(string default:- bash) - The shell command to run on Linux.
- terminal.integrated.shell.osx(string default:- zsh) - The shell command to run on Mac.
- terminal.integrated.shellArgs.windows_(string list default:- []) - Arguments to pass to the Windows shell command.
- terminal.integrated.shellArgs.linux(string list default:- []) - Arguments to pass to the Linux shell command.
- terminal.integrated.shellArgs.osx(string list default:- ["-l"]) - Arguments to pass to the Mac shell command. Note that on macOS by default, each shell should be a login shell, as- ~/.bash_profile(or equivalents) are not loaded at login and should instead be loaded by each shell. See more at http://unix.stackexchange.com/a/119675/115410.
The default shell and command will be used when running a terminal via :term, but can be overrided by passing a command to :term.
Environment
Some special environment variables are set for the embedded terminal:
- ONIVIM_TERMINAL- set to the current version of the editor. This is guaranteed to be non-empty, so can be used in initialization scripts to determine if the current environment is an embedded Onivim terminal.
