Add programming hydra

This commit is contained in:
Maciej 2018-09-10 21:48:46 +03:00
parent 6314c9941e
commit 87ee26bc1d
Signed by: maciej
GPG key ID: 41D62D42D3B0D765
2 changed files with 23 additions and 7 deletions

View file

@ -21,3 +21,26 @@ _t_: Find file _g_: ag in current project
("m" magit-status)) ("m" magit-status))
(global-set-key (kbd "C-c p") 'hydra-file-switcher-menu/body) (global-set-key (kbd "C-c p") 'hydra-file-switcher-menu/body)
(defhydra hydra-programming-actions (:color teal :hint nil :columns 4)
"
Programming actions
^Windows^ ^Code Manipulation^
^^^^^^^^-----------------------------------------------------------------------
_k_: kill buffer and window _c_: comment line
_sh_: split horizontally _r_: regex replace
_sv_: split vertically _i_: indent region
^^ _a_: align regexp
"
("q" nil "cancel" :color pink)
("k" kill-buffer-and-window)
("sh" split-window-below)
("sv" split-window-right)
("c" comment-line)
("r" vr/replace)
("i" indent-region)
("a" align-regexp))
(define-key prog-mode-map (kbd "C-c c") 'hydra-programming-actions/body)

View file

@ -31,13 +31,6 @@
;; Key bindings ;; Key bindings
(define-key prog-mode-map (kbd "C-d") 'dash-at-point) ;; Jump to dash definition (define-key prog-mode-map (kbd "C-d") 'dash-at-point) ;; Jump to dash definition
(define-key prog-mode-map (kbd "C-c c") 'comment-line)
(define-key prog-mode-map (kbd "C-c r") 'align-regexp) ;; Because C-c a is used
;; by ag already.
(define-key prog-mode-map (kbd "C-c i") 'indent-region)
(define-key prog-mode-map (kbd "C-c v") 'vr/replace) ;; Visually replace all
;; occurences of a specific
;; regex
;; When possible, show code documentation ;; When possible, show code documentation
(global-eldoc-mode 1) (global-eldoc-mode 1)