From e82b5e0770315a98ca80080f71febf48cd688b1f Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Fri, 5 Jan 2024 00:31:28 +0800 Subject: [PATCH] feat: emacs - nushell-mode & evil-smartparens --- home/base/desktop/editors/emacs/README.md | 10 ++++++---- home/base/desktop/editors/emacs/default.nix | 9 +++++++-- home/base/desktop/editors/emacs/doom/config.el | 8 ++++++++ home/base/desktop/editors/emacs/doom/init.el | 5 +++-- home/base/desktop/editors/emacs/doom/packages.el | 4 ++++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/home/base/desktop/editors/emacs/README.md b/home/base/desktop/editors/emacs/README.md index 61559337..f8bddd28 100644 --- a/home/base/desktop/editors/emacs/README.md +++ b/home/base/desktop/editors/emacs/README.md @@ -31,10 +31,12 @@ when in doubt, run `doom sync`! ## Structured editing of S-expression data -- [ParEdit](https://www.emacswiki.org/emacs/ParEdit) -- [lispy](https://github.com/doomemacs/doomemacs/tree/master/modules/editor/lispy) -- [parinfer](https://github.com/doomemacs/doomemacs/tree/master/modules/editor/parinfer) -- Formatting: `M-x pp-buffer` +> https://wikemacs.org/wiki/Lisp_editing + +- [lispy](https://github.com/doomemacs/doomemacs/tree/master/modules/editor/lispy): too complex +- [evil-smartparens](https://github.com/expez/evil-smartparens) +- [parinfer](https://github.com/doomemacs/doomemacs/tree/master/modules/editor/parinfer): It helps to keep both indentation and parens balanced and it introduces to more advanced features similar to Paredit + - works not well with some other completion plugins. ## Terminal Related diff --git a/home/base/desktop/editors/emacs/default.nix b/home/base/desktop/editors/emacs/default.nix index fdeab7e7..c73f83f9 100644 --- a/home/base/desktop/editors/emacs/default.nix +++ b/home/base/desktop/editors/emacs/default.nix @@ -31,9 +31,14 @@ in { config = mkIf cfg.enable (mkMerge [ { - home.packages = with pkgs; [ - librime + home.packages = with pkgs; + let + epkgs = emacsPackages; + in + [ emacs-all-the-icons-fonts + epkgs.parinfer-rust-mode + epkgs.rime ## Doom dependencies git diff --git a/home/base/desktop/editors/emacs/doom/config.el b/home/base/desktop/editors/emacs/doom/config.el index 8baa800d..d33f3cbb 100644 --- a/home/base/desktop/editors/emacs/doom/config.el +++ b/home/base/desktop/editors/emacs/doom/config.el @@ -104,6 +104,7 @@ ;; so avoid editing large markdown file in emacs, use neovim instead... (after! markdown-mode (global-font-lock-mode 0)) + ;; use alejandra to format nix files (use-package lsp-nix :ensure lsp-mode @@ -113,3 +114,10 @@ :custom (lsp-nix-nil-formatter ["alejandra"])) +(use-package nushell-mode + :config + (setq nushell-enable-auto-indent 1)) + +;; enable evil-smartparens +(after! smartparens + (add-hook 'smartparens-enabled-hook #'evil-smartparens-mode)) diff --git a/home/base/desktop/editors/emacs/doom/init.el b/home/base/desktop/editors/emacs/doom/init.el index 08b92fd2..c1f98639 100644 --- a/home/base/desktop/editors/emacs/doom/init.el +++ b/home/base/desktop/editors/emacs/doom/init.el @@ -13,6 +13,8 @@ ;; ;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its ;; directory (for easy access to its source code). + + (doom! :input ;;bidi ; (tfel ot) thgir etirw uoy gnipleh chinese ; TODO: use (chinese +rime) @@ -58,10 +60,9 @@ fold ; (nigh) universal code folding (format +onsave) ; automated prettiness - ;;lispy ; vim for lisp, for people who don't like vim multiple-cursors ; editing in many places at once ;;objed ; text object editing for the innocent - ;;parinfer ; turn lisp into python, sort of + ;; parinfer ; turn lisp into python, sort of ;;rotate-text ; cycle region at point between text candidates snippets ; my elves. They type so I don't have to ;;word-wrap ; soft wrapping with language-aware indent diff --git a/home/base/desktop/editors/emacs/doom/packages.el b/home/base/desktop/editors/emacs/doom/packages.el index c90cf2ac..dfc9a779 100644 --- a/home/base/desktop/editors/emacs/doom/packages.el +++ b/home/base/desktop/editors/emacs/doom/packages.el @@ -16,6 +16,10 @@ :recipe (:host github :repo "wakatime/wakatime-mode" :files ("*.el" "dist"))) +(package! nushell-mode :recipe + (:host github :repo "mrkkrp/nushell-mode")) +(package! evil-smartparens) + ;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: ;; (package! some-package)