feat: emacs - replace smartparens with parinfer

feat: emacs - add emacs-rime
This commit is contained in:
Ryan Yin
2024-01-05 18:37:51 +08:00
parent 3f7c023251
commit d5ef998239
8 changed files with 120 additions and 96 deletions
+46 -31
View File
@@ -74,28 +74,7 @@
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
;; accept completion from copilot and fallback to company
(use-package! copilot
:hook
(prog-mode . copilot-mode)
:bind
(:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word))
:config
(copilot-mode +1))
(use-package super-save
:ensure t
:config
(super-save-mode +1))
(after! super-save
(setq super-save-auto-save-when-idle t)
(setq super-save-all-buffers t)
(setq super-save-delete-trailing-whitespace t))
(use-package wakatime-mode
:ensure t)
(use-package! wakatime-mode :ensure t)
;; fully enable tree-sitter highlighting
(after! tree-sitter
(setq +tree-sitter-hl-enabled-modes t))
@@ -106,7 +85,7 @@
(global-font-lock-mode 0))
;; use alejandra to format nix files
(use-package lsp-nix
(use-package! lsp-nix
:ensure lsp-mode
:after
(lsp-mode)
@@ -114,14 +93,50 @@
:custom
(lsp-nix-nil-formatter
["alejandra"]))
(use-package nushell-mode
(use-package! nushell-mode
:config
(setq nushell-enable-auto-indent 1))
;; https://github.com/doomemacs/doomemacs/issues/4374
(use-package! smartparens
:init (add-hook 'smartparens-enabled-hook #'evil-smartparens-mode)
:hook ((clojure-mode . smartparens-strict-mode)
(scheme-mode . smartparens-strict-mode)
(lisp-mode . smartparens-strict-mode)
(emacs-lisp-mode . smartparens-strict-mode)))
;; emacs-rime
(use-package! rime
:custom
(default-input-method "rime")
(rime-librime-root "~/.local/share/librime"))
;; use parinfer for lisp editing
(use-package! parinfer-rust-mode
:hook ((emacs-lisp-mode
clojure-mode
scheme-mode
lisp-mode
racket-mode
fennel-mode
hy-mode) . parinfer-rust-mode)
:init
;; parinfer-rust library do not provide a apple silicon binary.
;; fix: https://github.com/doomemacs/doomemacs/issues/6163
(setq parinfer-rust-auto-download 0)
;; we need to download it manually and put it in this path
(setq parinfer-rust-library "~/.local/share/parinfer-rust/parinfer-rust.so")
:config
(map! :map parinfer-rust-mode-map
:localleader
"p" #'parinfer-rust-switch-mode
"P" #'parinfer-rust-toggle-disable))
;; disable smatparens-mode here to void conflict with parinfer
;; https://discourse.doomemacs.org/t/disable-smartparens-or-parenthesis-completion/134
(add-hook 'clojure-mode-hook #'turn-off-smartparens-mode)
(add-hook 'scheme-mode-hook #'turn-off-smartparens-mode)
(add-hook 'lisp-mode-hook #'turn-off-smartparens-mode)
(add-hook 'racket-mode-hook #'turn-off-smartparens-mode)
(add-hook 'fennel-mode-hook #'turn-off-smartparens-mode)
(add-hook 'hy-mode-hook #'turn-off-smartparens-mode)
+3 -3
View File
@@ -17,7 +17,7 @@
(doom! :input
;;bidi ; (tfel ot) thgir etirw uoy gnipleh
chinese ; TODO: use (chinese +rime)
chinese
;;japanese
;;layout ; auie,ctsrnm is the superior home row
@@ -61,8 +61,8 @@
(format +onsave)
; automated prettiness
;; multiple-cursors ; editing in many places at once
objed ; text object editing for the innocent
;; parinfer ; turn lisp into python, sort of
;; objed ; text object editing for the innocent
parinfer ; turn lisp into python, sort of, conflict with copilot/objed/smartparens
;;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
@@ -4,21 +4,15 @@
;; To install a package with Doom you must declare them here and run 'doom sync'
;; on the command line, then restart Emacs for the changes to take effect -- or
;; use 'M-x doom/reload'.
(package! copilot
:recipe
(:host github :repo "copilot-emacs/copilot.el" :files
("*.el" "dist")))
(package! super-save
:recipe
(:host github :repo "bbatsov/super-save" :files
("*.el" "dist")))
(package! wakatime-mode
:recipe
(:host github :repo "wakatime/wakatime-mode" :files
("*.el" "dist")))
(package! nushell-mode :recipe
(:host github :repo "mrkkrp/nushell-mode"))
(package! evil-smartparens)
(package! rime)
;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror:
;; (package! some-package)