feat: Library additions
This commit is contained in:
@@ -44,6 +44,10 @@
|
|||||||
;; (<= 2 (length hform))
|
;; (<= 2 (length hform))
|
||||||
;; (nth 1 hform)))
|
;; (nth 1 hform)))
|
||||||
|
|
||||||
|
(defmacro comment (&rest _)
|
||||||
|
"Completely every argument, and expand to nil."
|
||||||
|
nil)
|
||||||
|
|
||||||
(defmacro with-transient-after (hook-or-function &rest forms)
|
(defmacro with-transient-after (hook-or-function &rest forms)
|
||||||
(let ((hook-name (gensym "transient-hook"))
|
(let ((hook-name (gensym "transient-hook"))
|
||||||
(hook-or-function* (gensym "hook-or-function")))
|
(hook-or-function* (gensym "hook-or-function")))
|
||||||
|
|||||||
@@ -68,4 +68,48 @@ in some cases."
|
|||||||
(prompt
|
(prompt
|
||||||
(read-string (if (stringp prompt) prompt "")))))
|
(read-string (if (stringp prompt) prompt "")))))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun syd-insert-newline-above ()
|
||||||
|
"Insert a blank line below the current line."
|
||||||
|
(interactive)
|
||||||
|
(save-excursion (evil-insert-newline-above)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun syd-insert-newline-below ()
|
||||||
|
"Insert a blank line below the current line."
|
||||||
|
(interactive)
|
||||||
|
(save-excursion (evil-insert-newline-below)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(defun syd-render-ansi-escape-codes (beg end)
|
||||||
|
(interactive "r")
|
||||||
|
(require 'ansi-color)
|
||||||
|
(if (region-active-p)
|
||||||
|
(ansi-color-apply-on-region beg end)
|
||||||
|
(ansi-color-apply-on-region (point-min) (point-max))))
|
||||||
|
|
||||||
|
(defun syd-evil-paste (before-p arg &optional register yank-handler)
|
||||||
|
"Like `evil-paste-after', but a 'C-u' prefix argument will instead act like
|
||||||
|
':put' (i.e. the register will be pasted onto a new line)."
|
||||||
|
(if (consp arg)
|
||||||
|
(evil-ex-put (syd-region-beginning) (syd-region-end)
|
||||||
|
;; `evil-ex-put' wants a string, but it is immediately
|
||||||
|
;; converted back to a char. }xP
|
||||||
|
(and register (string register))
|
||||||
|
before-p)
|
||||||
|
(funcall (if before-p #'evil-paste-before #'evil-paste-after)
|
||||||
|
arg register yank-handler)))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(evil-define-command syd-evil-paste-after (arg &optional register yank-handler)
|
||||||
|
"See `syd-evil-paste'.'"
|
||||||
|
(interactive "P<x><y>")
|
||||||
|
(syd-evil-paste nil arg register yank-handler))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(evil-define-command syd-evil-paste-before (arg &optional register yank-handler)
|
||||||
|
"See `syd-evil-paste'.'"
|
||||||
|
(interactive "P<x><y>")
|
||||||
|
(syd-evil-paste t arg register yank-handler))
|
||||||
|
|
||||||
(provide 'syd-text)
|
(provide 'syd-text)
|
||||||
|
|||||||
Reference in New Issue
Block a user