2022-03-28 15:03:21 +02:00
|
|
|
#+title: :term vterm
|
|
|
|
#+subtitle: As good as terminal emulation gets in Emacs
|
|
|
|
#+created: January 16, 2019
|
|
|
|
#+since: 21.12.0 (#1144)
|
2021-10-16 01:29:04 +02:00
|
|
|
|
|
|
|
* Description :unfold:
|
2019-05-14 22:55:45 -04:00
|
|
|
This module provides a terminal emulator powered by libvterm. It is still in
|
2020-08-24 20:45:07 -07:00
|
|
|
alpha and requires a component be compiled (=vterm-module.so=).
|
2019-05-14 22:55:45 -04:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
#+begin_quote
|
2022-09-26 02:19:42 +08:00
|
|
|
💡 [[doom-package:vterm]] is as good as terminal emulation gets in Emacs (at the time of
|
2021-10-16 01:29:04 +02:00
|
|
|
writing) and the most performant, as it is implemented in C. However, it
|
|
|
|
requires extra steps to set up:
|
|
|
|
|
|
|
|
- Emacs must be built with dynamic modules support,
|
|
|
|
- and =vterm-module.so= must be compiled, which depends on =libvterm=,
|
|
|
|
=cmake=, and =libtool-bin=.
|
|
|
|
|
2022-09-26 02:19:42 +08:00
|
|
|
[[doom-package:vterm]] will try to automatically build =vterm-module.so= when you first open
|
2021-10-16 01:29:04 +02:00
|
|
|
it, but this will fail on Windows, NixOS and Guix out of the box. Install
|
2022-09-26 02:19:42 +08:00
|
|
|
instructions for nix/guix can be found in the [[doom-module::term vterm]] module's
|
2021-10-16 01:29:04 +02:00
|
|
|
documentation. There is no way to install vterm on Windows that I'm aware of
|
|
|
|
(but perhaps with WSL?).
|
|
|
|
#+end_quote
|
|
|
|
|
|
|
|
** Maintainers
|
|
|
|
- [[doom-user:][@hlissner]]
|
|
|
|
|
|
|
|
[[doom-contrib-maintainer:][Become a maintainer?]]
|
2019-05-14 22:55:45 -04:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
** Module flags
|
|
|
|
/This module has no flags./
|
2019-05-14 22:55:45 -04:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
** Packages
|
2022-09-26 02:19:42 +08:00
|
|
|
- [[doom-package:vterm]]
|
2019-05-14 22:55:45 -04:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
** Hacks
|
|
|
|
/No hacks documented for this module./
|
|
|
|
|
|
|
|
** TODO Changelog
|
|
|
|
# This section will be machine generated. Don't edit it by hand.
|
|
|
|
/This module does not have a changelog yet./
|
|
|
|
|
|
|
|
* Installation
|
|
|
|
[[id:01cffea4-3329-45e2-a892-95a384ab2338][Enable this module in your ~doom!~ block.]]
|
2019-05-14 22:55:45 -04:00
|
|
|
|
|
|
|
+ Emacs must be built with dynamic module support, i.e. compiled with the
|
|
|
|
=--with-modules= option.
|
|
|
|
+ You need =libvterm= installed on your system.
|
|
|
|
+ You need =make=, =cmake= and a C compiler such as =gcc= so that vterm can
|
|
|
|
build =vterm-module.so=.
|
|
|
|
|
|
|
|
** Dynamic Module support
|
2021-10-16 01:29:04 +02:00
|
|
|
To check if your build of Emacs was built with dynamic module support, check ~$
|
|
|
|
doom info~ for ~MODULES~ next to "System features". If it's there, you're good
|
|
|
|
to go.
|
2019-05-14 22:55:45 -04:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
You can also check for ~--with-modules~ in the ~system-configuration-options~
|
|
|
|
variable ([[kbd:][SPC h v system-configuration-options]]).
|
2019-05-14 22:55:45 -04:00
|
|
|
|
|
|
|
- Archlinux or Manjaro users who installed Emacs through pacman will have
|
|
|
|
support baked in.
|
|
|
|
- MacOS users:
|
|
|
|
- If you use [[https://emacsformacosx.com/][Emacs For Mac OS X]], this option is enabled.
|
|
|
|
- If you use [[https://github.com/d12frosted/homebrew-emacs-plus][emacs-plus]], this option is enabled by default.
|
|
|
|
- If you use [[https://github.com/railwaycat/homebrew-emacsmacport][emacs-mac]], this options is *not* enabled by default. You may have
|
2021-10-16 01:29:04 +02:00
|
|
|
to reinstall emacs with the option: ~$ brew install emacs-mac
|
|
|
|
--with-modules~.
|
2019-05-14 22:55:45 -04:00
|
|
|
|
|
|
|
** libvterm
|
2021-10-16 01:29:04 +02:00
|
|
|
- Ubuntu or Debian users: ~$ apt-get install libvterm-dev~
|
|
|
|
- ArchLinux or Manjaro: ~$ pacman -S libvterm~
|
|
|
|
- MacOS: ~$ brew install libvterm~
|
|
|
|
- NixOS:
|
2019-07-05 20:09:09 +02:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
#+begin_src nix
|
2019-07-05 20:09:09 +02:00
|
|
|
systemPackages = with pkgs; [
|
|
|
|
# emacs # no need for this, the next line includes emacs
|
2022-01-24 15:15:27 -06:00
|
|
|
((emacsPackagesFor emacs).emacsWithPackages (epkgs: [
|
2021-05-01 15:57:24 +02:00
|
|
|
epkgs.vterm
|
2019-07-05 20:09:09 +02:00
|
|
|
]))
|
|
|
|
];
|
2021-10-16 01:29:04 +02:00
|
|
|
#+end_src
|
2019-07-05 20:09:09 +02:00
|
|
|
|
|
|
|
Or for home-manager users:
|
2021-10-16 01:29:04 +02:00
|
|
|
#+begin_src nix
|
2019-07-05 20:09:09 +02:00
|
|
|
programs.emacs = {
|
|
|
|
enable = true;
|
2021-05-01 15:57:24 +02:00
|
|
|
extraPackages = epkgs: [ epkgs.vterm ];
|
2019-07-05 20:09:09 +02:00
|
|
|
};
|
2021-10-16 01:29:04 +02:00
|
|
|
#+end_src
|
2021-05-01 15:57:24 +02:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
This already contains a version of =vterm-module.so=, so NixOS users need not
|
|
|
|
compile the module themselves as described below.
|
2021-05-01 15:57:24 +02:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
Note: The =nixpkgs=-version used must be compatible with the packages Doom
|
|
|
|
installs, so it might be necessary to pull in =emacs= and/or
|
2022-01-24 15:15:27 -06:00
|
|
|
=emacsPackagesFor= from =unstable= or another channel. Otherwise arbitrary
|
2021-10-16 01:29:04 +02:00
|
|
|
functionality of =vterm= might not work.
|
2019-05-14 22:55:45 -04:00
|
|
|
|
|
|
|
** Compilation tools for vterm-module.so
|
|
|
|
When you first load vterm, it will compile =vterm-module.so= for you. For this
|
|
|
|
to succeed, you need the following:
|
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
- =make=
|
|
|
|
- =cmake=
|
|
|
|
- A C compiler like =gcc=
|
|
|
|
- An internet connection (=cmake= will download needed libraries)
|
2019-05-14 22:55:45 -04:00
|
|
|
|
|
|
|
There are several ways to manually install the module:
|
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
1. You can use ~M-x vterm-module-compile~ to let emacs automatically compile and
|
2019-05-14 22:55:45 -04:00
|
|
|
install the module.
|
|
|
|
|
2020-04-24 02:36:44 -04:00
|
|
|
Modify ~vterm-module-cmake-args~ to pass arguments to the cmake build script.
|
2021-10-16 01:29:04 +02:00
|
|
|
e.g. To use a local build of libvterm instead of the included one:
|
|
|
|
#+begin_src emacs-lisp
|
2020-04-24 02:36:44 -04:00
|
|
|
(setq vterm-module-cmake-args "-DUSE_SYSTEM_LIBVTERM=yes")
|
2021-10-16 01:29:04 +02:00
|
|
|
#+end_src
|
2020-04-24 02:36:44 -04:00
|
|
|
|
2021-10-16 01:29:04 +02:00
|
|
|
#+begin_quote
|
|
|
|
🚧 Emacs will hang during the compilation. It may take a while.
|
|
|
|
#+end_quote
|
2019-05-14 22:55:45 -04:00
|
|
|
|
|
|
|
2. You can compile and install the module yourself. Go to the vterm installation
|
2021-10-16 01:29:04 +02:00
|
|
|
directory (usually =$HOME/.emacs.d/.local/packages/elpa/vterm-<version>=) and
|
|
|
|
run the following:
|
|
|
|
#+begin_src sh
|
2019-05-14 22:55:45 -04:00
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
|
|
|
|
make
|
2021-10-16 01:29:04 +02:00
|
|
|
#+end_src
|
2019-05-14 22:55:45 -04:00
|
|
|
|
2020-08-24 20:45:07 -07:00
|
|
|
3. You can also compile =vterm-module.so= elsewhere, but the module must be
|
2019-05-14 22:55:45 -04:00
|
|
|
moved/symlinked to
|
2021-10-16 01:29:04 +02:00
|
|
|
=$HOME/.emacs.d/.local/packages/elpa/vterm-<version>/vterm-module.so=
|
2019-05-14 22:55:45 -04:00
|
|
|
=vterm-module.so=. Keep in mind that this folder will be deleted whenever the
|
|
|
|
vterm package is updated.
|
2021-10-16 01:29:04 +02:00
|
|
|
|
|
|
|
* TODO Usage
|
|
|
|
#+begin_quote
|
|
|
|
🔨 /This module's usage documentation is incomplete./ [[doom-contrib-module:][Complete it?]]
|
|
|
|
#+end_quote
|
|
|
|
|
|
|
|
The following commands are available to open it:
|
|
|
|
|
|
|
|
- ~+vterm/toggle~ ([[kbd:][<leader> o t]]) -- Toggle vterm pop up window in the current
|
|
|
|
project.
|
|
|
|
- ~+vterm/here~ ([[kbd:][<leader> o T]]) -- Opens vterm in the current window.
|
|
|
|
|
|
|
|
* TODO Configuration
|
|
|
|
#+begin_quote
|
|
|
|
🔨 This module has no configuration documentation yet. [[doom-contrib-module:][Write some?]]
|
|
|
|
#+end_quote
|
|
|
|
|
|
|
|
* Troubleshooting
|
|
|
|
/There are no known problems with this module./ [[doom-report:][Report one?]]
|
|
|
|
|
|
|
|
* Frequently asked questions
|
|
|
|
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]
|
|
|
|
|
|
|
|
* TODO Appendix
|
|
|
|
#+begin_quote
|
|
|
|
🔨 This module has no appendix yet. [[doom-contrib-module:][Write one?]]
|
|
|
|
#+end_quote
|