Browse Source

terminal -> (eshell, vterm)

main
parent
commit
b4daf4e059
  1. 2
      elisp/options.el
  2. 45
      modules/eshell.org
  3. 64
      modules/terminal.org
  4. 35
      modules/vterm.org

2
elisp/options.el

@ -10,7 +10,7 @@
email email
feeds feeds
media media
terminal
eshell vterm
passwords pinentry passwords pinentry
desktop desktop
roam agenda spelling grammar roam agenda spelling grammar

45
modules/eshell.org

@ -0,0 +1,45 @@
#+TITLE: EShell
#+AUTHOR: Christopher James Hayward
#+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :tangle terminal.el :comments org
#+PROPERTY: header-args :results silent :eval no-export :comments org
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
EShell is a fully POSIX compliant shell written entirely in Emacs Lisp, included with Emacs.
* Config
While not a traditional terminal emulator, it provides a native REPL for Emacs Lisp code, with everything in your configuration available in the environment. Make some slight configurations:
+ Don't highlight the prompt
+ Favour use of system utilities
#+begin_src emacs-lisp
(setq eshell-highlight-prompt nil
eshell-prefer-lisp-functions nil)
#+end_src
* Extras
Implement the lambda prompt for aesthetic purposes with the ~eshell-prompt-extras~ package. Here's an example of what that looks like:
#+begin_example
~/.emacs.d/modules:main*? λ
#+end_example
#+begin_src emacs-lisp
(use-package eshell-prompt-extras
:custom (eshell-prompt-function 'epe-theme-lambda))
#+end_src
* Shortcuts
Open ~eshell~ in the current buffer with =SPC e=:
#+begin_src emacs-lisp
(dotfiles/leader
"e" '(eshell :which-key "EShell"))
#+end_src

64
modules/terminal.org

@ -1,64 +0,0 @@
#+TITLE: Terminal
#+AUTHOR: Christopher James Hayward
#+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :tangle terminal.el :comments org
#+PROPERTY: header-args :results silent :eval no-export :comments org
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
Performing terminal interactions is a must-have for any modern editor. This module introduces *two* means of doing so with [[https://gnu.org/software/emacs/manual/html_node/eshell/index.html][EShell]][fn:1] and [[https://github.com/akermu/emacs-libvterm][VTerm]][fn:2].
* Emacs Lisp shell
*EShell*[fn:1] is a fully *POSIX* compliant shell written entirely in Emacs Lisp. While not a traditional terminal emulator, it provides a native REPL for Emacs Lisp code with everything available in the environment.
+ Don't highlight the prompt
+ Favour use of system utilities
+ Open in the current buffer with =SPC e=
#+begin_src emacs-lisp
(setq eshell-highlight-prompt nil
eshell-prefer-lisp-functions nil)
(dotfiles/leader "e" '(eshell :which-key "Shell"))
#+end_src
** Prompt extras
Implement the lambda prompt for aesthetic purposes with the [[https://github.com/zwild/eshell-prompt-extras][EShell Prompt Extras]][fn:3] package.
#+begin_src emacs-lisp
(use-package eshell-prompt-extras
:custom (eshell-prompt-function 'epe-theme-lambda))
#+end_src
Here's an example of what that looks like:
#+begin_example
~/.emacs.d/modules:main*? λ
#+end_example
* Interactive Terminal
*EShell*[fn:1] isn't enough when needing interactivity from the terminal. Going through [[https://chrishayward.xyz/notes/thinking-in-cpp/][Thinking in C++]] for one of my courses required lots of terminal interaction which *Eshell*[fn:1] was unable to handle. *VTerm's*[fn:2] based on an external C library which is blazing fast, and fully interactive.
+ Always compile the module
+ Open in the current buffer with =SPC v=
+ Install the required packages on *Debian/Ubuntu*
#+begin_src emacs-lisp
(use-package vterm
:commands (vterm)
:custom (vterm-always-compile-module t)
:config (dotfiles/leader "v" '(vterm-other-window :which-key "Terminal")))
#+end_src
* Footnotes
[fn:1] https://gnu.org/software/emacs/manual/html_node/eshell/index.html
[fn:2] https://github.com/akermu/emacs-libvterm
[fn:3] https://github.com/zwild/eshell-prompt-extras

35
modules/vterm.org

@ -0,0 +1,35 @@
#+TITLE: VTerm
#+AUTHOR: Christopher James Hayward
#+EMAIL: chris@chrishayward.xyz
#+PROPERTY: header-args:emacs-lisp :tangle vterm.el :comments org
#+PROPERTY: header-args :results silent :eval no-export :comments org
#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
VTerm is an implementation of libvterm for Emacs.
* Interactive Terminal
I noticed ~eshell~ wasn't enough when needing interactivity from the terminal. Going through [[https://chrishayward.xyz/notes/thinking-in-cpp/][Thinking in C++]] for one of my courses required lots of terminal interaction which ~eshell~ was unable to handle. Since ~vterm~ is based on ~libvterm~, an external C library, it's blazing fast and fully interactive. Add a few configurations:
+ Always compile the module
+ Install the required packages on *Debian/Ubuntu*
#+begin_src emacs-lisp
(use-package vterm
:commands (vterm)
:custom (vterm-always-compile-module t))
#+end_src
* Shortcuts
Open a new ~vterm~ buffer with =SPC v=:
#+begin_src emacs-lisp
(dotfiles/leader
"v" '(vterm-other-window :which-key "VTerm"))
#+end_src
* Footnotes
Loading…
Cancel
Save