Add some useful keybindings

This commit is contained in:
Wojciech Kozlowski 2019-02-10 12:13:51 +01:00
parent 950fb57f07
commit 6231159994
2 changed files with 26 additions and 8 deletions

View File

@ -227,6 +227,19 @@
(indent-buffer) (indent-buffer)
(whitespace-cleanup))))) (whitespace-cleanup)))))
(defun transpose-lines-down ()
"Transpose the current line with the one below."
(interactive)
(next-line)
(transpose-lines 1)
(previous-line))
(defun transpose-lines-up ()
"Transpose the current line with the one above."
(interactive)
(transpose-lines 1)
(previous-line 2))
;; Key-bindings ------------------------------------------------------------- ;; Key-bindings -------------------------------------------------------------
;; Override the beginning of line key-binding. ;; Override the beginning of line key-binding.
@ -238,6 +251,10 @@
;; unfill-paragraph, closely related to fill-paragraph. ;; unfill-paragraph, closely related to fill-paragraph.
(global-set-key (kbd "M-Q") 'unfill-paragraph) (global-set-key (kbd "M-Q") 'unfill-paragraph)
;; Transpose-lines keybindings
(global-set-key (kbd "M-<down>") 'transpose-lines-down)
(global-set-key (kbd "M-<up>") 'transpose-lines-up)
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
;; Additional key-bindings. ;; Additional key-bindings.
;; -------------------------------------------------------------------------- ;; --------------------------------------------------------------------------
@ -245,9 +262,12 @@
;; Toggle whitespace mode. ;; Toggle whitespace mode.
(global-set-key (kbd "C-c w") 'whitespace-mode) (global-set-key (kbd "C-c w") 'whitespace-mode)
;; Occur. More convenient than "M-s o" ;; Occur. More convenient than "M-s o".
(global-set-key (kbd "M-s M-o") 'occur) (global-set-key (kbd "M-s M-o") 'occur)
;; Flyspell correct word. More convenient than C-c $.
(global-set-key (kbd "C-c C-'") 'flyspell-correct-word-before-point)
) )
(provide 'em-editing) (provide 'em-editing)

View File

@ -3,11 +3,7 @@
* Visual * Visual
** TODO Clean up the theme file ** TODO Clean up the theme file
** TODO Fix doom-modeline in newest version ** NEXT Fix doom-modeline in newest version
* Editing
** TODO Make better use of anzu
* Programming modes * Programming modes
@ -20,8 +16,10 @@
* Useful keybindings * Useful keybindings
** TODO Swap lines ** DONE Swap lines
** TODO Better spellcheck keybinding CLOSED: [2019-02-10 Sun 12:09]
** DONE Better spellcheck keybinding
CLOSED: [2019-02-10 Sun 12:12]
* From reddit * From reddit