Add doom/toggle-sticky to core/autoload/editor
This commit is contained in:
parent
66b223f02c
commit
b135b7bf53
1 changed files with 13 additions and 0 deletions
|
@ -186,3 +186,16 @@ consistent throughout a selected region, depending on `indent-tab-mode'."
|
|||
(tabify beg end)
|
||||
(untabify beg end)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/toggle-sticky (&optional beg end)
|
||||
"Make a selection sticky by placing it in the header line. Possibly helpful
|
||||
for function signatures or notes. Run again to clear the header line."
|
||||
(interactive "r")
|
||||
(setq header-line-format
|
||||
(when mark-active
|
||||
(concat (propertize (format nlinum-format (line-number-at-pos beg))
|
||||
'face 'font-lock-comment-face)
|
||||
(let ((content (buffer-substring beg end)))
|
||||
(setq content (s-replace "\n" " " content))
|
||||
(setq content (replace-regexp-in-string "\\s-+" " " content))
|
||||
content)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue