.
This commit is contained in:
parent
b40402889e
commit
afb348f363
1 changed files with 101 additions and 76 deletions
173
emacs/init.el
173
emacs/init.el
|
@ -481,6 +481,17 @@ Point must be at the beginning of balanced expression (sexp)."
|
||||||
(transpose-sexps 1)
|
(transpose-sexps 1)
|
||||||
(forward-sexp -1))
|
(forward-sexp -1))
|
||||||
|
|
||||||
|
(defvar last-sexp nil)
|
||||||
|
|
||||||
|
(defun cc/clone-sexp ()
|
||||||
|
"Clone the sexp right after the cursor."
|
||||||
|
(interactive)
|
||||||
|
(call-interactively #'mark-sexp)
|
||||||
|
(call-interactively #'kill-ring-save)
|
||||||
|
(call-interactively #'evil-paste-before)
|
||||||
|
(call-interactively #'forward-char)
|
||||||
|
(call-interactively #'paredit-newline))
|
||||||
|
|
||||||
(defun looking-at-opening-paren ()
|
(defun looking-at-opening-paren ()
|
||||||
(looking-at (rx (or "(" "{" "["))))
|
(looking-at (rx (or "(" "{" "["))))
|
||||||
|
|
||||||
|
@ -488,61 +499,77 @@ Point must be at the beginning of balanced expression (sexp)."
|
||||||
(looking-back (rx (or ")" "}" "]"))))
|
(looking-back (rx (or ")" "}" "]"))))
|
||||||
|
|
||||||
;;;;; Basic
|
;;;;; Basic
|
||||||
(use-package smartparens
|
(use-package paredit
|
||||||
:delight (smartparens-mode " ")
|
|
||||||
:hook
|
:hook
|
||||||
(smartparens-mode . show-smartparens-mode)
|
clojure-mode
|
||||||
(smartparens-mode . smartparens-strict-mode)
|
|
||||||
clojure-ts-mode
|
|
||||||
emacs-lisp-mode
|
emacs-lisp-mode
|
||||||
scheme-mode
|
scheme-mode
|
||||||
:custom
|
|
||||||
(sp-undo-pairs-separately t)
|
|
||||||
:config
|
:config
|
||||||
(add-to-list 'sp-clojure-modes 'clojure-ts-mode)
|
(evil-define-key 'insert paredit-mode-map
|
||||||
(add-to-list 'sp-clojure-modes 'clojurec-ts-mode)
|
|
||||||
(add-to-list 'sp-clojure-modes 'clojurescript-ts-mode)
|
|
||||||
(add-to-list 'sp-lisp-modes 'clojure-ts-mode)
|
|
||||||
(add-to-list 'sp-lisp-modes 'clojurec-ts-mode)
|
|
||||||
(add-to-list 'sp-lisp-modes 'clojurescript-ts-mode)
|
|
||||||
;; TODO: Remove the following three lines once merge request got accepted
|
|
||||||
(load-file (concat init-dir "lib/smartparens-clojure.el"))
|
|
||||||
(load-file (concat init-dir "lib/smartparens-emacs-lisp.el"))
|
|
||||||
(load-file (concat init-dir "lib/smartparens-scheme.el"))
|
|
||||||
(require 'smartparens-clojure)
|
|
||||||
(require 'smartparens-emacs-lisp)
|
|
||||||
(require 'smartparens-scheme)
|
|
||||||
(evil-define-key 'insert smartparens-mode-map
|
|
||||||
(kbd "r") (conditional-keybind #'looking-at-opening-paren
|
(kbd "r") (conditional-keybind #'looking-at-opening-paren
|
||||||
#'sp-raise-sexp)
|
#'paredit-raise-sexp)
|
||||||
(kbd "w") (conditional-keybind #'looking-at-opening-paren
|
(kbd "w") (conditional-keybind #'looking-at-opening-paren
|
||||||
#'cc/move-sexp-backward)
|
#'cc/move-sexp-backward)
|
||||||
(kbd "s") (conditional-keybind #'looking-at-opening-paren
|
(kbd "s") (conditional-keybind #'looking-at-opening-paren
|
||||||
#'cc/move-sexp-forward)
|
#'cc/move-sexp-forward)
|
||||||
(kbd "c") (conditional-keybind #'looking-at-opening-paren
|
(kbd "c") (conditional-keybind #'looking-at-opening-paren
|
||||||
#'sp-clone-sexp)
|
#'cc/clone-sexp)))
|
||||||
(kbd "m") (conditional-keybind #'looking-at-opening-paren
|
|
||||||
#'sp-mark-sexp)
|
|
||||||
(kbd "DEL") (conditional-keybind #'being-past-closing-paren
|
|
||||||
#'sp-backward-delete-sexp
|
|
||||||
#'evil-delete-backward-char-and-join)
|
|
||||||
(kbd ">") (conditional-keybind #'being-past-closing-paren
|
|
||||||
(lambda (prefix)
|
|
||||||
(interactive "P")
|
|
||||||
(call-interactively #'backward-char)
|
|
||||||
(call-interactively #'sp-forward-slurp-sexp)
|
|
||||||
(call-interactively #'sp-forward-sexp)
|
|
||||||
(call-interactively #'forward-char)))
|
|
||||||
(kbd "<") (conditional-keybind #'being-past-closing-paren
|
|
||||||
(lambda (prefix)
|
|
||||||
(interactive "P")
|
|
||||||
(call-interactively #'backward-char)
|
|
||||||
(call-interactively #'sp-forward-barf-sexp)
|
|
||||||
(call-interactively #'forward-char)))))
|
|
||||||
|
|
||||||
(use-package evil-cleverparens
|
;; (use-package smartparens
|
||||||
:after smartparens
|
;; :delight (smartparens-mode " ")
|
||||||
:hook smartparens)
|
;; :hook
|
||||||
|
;; (smartparens-mode . show-smartparens-mode)
|
||||||
|
;; (smartparens-mode . smartparens-strict-mode)
|
||||||
|
;; clojure-ts-mode
|
||||||
|
;; emacs-lisp-mode
|
||||||
|
;; scheme-mode
|
||||||
|
;; :custom
|
||||||
|
;; (sp-undo-pairs-separately t)
|
||||||
|
;; :config
|
||||||
|
;; (add-to-list 'sp-clojure-modes 'clojure-ts-mode)
|
||||||
|
;; (add-to-list 'sp-clojure-modes 'clojurec-ts-mode)
|
||||||
|
;; (add-to-list 'sp-clojure-modes 'clojurescript-ts-mode)
|
||||||
|
;; (add-to-list 'sp-lisp-modes 'clojure-ts-mode)
|
||||||
|
;; (add-to-list 'sp-lisp-modes 'clojurec-ts-mode)
|
||||||
|
;; (add-to-list 'sp-lisp-modes 'clojurescript-ts-mode)
|
||||||
|
;; ;; TODO: Remove the following three lines once merge request got accepted
|
||||||
|
;; (load-file (concat init-dir "lib/smartparens-clojure.el"))
|
||||||
|
;; (load-file (concat init-dir "lib/smartparens-emacs-lisp.el"))
|
||||||
|
;; (load-file (concat init-dir "lib/smartparens-scheme.el"))
|
||||||
|
;; (require 'smartparens-clojure)
|
||||||
|
;; (require 'smartparens-emacs-lisp)
|
||||||
|
;; (require 'smartparens-scheme)
|
||||||
|
;; (evil-define-key 'insert smartparens-mode-map
|
||||||
|
;; (kbd "r") (conditional-keybind #'looking-at-opening-paren
|
||||||
|
;; #'sp-raise-sexp)
|
||||||
|
;; (kbd "w") (conditional-keybind #'looking-at-opening-paren
|
||||||
|
;; #'cc/move-sexp-backward)
|
||||||
|
;; (kbd "s") (conditional-keybind #'looking-at-opening-paren
|
||||||
|
;; #'cc/move-sexp-forward)
|
||||||
|
;; (kbd "c") (conditional-keybind #'looking-at-opening-paren
|
||||||
|
;; #'sp-clone-sexp)
|
||||||
|
;; (kbd "m") (conditional-keybind #'looking-at-opening-paren
|
||||||
|
;; #'sp-mark-sexp)
|
||||||
|
;; (kbd "DEL") (conditional-keybind #'being-past-closing-paren
|
||||||
|
;; #'sp-backward-delete-sexp
|
||||||
|
;; #'evil-delete-backward-char-and-join)
|
||||||
|
;; (kbd ">") (conditional-keybind #'being-past-closing-paren
|
||||||
|
;; (lambda (prefix)
|
||||||
|
;; (interactive "P")
|
||||||
|
;; (call-interactively #'backward-char)
|
||||||
|
;; (call-interactively #'sp-forward-slurp-sexp)
|
||||||
|
;; (call-interactively #'sp-forward-sexp)
|
||||||
|
;; (call-interactively #'forward-char)))
|
||||||
|
;; (kbd "<") (conditional-keybind #'being-past-closing-paren
|
||||||
|
;; (lambda (prefix)
|
||||||
|
;; (interactive "P")
|
||||||
|
;; (call-interactively #'backward-char)
|
||||||
|
;; (call-interactively #'sp-forward-barf-sexp)
|
||||||
|
;; (call-interactively #'forward-char)))))
|
||||||
|
|
||||||
|
;; (use-package evil-cleverparens
|
||||||
|
;; :after smartparens
|
||||||
|
;; :hook smartparens)
|
||||||
|
|
||||||
;;;;; Visual Aid
|
;;;;; Visual Aid
|
||||||
;; (use-package rainbow-delimiters
|
;; (use-package rainbow-delimiters
|
||||||
|
@ -585,7 +612,7 @@ Point must be at the beginning of balanced expression (sexp)."
|
||||||
(setq-default eglot-workspace-configuration
|
(setq-default eglot-workspace-configuration
|
||||||
'((clojure-lsp (maxCompletions . 300))))
|
'((clojure-lsp (maxCompletions . 300))))
|
||||||
(add-to-list 'eglot-server-programs
|
(add-to-list 'eglot-server-programs
|
||||||
'((clojure-ts-mode clojurec-ts-mode clojurescript-ts-mode)
|
'((clojure-mode clojurec-mode clojurescript-mode)
|
||||||
"clojure-lsp"
|
"clojure-lsp"
|
||||||
:initializationOptions
|
:initializationOptions
|
||||||
(:preferences
|
(:preferences
|
||||||
|
@ -621,38 +648,36 @@ Point must be at the beginning of balanced expression (sexp)."
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
||||||
;;;;; Clojure
|
;;;;; Clojure
|
||||||
(use-package clojure-ts-mode
|
;; (use-package clojure-ts-mode
|
||||||
:delight ""
|
;; :delight ""
|
||||||
:after tree-sitter
|
;; :after tree-sitter
|
||||||
:config
|
;; :config
|
||||||
(require 'sesman)
|
;; (require 'sesman)
|
||||||
(sesman-install-menu clojure-mode-map)
|
;; (sesman-install-menu clojure-mode-map)
|
||||||
:hook
|
;; :hook
|
||||||
((clojure-ts-mode . eglot-ensure)
|
;; ((clojure-ts-mode . eglot-ensure)
|
||||||
(clojure-ts-mode . (lambda ()
|
;; (clojure-ts-mode . (lambda ()
|
||||||
(setq-local sesman-system 'CIDER)))
|
;; (setq-local sesman-system 'CIDER)))
|
||||||
(clojure-ts-mode . (lambda ()
|
;; (clojure-ts-mode . (lambda ()
|
||||||
(sesman-install-menu clojure-mode-map)))
|
;; (sesman-install-menu clojure-mode-map)))
|
||||||
(clojurec-ts-mode . (lambda ()
|
;; (clojurec-ts-mode . (lambda ()
|
||||||
(sesman-install-menu clojurec-mode-map)))
|
;; (sesman-install-menu clojurec-mode-map)))
|
||||||
(clojurescript-ts-mode . (lambda ()
|
;; (clojurescript-ts-mode . (lambda ()
|
||||||
(sesman-install-menu clojurescript-mode-map))))
|
;; (sesman-install-menu clojurescript-mode-map))))
|
||||||
:mode
|
;; :mode
|
||||||
("\\.clj\\'" . #'clojure-ts-mode)
|
;; ("\\.clj\\'" . #'clojure-ts-mode)
|
||||||
("\\.cljc\\'" . #'clojurec-ts-mode)
|
;; ("\\.cljc\\'" . #'clojurec-ts-mode)
|
||||||
("\\.cljs\\'" . #'clojurescript-ts-mode)
|
;; ("\\.cljs\\'" . #'clojurescript-ts-mode)
|
||||||
:init
|
;; :init
|
||||||
(add-to-list 'tree-sitter-major-mode-language-alist
|
;; (add-to-list 'tree-sitter-major-mode-language-alist
|
||||||
'(clojure-ts-mode . clojure))
|
;; '(clojure-ts-mode . clojure))
|
||||||
(add-to-list 'tree-sitter-major-mode-language-alist
|
;; (add-to-list 'tree-sitter-major-mode-language-alist
|
||||||
'(clojurec-ts-mode . clojure))
|
;; '(clojurec-ts-mode . clojure))
|
||||||
(add-to-list 'tree-sitter-major-mode-language-alist
|
;; (add-to-list 'tree-sitter-major-mode-language-alist
|
||||||
'(clojurescript-ts-mode . clojure)))
|
;; '(clojurescript-ts-mode . clojure)))
|
||||||
|
|
||||||
(use-package cider
|
(use-package cider
|
||||||
:delight (cider-mode '(:eval (concat " [" (cider--modeline-info) "]")))
|
:delight (cider-mode '(:eval (concat " [" (cider--modeline-info) "]")))
|
||||||
:hook
|
|
||||||
(clojure-ts-mode . cider-mode)
|
|
||||||
:config
|
:config
|
||||||
(evil-define-key 'insert 'cider-mode-map
|
(evil-define-key 'insert 'cider-mode-map
|
||||||
"C-x C-e" #'cider-eval-last-sexp)
|
"C-x C-e" #'cider-eval-last-sexp)
|
||||||
|
|
Loading…
Reference in a new issue