From e7588b30b1546bdc2491ed2ee8fbdbb94fa89211 Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Thu, 18 Mar 2021 14:15:12 -0400 Subject: [PATCH] Split terminal from editor --- README.org | 1 + init.el | 1 + modules/editor.org | 41 ++++++------------------- modules/terminal.org | 72 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 modules/terminal.org diff --git a/README.org b/README.org index add57cb..d7d62ae 100644 --- a/README.org +++ b/README.org @@ -71,6 +71,7 @@ Here's a complete list of all of the options configurable for each host, and the editor shell email + terminal encryption desktop writing diff --git a/init.el b/init.el index 31e082f..7562771 100644 --- a/init.el +++ b/init.el @@ -23,6 +23,7 @@ editor shell email + terminal encryption desktop writing diff --git a/modules/editor.org b/modules/editor.org index 7b67cdb..39ad693 100644 --- a/modules/editor.org +++ b/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 [[../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 (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)) #+end_src -Place keybindings for *magit*[fn:17] behind =SPC g=. +Place keybindings for *magit*[fn:13] behind =SPC g=. + Clone with =c= + Status with =g= @@ -233,7 +233,7 @@ Place keybindings for *magit*[fn:17] behind =SPC g=. ** 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~ @@ -244,37 +244,17 @@ Interact with *Git*[fn:19] forges from *Magit*[fn:17] and Emacs using *Forge*[fn ** 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 (dotfiles/symlink "~/.emacs.d/config/git" "~/.gitconfig") #+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 -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 @@ -315,10 +295,7 @@ sudo apt install -y cmake \ [fn:10] https://github.com/abo-abo/hydra [fn:11] https://en.wikipedia.org/wiki/Dired [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 diff --git a/modules/terminal.org b/modules/terminal.org new file mode 100644 index 0000000..e26ef76 --- /dev/null +++ b/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