From 863222af0d5800996bcdee50dd5210c789b3d865 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 31 Jan 2021 21:59:47 -0800 Subject: [PATCH] Add a hydra to sort lines and strings --- oni-core.el | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/oni-core.el b/oni-core.el index 56253a9..1660dfa 100644 --- a/oni-core.el +++ b/oni-core.el @@ -4,8 +4,8 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 2020.1218.000639 -;; Package-Requires: (oni-data-dir oni-embrace expand-region multiple-cursors gcmh diminish ws-butler which-key) +;; Version: 2021.0131.215934 +;; Package-Requires: (oni-data-dir oni-embrace oni-hydra expand-region multiple-cursors gcmh diminish ws-butler which-key) ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by @@ -29,10 +29,11 @@ (require 'diminish) (require 'gcmh) +(require 'hydra) (require 'oni-data-dir) (require 'recentf) -(require 'ws-butler) (require 'which-key) +(require 'ws-butler) (defconst oni-core--auto-save-directory (oni-data-dir-locate "auto-save-files/") "Directory where auto-saves go.") @@ -85,6 +86,20 @@ (let ((inhibit-message t)) (recentf-save-list))) +(defhydra oni-sort-and-align-hydra (:color teal :hint nil) + " + ^Sort^ +^^-------------- +_l_: Lines +_s_: String list" + ("l" sort-lines) + ("s" (sort-regexp-fields + nil + (rx "\"" (one-or-more (not "\"")) "\"") + (rx (one-or-more (not "\""))) + (region-beginning) + (region-end)))) + (add-to-list 'auto-save-file-name-transforms `(".*" ,oni-core--auto-save-directory t) :append) @@ -136,16 +151,17 @@ (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) (global-set-key (kbd "C-M-SPC") 'er/expand-region) -(global-set-key (kbd "M-+") 'mc/mark-next-like-this) -(global-set-key (kbd "C-c (") 'embrace-commander) -(global-set-key (kbd "C-x M-f") 'ffap) -(global-set-key (kbd "C-x C-b") 'ibuffer-jump) -(global-set-key [remap move-beginning-of-line] #'oni-core-move-beginning-of-dwim) -(global-set-key [remap move-end-of-line] #'oni-core-move-end-of-dwim) +(global-set-key (kbd "C-S-b") 'windmove-left) +(global-set-key (kbd "C-S-f") 'windmove-right) (global-set-key (kbd "C-S-n") 'windmove-down) (global-set-key (kbd "C-S-p") 'windmove-up) -(global-set-key (kbd "C-S-f") 'windmove-right) -(global-set-key (kbd "C-S-b") 'windmove-left) +(global-set-key (kbd "C-c (") 'embrace-commander) +(global-set-key (kbd "C-c s") #'oni-sort-and-align-hydra/body) +(global-set-key (kbd "C-x C-b") 'ibuffer-jump) +(global-set-key (kbd "C-x M-f") 'ffap) +(global-set-key (kbd "M-+") 'mc/mark-next-like-this) +(global-set-key [remap move-beginning-of-line] #'oni-core-move-beginning-of-dwim) +(global-set-key [remap move-end-of-line] #'oni-core-move-end-of-dwim) (global-set-key (kbd "C-") 'winner-undo) (global-set-key (kbd "C-") 'winner-redo)