2015-11-09 15:25:20 +09:00
|
|
|
;;; boon-colemak.el --- An Ergonomic Command Mode -*- lexical-binding: t -*-
|
2014-10-19 14:17:46 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
;;; Code:
|
|
|
|
(require 'boon-core)
|
|
|
|
(require 'boon-main)
|
|
|
|
(require 'boon-search)
|
2014-10-19 22:29:29 +02:00
|
|
|
(require 'boon-keys)
|
2014-10-19 14:17:46 +02:00
|
|
|
|
2015-11-25 22:13:12 +01:00
|
|
|
(define-key boon-select-map "C" 'boon-select-comment)
|
|
|
|
(define-key boon-select-map "g" 'boon-select-org-table-cell)
|
2014-10-19 14:17:46 +02:00
|
|
|
(define-key boon-select-map "d" 'boon-select-document)
|
|
|
|
(define-key boon-select-map "p" 'boon-select-paragraph)
|
2015-11-25 22:13:12 +01:00
|
|
|
;; (define-key boon-select-map "w" 'boon-select-word)
|
2014-10-19 14:17:46 +02:00
|
|
|
(define-key boon-select-map "f" 'boon-select-word) ;; 'rf' is easier to type than 'rw'
|
|
|
|
(define-key boon-select-map "x" 'boon-select-outside-pairs) ;; eXpression
|
|
|
|
(define-key boon-select-map "c" 'boon-select-inside-pairs) ;; Contents
|
|
|
|
(define-key boon-select-map "s" 'boon-select-wim) ;; symbol
|
|
|
|
(define-key boon-select-map "q" 'boon-select-outside-quotes)
|
|
|
|
(define-key boon-select-map " " 'boon-select-line)
|
2014-11-03 09:15:55 +01:00
|
|
|
(define-key boon-select-map "r" 'boon-select-justline) ;; Row
|
2014-10-19 14:17:46 +02:00
|
|
|
(define-key boon-select-map "a" 'boon-select-borders) ;; Around
|
|
|
|
(define-key boon-select-map "z" 'boon-select-content) ;; inZide
|
|
|
|
|
2014-12-20 22:19:05 +01:00
|
|
|
(define-key boon-select-map "'" 'boon-switch-mark)
|
|
|
|
(define-key boon-select-map "k" 'boon-select-blanks) ;; blanKs
|
|
|
|
|
|
|
|
|
2014-10-19 14:17:46 +02:00
|
|
|
(define-key boon-moves-map "k" 'boon-switch-mark) ; bacK to marK
|
2015-11-25 22:20:12 +01:00
|
|
|
(define-key boon-moves-map "K" 'pop-global-mark)
|
2014-10-19 13:59:12 +02:00
|
|
|
|
2015-11-08 22:07:32 +01:00
|
|
|
(define-key boon-moves-map "j" 'find-function-at-point)
|
|
|
|
(define-key boon-moves-map "J" 'find-function)
|
2014-10-19 13:59:12 +02:00
|
|
|
(define-key boon-moves-map "u" 'previous-line)
|
|
|
|
(define-key boon-moves-map "y" 'next-line)
|
|
|
|
(define-key boon-moves-map "U" 'backward-paragraph)
|
|
|
|
(define-key boon-moves-map "Y" 'forward-paragraph)
|
|
|
|
(define-key boon-moves-map "l" 'boon-beginning-of-line)
|
|
|
|
(define-key boon-moves-map ";" 'boon-end-of-line)
|
2014-10-23 13:50:16 +02:00
|
|
|
(define-key boon-moves-map "n" 'boon-smarter-backward)
|
|
|
|
(define-key boon-moves-map "o" 'boon-smarter-forward)
|
|
|
|
(define-key boon-moves-map "N" 'boon-smarter-upward)
|
|
|
|
(define-key boon-moves-map "O" 'boon-smarter-downward)
|
2014-10-19 13:59:12 +02:00
|
|
|
(define-key boon-moves-map "," 'boon-beginning-of-expression)
|
|
|
|
(define-key boon-moves-map "." 'boon-end-of-expression)
|
|
|
|
(define-key boon-moves-map "e" 'backward-char)
|
|
|
|
(define-key boon-moves-map "i" 'forward-char)
|
2015-11-25 22:13:12 +01:00
|
|
|
(define-key boon-moves-map "<" 'beginning-of-buffer)
|
|
|
|
(define-key boon-moves-map ">" 'end-of-buffer)
|
2015-10-21 22:26:15 +02:00
|
|
|
(define-key boon-moves-map "m" 'boon-qsearch-previous-at-point)
|
|
|
|
(define-key boon-moves-map "/" 'boon-qsearch-next-at-point)
|
2015-07-21 23:36:38 +02:00
|
|
|
(define-key boon-moves-map "h" 'avy-goto-word-1)
|
2015-11-25 22:13:12 +01:00
|
|
|
(define-key boon-moves-map "H" 'avy-goto-char)
|
2014-10-28 14:33:55 +01:00
|
|
|
(define-key boon-moves-map (kbd "C-,") 'beginning-of-buffer)
|
|
|
|
(define-key boon-moves-map (kbd "C-.") 'end-of-buffer)
|
2014-10-19 13:59:12 +02:00
|
|
|
|
2015-11-22 20:25:33 +01:00
|
|
|
(eval-after-load 'helm
|
|
|
|
'(progn
|
|
|
|
(define-key helm-map (kbd "C-l") 'previous-history-element)
|
|
|
|
(define-key helm-map (kbd "C-;") 'next-history-element)
|
|
|
|
(define-key helm-map (kbd "C-u") 'helm-previous-line)
|
|
|
|
(define-key helm-map (kbd "C-y") 'helm-next-line)
|
|
|
|
(define-key helm-map (kbd "C-,") 'helm-previous-page)
|
|
|
|
(define-key helm-map (kbd "C-.") 'helm-next-page)
|
|
|
|
(define-key helm-map (kbd "C-.") 'helm-next-page)
|
|
|
|
))
|
|
|
|
|
|
|
|
;; actions
|
|
|
|
(define-key boon-helm-command-map (kbd "j") 'helm-execute-persistent-action)
|
2015-11-25 21:55:43 +01:00
|
|
|
(define-key boon-helm-command-map (kbd "h") 'helm-select-2nd-action)
|
|
|
|
(define-key boon-helm-command-map (kbd "k") 'helm-select-3rd-action)
|
2015-11-22 20:25:33 +01:00
|
|
|
|
|
|
|
;; top row
|
|
|
|
(define-key boon-helm-command-map (kbd "q") 'helm-keyboard-quit)
|
|
|
|
(define-key boon-helm-command-map (kbd "f") 'helm-follow-mode)
|
2014-10-19 22:29:29 +02:00
|
|
|
|
2014-10-28 12:30:38 +01:00
|
|
|
;; home row: yanking/killing
|
2015-11-22 20:25:33 +01:00
|
|
|
(define-key boon-helm-command-map (kbd "r") 'helm-yank-selection)
|
|
|
|
(define-key boon-helm-command-map (kbd "s") 'next-history-element) ;; has the effect of getting the whole symbol at point
|
|
|
|
(define-key boon-helm-command-map (kbd "t") 'helm-yank-text-at-point)
|
|
|
|
(define-key boon-helm-command-map (kbd "d") 'helm-delete-minibuffer-contents)
|
|
|
|
|
|
|
|
;; bottom row (as regular)
|
|
|
|
(define-key boon-helm-command-map (kbd "c") boon-c-map)
|
|
|
|
(define-key boon-helm-command-map (kbd "x") boon-x-map)
|
|
|
|
(define-key boon-helm-command-map (kbd "v") 'boon-helm-set-insert-state) ;; for consistency
|
|
|
|
|
|
|
|
(define-key boon-helm-command-map (kbd "l") 'previous-history-element)
|
|
|
|
(define-key boon-helm-command-map (kbd ";") 'next-history-element)
|
|
|
|
(define-key boon-helm-command-map (kbd "y") 'helm-next-line)
|
|
|
|
(define-key boon-helm-command-map (kbd "u") 'helm-previous-line)
|
|
|
|
(define-key boon-helm-command-map (kbd "U") 'helm-previous-source)
|
|
|
|
(define-key boon-helm-command-map (kbd "Y") 'helm-next-source)
|
|
|
|
(define-key boon-helm-command-map (kbd ",") 'helm-previous-page)
|
|
|
|
(define-key boon-helm-command-map (kbd ".") 'helm-next-page)
|
|
|
|
(define-key boon-helm-command-map (kbd "C-y") 'helm-scroll-other-window)
|
|
|
|
(define-key boon-helm-command-map (kbd "C-u") 'helm-scroll-other-window-down)
|
|
|
|
(define-key boon-helm-command-map (kbd "m") 'helm-prev-visible-mark)
|
|
|
|
(define-key boon-helm-command-map (kbd "/") 'helm-next-visible-mark)
|
|
|
|
(define-key boon-helm-command-map (kbd ">") 'helm-goto-next-file)
|
|
|
|
(define-key boon-helm-command-map (kbd "<") 'helm-goto-precedent-file)
|
2014-10-19 22:29:29 +02:00
|
|
|
|
2014-10-19 13:59:12 +02:00
|
|
|
|
|
|
|
(define-key isearch-mode-map [(control p)] 'helm-occur-from-isearch)
|
|
|
|
(define-key isearch-mode-map [(control w)] 'isearch-repeat-backward)
|
|
|
|
(define-key isearch-mode-map [(control f)] 'isearch-repeat-forward)
|
|
|
|
|
2014-10-19 22:29:29 +02:00
|
|
|
;; Special keys
|
|
|
|
|
|
|
|
;; LEFT HAND
|
|
|
|
|
|
|
|
;; Top row
|
|
|
|
;; q
|
|
|
|
(define-key boon-command-map "q" 'boon-quote-character)
|
|
|
|
|
|
|
|
;; w,f
|
|
|
|
;; where is? find?
|
|
|
|
(define-key boon-moves-map "w " 'isearch-backward)
|
|
|
|
(define-key boon-moves-map "f " 'isearch-forward)
|
|
|
|
|
|
|
|
(define-key boon-moves-map "wt" 'boon-qsearch-previous-at-point)
|
|
|
|
(define-key boon-moves-map "ft" 'boon-qsearch-next-at-point)
|
|
|
|
(define-key boon-moves-map "ws" 'boon-qsearch-previous-at-point)
|
|
|
|
(define-key boon-moves-map "fs" 'boon-qsearch-next-at-point)
|
|
|
|
|
|
|
|
(define-key boon-moves-map "ww" 'boon-qsearch-previous)
|
|
|
|
(define-key boon-moves-map "ff" 'boon-qsearch-next)
|
|
|
|
|
|
|
|
(define-key boon-moves-map "W" 'boon-qsearch-previous)
|
|
|
|
(define-key boon-moves-map "F" 'boon-qsearch-next)
|
|
|
|
(define-key boon-moves-map "wp" 'boon-qsearch-previous)
|
|
|
|
(define-key boon-moves-map "fp" 'boon-qsearch-next)
|
|
|
|
(define-key boon-moves-map "we" 'previous-error)
|
|
|
|
(define-key boon-moves-map "fe" 'next-error)
|
|
|
|
(define-key boon-moves-map "wk" 'flycheck-previous-error)
|
|
|
|
(define-key boon-moves-map "fk" 'flycheck-next-error)
|
|
|
|
(define-key boon-moves-map "wb" 'previous-buffer)
|
|
|
|
(define-key boon-moves-map "fb" 'next-buffer)
|
2015-10-22 22:46:27 +02:00
|
|
|
(define-key boon-moves-map "fu" 'mc/cycle-forward)
|
|
|
|
(define-key boon-moves-map "wu" 'mc/cycle-backward)
|
2014-10-19 22:29:29 +02:00
|
|
|
|
|
|
|
;; p
|
|
|
|
;; Pinpoint Place
|
|
|
|
(define-key boon-command-map "p" 'helm-occur)
|
|
|
|
|
|
|
|
;; Misc crap
|
|
|
|
(define-key boon-command-map "P" 'kmacro-end-or-call-macro) ; Play
|
|
|
|
(define-key boon-command-map "X" 'boon-highlight-regexp)
|
|
|
|
|
2014-10-19 22:50:50 +02:00
|
|
|
;; g Gather/Go To
|
2014-10-20 08:30:18 +02:00
|
|
|
(define-key boon-command-map "g" boon-goto-map)
|
2014-10-19 22:29:29 +02:00
|
|
|
|
|
|
|
;; home row
|
|
|
|
;; a
|
|
|
|
(define-key boon-command-map "a" 'boon-enclose) ; around
|
|
|
|
|
|
|
|
;; r
|
|
|
|
(define-key boon-command-map "r" 'boon-substitute-region) ; replace
|
|
|
|
(define-key boon-command-map "R" 'kmacro-start-macro) ; Record
|
|
|
|
|
|
|
|
;; s
|
|
|
|
(define-key boon-command-map "s" 'boon-splice) ; splice
|
|
|
|
(define-key boon-command-map "S" 'yank-pop)
|
|
|
|
|
|
|
|
;; t
|
|
|
|
(define-key boon-command-map "t" 'boon-take-region) ; "take"
|
|
|
|
(define-key boon-command-map "T" 'boon-treasure-region) ; "treasure"
|
|
|
|
|
|
|
|
;; d
|
2014-10-28 14:33:55 +01:00
|
|
|
(define-key boon-command-map "d" 'boon-replace-by-character) ; "displace"
|
2014-10-19 22:29:29 +02:00
|
|
|
|
|
|
|
;; Bottom row
|
|
|
|
;; z
|
|
|
|
;; reserved (repeat?)
|
2015-10-20 22:37:59 +02:00
|
|
|
(define-key boon-command-map "z" 'boon-drop-cursor)
|
2015-10-21 22:31:20 +02:00
|
|
|
(define-key boon-command-map "Z" 'boon-move-cursor)
|
2014-10-19 22:29:29 +02:00
|
|
|
;; x
|
|
|
|
(define-key boon-command-map "x" boon-x-map)
|
|
|
|
;; c
|
2014-10-26 13:34:54 +01:00
|
|
|
(define-key boon-command-map "c" boon-c-map)
|
2014-10-19 22:29:29 +02:00
|
|
|
;; v
|
|
|
|
(define-key boon-command-map (kbd "C-v") 'boon-open-line-and-insert)
|
|
|
|
(define-key boon-command-map "V" 'boon-open-next-line-and-insert)
|
|
|
|
(define-key boon-command-map "v" 'boon-set-insert-like-state) ; 'v' looks like an insertion mark
|
|
|
|
;; b
|
|
|
|
(define-key boon-command-map "B" 'boon-copy-to-register)
|
|
|
|
(define-key boon-command-map "b" 'insert-register)
|
|
|
|
|
|
|
|
;; RIGHT HAND: movement and marking commands.
|
|
|
|
;; Most of these are actually in the boon-moves-map; however some don't quite work there; so they end up here.
|
2015-06-06 22:39:09 +02:00
|
|
|
(define-key boon-command-map (kbd "C-u") 'scroll-down-line)
|
|
|
|
(define-key boon-command-map (kbd "C-y") 'scroll-up-line)
|
2014-10-19 22:29:29 +02:00
|
|
|
(define-key boon-command-map "'" 'boon-toggle-mark)
|
2014-10-19 14:17:46 +02:00
|
|
|
|
2015-11-22 20:25:33 +01:00
|
|
|
|
2014-10-19 14:17:46 +02:00
|
|
|
(provide 'boon-colemak)
|
|
|
|
;;; boon-colemak.el ends here
|
2015-05-29 21:21:55 +02:00
|
|
|
|
|
|
|
|
|
|
|
(define-key indent-rigidly-map "i" 'indent-rigidly-right)
|
|
|
|
(define-key indent-rigidly-map "e" 'indent-rigidly-left)
|