diff --git a/elisp/options.el b/elisp/options.el index 87995eb..dfb999f 100644 --- a/elisp/options.el +++ b/elisp/options.el @@ -10,7 +10,7 @@ email feeds media - terminal + eshell vterm passwords pinentry desktop roam agenda spelling grammar diff --git a/modules/eshell.org b/modules/eshell.org new file mode 100644 index 0000000..268d7b9 --- /dev/null +++ b/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 diff --git a/modules/terminal.org b/modules/terminal.org deleted file mode 100644 index 49dea13..0000000 --- a/modules/terminal.org +++ /dev/null @@ -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 diff --git a/modules/vterm.org b/modules/vterm.org new file mode 100644 index 0000000..82362e2 --- /dev/null +++ b/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