mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
Add sort-words function and sw alias to it
This commit is contained in:
@@ -57,8 +57,22 @@
|
||||
(lambda (x) (cons (random) (concat x "\n"))) lines)
|
||||
(lambda (a b) (< (car a) (car b))))))))
|
||||
|
||||
;; from: https://www.emacswiki.org/emacs/SortWords
|
||||
(defun sort-words (reverse beg end)
|
||||
"Sort words in region alphabetically, in REVERSE if negative.
|
||||
Prefixed with negative \\[universal-argument], sorts in reverse.
|
||||
|
||||
The variable `sort-fold-case' determines whether alphabetic case
|
||||
affects the sort order.
|
||||
|
||||
See `sort-regexp-fields'."
|
||||
(interactive "*P\nr")
|
||||
(sort-regexp-fields reverse "\\w+" "\\&" beg end))
|
||||
|
||||
(global-set-key (kbd "C-c /") 'comment-or-uncomment-region-or-line)
|
||||
(global-set-key (kbd "C-c C-/") 'comment-or-uncomment-region-or-line)
|
||||
|
||||
(defalias 'sw 'sort-words)
|
||||
|
||||
(provide 'siren-text-manipulation)
|
||||
;;; siren-text-manipulation.el ends here
|
||||
|
||||
Reference in New Issue
Block a user