by Ingo Karkat
When you use a single (G)Vim instance in an IDE-like fashion for multiple projects, the 'autochdir' option simplifies file operations as you jump around the various projects. When it's time to run tests or commit changes, you'll often want a terminal opened in the current project's root directory.
This plugin provides commands to open a terminal (in a :terminal buffer or externally) in the repository root of the current buffer.
SEE ALSO *
(Alternatives from other authors, other approaches, references not used here.)
:RootTerminal Open a new :terminal window in the repository root
of the current buffer. If 'autochdir' is enabled and
the autolcd.vim plugin is installed, the terminal
window's working directory is pinned to the repository
root.
:RootGuiTerminal Open an external terminal emulator in the repository
root of the current buffer.
The code is hosted in a Git repo at https://github.com/inkarkat/vim-RootTerminal You can use your favorite plugin manager, or "git clone" into a directory used for Vim packages. Releases are on the "stable" branch, the latest unstable development snapshot on "master".
This script is also packaged as a vimball. If you have the "gunzip" decompressor in your PATH, simply edit the *.vmb.gz package in Vim; otherwise, decompress the archive first, e.g. using WinZip. Inside Vim, install by sourcing the vimball or via the :UseVimball command.
vim RootTerminal*.vmb.gz
:so %
To uninstall, use the :RmVimball command.
- Requires Vim 7.0 or higher.
- Requires the ingo-library.vim plugin (vimscript #4433), version 1.045 or higher.
- Requires the VcsRoot.vim plugin (unreleased), version 1.00 or higher.
- autolcd.vim plugin (unreleased), version 0.01 or higher (optional).
For a permanent configuration, put the following commands into your vimrc:
You can modify the environment in which the :terminal is opened via a Dict of environment variables (keys are names, values are values); use v:null (or for backwards compatibility an empty List ([])) to remove an environment variable:
let g:RootTerminal_TerminalEnvironment = {'delete_me': [], 'added': 'val'}
The shell command that launches the terminal emulator can be tweaked via:
let g:RootTerminal_GuiTerminalCommand = 'gnome-terminal'
If you don't want the :RootGuiTerminal command, set the value to an empty string:
let g:RootTerminal_GuiTerminalCommand = ''
Report any bugs, send patches, or suggest features via the issue tracker at https://github.com/inkarkat/vim-RootTerminal/issues or email (address below).
First published version.
- Started development.
Copyright: (C) 2021-2026 Ingo Karkat - The VIM LICENSE applies to this plugin.
Maintainer: Ingo Karkat <ingo@karkat.de>