feat(emacs): Support Nix's ''big quotes''
This commit is contained in:
@@ -26,6 +26,15 @@
|
||||
(set-popup-rule! (rx bol "*nixos-options-doc*" eol) :ttl 0 :quit t)
|
||||
(set-repl-handler! 'nix-mode #'syd-nix-open-nix-repl)
|
||||
(dolist (c '(?- ?_))
|
||||
(modify-syntax-entry c "w" nix-mode-syntax-table)))
|
||||
(modify-syntax-entry c "w" nix-mode-syntax-table))
|
||||
|
||||
;; Inform Smartparens and Evil-surround of Nix's alternative string syntax.
|
||||
(with-eval-after-load 'smartparens
|
||||
(sp-local-pair 'nix-mode "''" "''"))
|
||||
(syd-add-hook 'nix-mode-hook
|
||||
(defun syd-nix--configure-evil-surround-h ()
|
||||
(with-eval-after-load 'evil-surround
|
||||
(push '(?Q . ("''" . "''"))
|
||||
evil-surround-pairs-alist)))))
|
||||
|
||||
(provide 'syd-lang-nix)
|
||||
|
||||
@@ -25,29 +25,26 @@
|
||||
;; it buffer-locally. It's less work for smartparens.
|
||||
(sp-max-pair-length 4))
|
||||
:config
|
||||
;; load default config
|
||||
;; Load default config.
|
||||
(require 'smartparens-config)
|
||||
;; Silence some harmless but annoying echo-area spam
|
||||
(dolist (key '(:unmatched-expression :no-matching-tag))
|
||||
(setf (alist-get key sp-message-alist) nil))
|
||||
|
||||
(syd-add-hook 'eval-expression-minibuffer-setup-hook
|
||||
(defun syd-init-smartparens-in-eval-expression-h ()
|
||||
"Enable `smartparens-mode' in the minibuffer for `eval-expression'. This
|
||||
includes everything that calls `read--expression', e.g. `edebug-eval-expression'
|
||||
Only enable it if `smartparens-global-mode' is on."
|
||||
It is only enabled it if `smartparens-global-mode' is on."
|
||||
(when smartparens-global-mode
|
||||
(smartparens-mode 1)))
|
||||
|
||||
(add-hook 'eval-expression-minibuffer-setup-hook
|
||||
#'syd-init-smartparens-in-eval-expression-h)
|
||||
(smartparens-mode 1))))
|
||||
|
||||
(syd-add-hook 'minibuffer-setup-hook
|
||||
(defun syd-init-smartparens-in-minibuffer-maybe-h ()
|
||||
"Enable `smartparens' for non-`eval-expression' commands. Only enable
|
||||
`smartparens-mode' if `smartparens-global-mode' is on."
|
||||
(when (and smartparens-global-mode (memq this-command '(evil-ex)))
|
||||
(smartparens-mode 1)))
|
||||
|
||||
(add-hook 'minibuffer-setup-hook #'syd-init-smartparens-in-minibuffer-maybe-h)
|
||||
(smartparens-mode 1))))
|
||||
|
||||
;; You're likely writing lisp in the minibuffer, therefore, disable these
|
||||
;; quote pairs, which lisps doesn't use for strings:
|
||||
|
||||
Reference in New Issue
Block a user