From 72bd225ca21d1db612481befc4aff801fbd99350 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 6 Jan 2024 19:38:56 +0800 Subject: [PATCH] feat: emacs - GUI mode by default, increase font size --- Justfile | 3 ++- home/base/desktop/editors/emacs/README.md | 12 ++++++++--- home/base/desktop/editors/emacs/default.nix | 7 ++++--- .../base/desktop/editors/emacs/doom/config.el | 20 +++++++++---------- 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/Justfile b/Justfile index 24c745d7..2e0d913e 100644 --- a/Justfile +++ b/Justfile @@ -183,8 +183,8 @@ reload-emacs-cmd := if os() == "macos" { emacs-test: rm -rf $"($env.HOME)/.config/doom" rsync -avz --copy-links --chmod=D2755,F744 home/base/desktop/editors/emacs/doom/ $"($env.HOME)/.config/doom" - doom sync doom clean + doom sync emacs-clean: rm -rf $"($env.HOME)/.config/doom/" @@ -195,4 +195,5 @@ emacs-purge: doom sync emacs-reload: + doom sync {{reload-emacs-cmd}} diff --git a/home/base/desktop/editors/emacs/README.md b/home/base/desktop/editors/emacs/README.md index dee9842a..de039ae1 100644 --- a/home/base/desktop/editors/emacs/README.md +++ b/home/base/desktop/editors/emacs/README.md @@ -36,13 +36,15 @@ when in doubt, run `doom sync`! Here is the cheetsheet related to my DoomEmacs configs. Please read vim's common cheetsheet at [../README.md](../README.md) before reading the following. -### Terminal Related +### Basics + +> Terminal(vterm) is useful in GUI mode, I use Zellij instead in terminal mode. | Action | Shortcut | | ---------------------- | ------------- | -| Open file tree sidebar | `SPC + o + p` | -| Popup Terminal | `SPC + o + t` | +| Popup Terminal(vterm) | `SPC + o + t` | | Open Terminal | `SPC + o + T` | +| Open file tree sidebar | `SPC + o + p` | | Exit | `M-x C-c` | ### Window Navigation @@ -109,6 +111,10 @@ And bookmarks: | Find files by keyword in path | ` + ` | | Grep string in files (vertico + ripgrep) | ` + sd` | +### Image Preview(GUI mode only) + +Use `-`, `+` to resize the image, `r` to rotate the image. + ### Search & replace ```bash diff --git a/home/base/desktop/editors/emacs/default.nix b/home/base/desktop/editors/emacs/default.nix index ad6a8e26..a172aa75 100644 --- a/home/base/desktop/editors/emacs/default.nix +++ b/home/base/desktop/editors/emacs/default.nix @@ -19,7 +19,8 @@ with lib; let export PATH="${config.xdg.configHome}/emacs/bin:$PATH" ''; shellAliases = { - e = "emacsclient --create-frame --tty"; + e = "emacsclient --create-frame"; # gui + et = "emacsclient --create-frame --tty"; # termimal }; librime-dir = "${config.xdg.dataHome}/librime"; parinfer-rust-lib-dir = "${config.xdg.dataHome}/parinfer-rust"; @@ -82,7 +83,7 @@ in { # Do not use emacs-nox here, which makes the mouse wheel work abnormally in terminal mode. # pgtk (pure gtk) build add native support for wayland. # https://www.gnu.org/savannah-checkouts/gnu/emacs/emacs.html#Releases - emacsPkg = pkgs.emacs29-pgtk; + emacsPkg = (pkgs.emacsPackagesFor pkgs.emacs29-pgtk).emacsWithPackages (epkgs: [epkgs.vterm]); in { home.packages = [emacsPkg]; services.emacs = { @@ -97,7 +98,7 @@ in { let # macport adds some native features based on GNU Emacs 29 # https://bitbucket.org/mituharu/emacs-mac/src/master/README-mac - emacsPkg = pkgs.emacs29-macport; + emacsPkg = (pkgs.emacsPackagesFor pkgs.emacs29-macport).emacsWithPackages (epkgs: [epkgs.vterm]); in { home.packages = [emacsPkg]; launchd.enable = true; diff --git a/home/base/desktop/editors/emacs/doom/config.el b/home/base/desktop/editors/emacs/doom/config.el index 05025aa1..68614271 100644 --- a/home/base/desktop/editors/emacs/doom/config.el +++ b/home/base/desktop/editors/emacs/doom/config.el @@ -21,10 +21,10 @@ ;; See 'C-h v doom-font' for documentation and more examples of what they ;; accept. For example: ;; -(setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 15 :weight 'light) - doom-variable-pitch-font (font-spec :family "DejaVu Sans" :size 16) +(setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 17 :weight 'light) + doom-variable-pitch-font (font-spec :family "DejaVu Sans" :size 18) doom-symbol-font (font-spec :family "JuliaMono") - doom-big-font (font-spec :family "JetBrainsMono Nerd Font" :size 26)) + doom-big-font (font-spec :family "JetBrainsMono Nerd Font" :size 28)) ;; ;; If you or Emacs can't find your font, use 'M-x describe-font' to look them ;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to @@ -76,13 +76,13 @@ ;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how ;; they are implemented. -(use-package! nerd-icons - ;; :custom - ;; The Nerd Font you want to use in GUI - ;; "Symbols Nerd Font Mono" is the default and is recommended - ;; but you can use any other Nerd Font if you want - ;; (nerd-icons-font-family "Symbols Nerd Font Mono") - ) +(use-package! nerd-icons) +;; :custom +;; The Nerd Font you want to use in GUI +;; "Symbols Nerd Font Mono" is the default and is recommended +;; but you can use any other Nerd Font if you want +;; (nerd-icons-font-family "Symbols Nerd Font Mono") + (use-package! lsp-bridge :config