2015-11-09 15:25:20 +09:00
|
|
|
;;; boon-keys.el --- An Ergonomic Command Mode -*- lexical-binding: t -*-
|
2014-10-19 13:59:12 +02:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
2014-10-19 23:01:11 +02:00
|
|
|
;; This module defines various keymaps and portions of keymaps, common
|
|
|
|
;; to all keyboard layouts.
|
|
|
|
|
2014-10-19 13:59:12 +02:00
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'boon-core)
|
|
|
|
|
2016-11-16 19:59:36 +01:00
|
|
|
(define-prefix-command 'boon-goto-map)
|
2016-09-10 20:28:02 +02:00
|
|
|
(set-keymap-parent boon-goto-map goto-map)
|
2019-08-25 09:32:43 +02:00
|
|
|
(set-keymap-parent boon-goto-map goto-map)
|
2016-09-10 20:28:02 +02:00
|
|
|
|
|
|
|
(define-key boon-goto-map "l" 'goto-line)
|
|
|
|
(define-key boon-goto-map "." 'find-tag)
|
|
|
|
|
|
|
|
(define-key boon-x-map "x" 'execute-extended-command)
|
2019-05-24 09:49:20 +02:00
|
|
|
(define-key boon-x-map "n" 'boon-narrow)
|
|
|
|
(define-key boon-x-map "N" 'widen)
|
2016-02-02 21:55:22 +01:00
|
|
|
|
2016-08-29 20:10:07 +02:00
|
|
|
(define-key boon-select-map "@" 'boon-select-occurences)
|
|
|
|
(define-key boon-select-map "#" 'boon-select-all)
|
2015-11-30 23:22:50 +01:00
|
|
|
(define-key boon-select-map " " 'boon-select-line)
|
2016-08-29 20:10:07 +02:00
|
|
|
(define-key boon-moves-map "'" 'boon-switch-mark)
|
2016-10-30 09:48:03 +01:00
|
|
|
(define-key boon-moves-map (kbd "<left>") 'left-char)
|
|
|
|
(define-key boon-moves-map (kbd "<right>") 'right-char)
|
|
|
|
(define-key boon-moves-map (kbd "<up>") 'previous-line)
|
|
|
|
(define-key boon-moves-map (kbd "<down>") 'next-line)
|
2015-11-30 23:22:50 +01:00
|
|
|
|
2016-08-29 20:10:07 +02:00
|
|
|
(define-key boon-command-map "'" 'boon-toggle-mark)
|
2014-10-19 22:29:29 +02:00
|
|
|
(define-key boon-command-map [(return)] 'undefined)
|
2014-10-29 20:31:03 +01:00
|
|
|
(define-key boon-command-map (kbd "<RET>") 'undefined)
|
2014-10-19 22:29:29 +02:00
|
|
|
(define-key boon-command-map [(backspace)] 'undefined)
|
2018-01-07 13:21:49 +01:00
|
|
|
(define-key boon-command-map (kbd "<DEL>") 'undefined)
|
2014-10-19 22:29:29 +02:00
|
|
|
(define-key boon-command-map "`" 'boon-toggle-case)
|
2019-09-01 14:39:57 +02:00
|
|
|
(define-key boon-moves-map "[" '("[-" . boon-navigate-backward))
|
|
|
|
(define-key boon-moves-map "]" '("-]" . boon-navigate-forward))
|
2014-10-19 23:01:11 +02:00
|
|
|
|
2015-12-11 20:38:53 +01:00
|
|
|
(define-key boon-command-map "!" 'shell-command)
|
|
|
|
(define-key boon-command-map "|" 'shell-command-on-region)
|
2014-10-19 22:29:29 +02:00
|
|
|
(define-key boon-command-map "-" 'undo)
|
2016-08-14 22:21:07 +02:00
|
|
|
(dolist (number '("0" "1" "2" "3" "4" "5" "6" "7" "8" "9"))
|
2016-08-27 20:30:47 +02:00
|
|
|
(define-key boon-command-map number 'digit-argument))
|
2017-01-09 21:23:07 +01:00
|
|
|
(define-key boon-command-map "~" 'universal-argument)
|
2016-08-14 22:21:07 +02:00
|
|
|
|
2014-10-19 22:29:29 +02:00
|
|
|
(define-key boon-command-map " " 'boon-drop-mark)
|
2016-11-06 16:06:44 +01:00
|
|
|
(define-key boon-command-map [escape] 'boon-quit)
|
2014-10-19 13:59:12 +02:00
|
|
|
|
2016-08-30 20:43:19 +02:00
|
|
|
;; Special mode rebinds
|
|
|
|
(define-key boon-special-map "`" 'boon-quote-character)
|
|
|
|
(define-key boon-special-map "'" 'boon-quote-character)
|
|
|
|
(define-key boon-special-map "x" boon-x-map)
|
2016-11-08 22:01:11 +01:00
|
|
|
(define-key boon-special-map [escape] 'boon-set-command-state)
|
2015-12-28 22:21:33 +01:00
|
|
|
|
2014-10-19 22:29:29 +02:00
|
|
|
;; Insert mode rebinds
|
|
|
|
(define-key boon-insert-map [remap newline] 'boon-newline-dwim)
|
2016-11-06 16:06:44 +01:00
|
|
|
(define-key boon-insert-map [escape] 'boon-set-command-state)
|
2014-10-19 13:59:12 +02:00
|
|
|
|
2014-10-19 22:29:29 +02:00
|
|
|
;; Global rebinds
|
2014-10-19 13:59:12 +02:00
|
|
|
(define-key global-map [escape] 'keyboard-quit)
|
2019-04-29 21:22:04 +02:00
|
|
|
(define-key minibuffer-local-map [escape] 'keyboard-quit)
|
|
|
|
(define-key minibuffer-local-ns-map [escape] 'keyboard-quit)
|
|
|
|
(define-key minibuffer-local-completion-map [escape] 'keyboard-quit)
|
|
|
|
(define-key minibuffer-local-must-match-map [escape] 'keyboard-quit)
|
2014-10-19 13:59:12 +02:00
|
|
|
(define-key isearch-mode-map [escape] 'isearch-abort)
|
|
|
|
|
2016-08-31 21:58:55 +02:00
|
|
|
|
2014-10-19 14:17:46 +02:00
|
|
|
(provide 'boon-keys)
|
|
|
|
;;; boon-keys.el ends here
|