Browse Source

Split terminal from editor

main
parent
commit
e7588b30b1
  1. 1
      README.org
  2. 1
      init.el
  3. 41
      modules/editor.org
  4. 72
      modules/terminal.org

1
README.org

@ -71,6 +71,7 @@ Here's a complete list of all of the options configurable for each host, and the
editor editor
shell shell
email email
terminal
encryption encryption
desktop desktop
writing writing

1
init.el

@ -23,6 +23,7 @@
editor editor
shell shell
email email
terminal
encryption encryption
desktop desktop
writing writing

41
modules/editor.org

@ -210,7 +210,7 @@ By default *Dired*[fn:11] will create a new buffer every time you press =RET= ov
#+ATTR_LATEX: :width 420px #+ATTR_LATEX: :width 420px
[[../docs/images/2021-02-13-example-magit.gif]] [[../docs/images/2021-02-13-example-magit.gif]]
Yet another hallmark feature of Emacs: *Magit*[fn:17] with the *darling* name, the developer stresses it's supposed to be *Magic* but with *Git*[fn:19]. It's a complete *Git*[fn:19] porcelain within Emacs.
Yet another hallmark feature of Emacs: *Magit*[fn:13] with the *darling* name, the developer stresses it's supposed to be *Magic* but with *Git*[fn:14]. It's a complete *Git*[fn:14] porcelain within Emacs.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package magit (use-package magit
@ -219,7 +219,7 @@ Yet another hallmark feature of Emacs: *Magit*[fn:17] with the *darling* name, t
#'magit-display-buffer-same-window-except-diff-v1)) #'magit-display-buffer-same-window-except-diff-v1))
#+end_src #+end_src
Place keybindings for *magit*[fn:17] behind =SPC g=.
Place keybindings for *magit*[fn:13] behind =SPC g=.
+ Clone with =c= + Clone with =c=
+ Status with =g= + Status with =g=
@ -233,7 +233,7 @@ Place keybindings for *magit*[fn:17] behind =SPC g=.
** GitHub integration ** GitHub integration
Interact with *Git*[fn:19] forges from *Magit*[fn:17] and Emacs using *Forge*[fn:18], requiring only a *GitHub*[fn:20] token to get started. If you're not sure what *GitHub*[fn:20] is, it's to *Git*[fn:19] what *Porn* is to *PornHub*. No citations!
Interact with *Git*[fn:14] forges from *Magit*[fn:13] and Emacs using *Forge*[fn:15], requiring only a *GitHub*[fn:16] token to get started. If you're not sure what *GitHub*[fn:16] is, it's to *Git*[fn:14] what *Porn* is to *PornHub*. No citations!
+ Requires a valid ~$GITHUB_TOKEN~ + Requires a valid ~$GITHUB_TOKEN~
@ -244,37 +244,17 @@ Interact with *Git*[fn:19] forges from *Magit*[fn:17] and Emacs using *Forge*[fn
** Deploying the global config ** Deploying the global config
*Git*[fn:19] reads its global config from ~$HOME/.gitconfig~, create a link to the custom configuration.
*Git*[fn:14] reads its global config from ~$HOME/.gitconfig~, create a link to the custom configuration.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(dotfiles/symlink "~/.emacs.d/config/git" (dotfiles/symlink "~/.emacs.d/config/git"
"~/.gitconfig") "~/.gitconfig")
#+end_src #+end_src
* Terminal emulation
Performing terminal interaction within an editor is a must have, the choices are *Eshell*[fn:15] and *Vterm*[fn:21].
** Emacs lisp shell
Another really incredible piece of kit, shipped with Emacs. *Eshell*[fn:15] is a fully POSIX compliant shell written entirely in Emacs Lisp. While not a traditional terminal emulator, it provides me with all of the functionality I expect and require from one. The infamous lambda prompt implemented with the *Eshell Prompt Extras*[fn:16] package.
#+begin_src emacs-lisp
(use-package eshell-prompt-extras
:custom (eshell-highlight-prompt nil)
(eshell-prefer-lisp-functions nil)
(eshell-prompt-function 'epe-theme-lambda))
#+end_src
+ Open an =eshell= buffer with =SPC e=
#+begin_src emacs-lisp
(dotfiles/leader
"e" '(eshell :which-key "Shell"))
#+end_src
** Interactive terminal ** Interactive terminal
Sometimes *Eshell*[fn:15] just isn't enough. Going through [[file:../docs/notes/thinking-in-cpp.org.gpg][Thinking in C++]] for one of my courses requires lots of terminal input which *Eshell*[fn:15] just doesn't handle. Prior to this I was dropping to another *TTY* interface, but that was cumbersome. *Vterm's*[fn:21] based on an external C library which is blazing fast.
Sometimes *Eshell*[fn:17] just isn't enough. Going through [[file:../docs/notes/thinking-in-cpp.org.gpg][Thinking in C++]] for one of my courses requires lots of terminal input which *Eshell*[fn:17] just doesn't handle. Prior to this I was dropping to another *TTY* interface, but that was cumbersome. *Vterm's*[fn:18] based on an external C library which is blazing fast.
+ Always compile the module + Always compile the module
@ -315,10 +295,7 @@ sudo apt install -y cmake \
[fn:10] https://github.com/abo-abo/hydra [fn:10] https://github.com/abo-abo/hydra
[fn:11] https://en.wikipedia.org/wiki/Dired [fn:11] https://en.wikipedia.org/wiki/Dired
[fn:12] https://github.com/crocket/dired-single [fn:12] https://github.com/crocket/dired-single
[fn:15] https://gnu.org/software/emacs/manual/html_node/eshell/index.html
[fn:16] https://github.com/zwild/eshell-prompt-extras
[fn:17] https://github.com/magit/magit
[fn:18] https://github.com/magit/forge
[fn:19] https://git-scm.com
[fn:20] https://github.com
[fn:21] https://github.com/akermu/emacs-libvterm
[fn:13] https://github.com/magit/magit
[fn:15] https://github.com/magit/forge
[fn:14] https://git-scm.com
[fn:16] https://github.com

72
modules/terminal.org

@ -0,0 +1,72 @@
#+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 [[file:../docs/notes/thinking-in-cpp.org.gpg][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=
#+begin_src emacs-lisp
(use-package vterm
:commands (vterm)
:custom (vterm-always-compile-module t)
:config (dotfiles/leader "v" '(vterm :which-key "Terminal")))
#+end_src
** Requirements
Install the required packages on *Debian/Ubuntu* based systems.
#+begin_src shell
sudo apt install -y cmake \
libtool \
libtool-bin
#+end_src
* Resources
[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
Loading…
Cancel
Save