(Try to) homogenize TAB/RET/ESC keybinds

Map them to \t/^M/^[, rather than [tab], [return] and [escape].
This commit is contained in:
Henrik Lissner 2019-03-07 23:17:43 -05:00
parent b9a036a96c
commit 1f23eecdc8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 37 additions and 41 deletions

View file

@ -38,10 +38,7 @@
(add-to-list 'company-frontends 'company-tng-frontend)
(define-key! company-active-map
"RET" nil
[return] nil
"TAB" #'company-select-next
[tab] #'company-select-next
"<backtab>" #'company-select-previous
[backtab] #'company-select-previous))

View file

@ -21,7 +21,7 @@
[remap find-tag] #'projectile-find-tag
;; Smart tab
:i [tab] (general-predicate-dispatch nil ; fall back to nearest keymap
:i "TAB" (general-predicate-dispatch nil ; fall back to nearest keymap
(and (featurep! :feature snippets)
(bound-and-true-p yas-minor-mode)
(yas-maybe-expand-abbrev-key-filter 'yas-expand))
@ -29,17 +29,13 @@
(and (featurep! :completion company +tng)
(+company-has-completion-p))
'+company/complete)
:n [tab] (general-predicate-dispatch nil
(derived-mode-p 'magit-mode)
'magit-section-toggle
(derived-mode-p 'deadgrep-mode)
'deadgrep-toggle-file-results
:n "TAB" (general-predicate-dispatch nil
(and (featurep! :editor fold)
(save-excursion (end-of-line) (invisible-p (point))))
'+fold/toggle
(fboundp 'evilmi-jump-items)
'evilmi-jump-items)
:v [tab] (general-predicate-dispatch nil
:v "TAB" (general-predicate-dispatch nil
(and (bound-and-true-p yas-minor-mode)
(or (eq evil-visual-selection 'line)
(and (fboundp 'evilmi-jump-items)
@ -308,7 +304,7 @@
"C-S-s" (cond ((featurep! :completion helm) #'helm-company)
((featurep! :completion ivy) #'counsel-company))
"C-SPC" #'company-complete-common
[tab] #'company-complete-common-or-cycle
"TAB" #'company-complete-common-or-cycle
[backtab] #'company-select-previous)
(:map company-search-map ; applies to `company-filter-map' too
"C-n" #'company-select-next-or-abort
@ -316,9 +312,9 @@
"C-j" #'company-select-next-or-abort
"C-k" #'company-select-previous-or-abort
"C-s" (λ! (company-search-abort) (company-filter-candidates))
[escape] #'company-search-abort)
"ESC" #'company-search-abort)
;; TAB auto-completion in term buffers
:map comint-mode-map [tab] #'company-complete))
:map comint-mode-map "TAB" #'company-complete))
(:when (featurep! :completion ivy)
(:map (help-mode-map helpful-mode-map)
@ -357,7 +353,7 @@
"C-s" #'helm-minibuffer-history
"C-b" #'backward-word
;; Swap TAB and C-z
[tab] #'helm-execute-persistent-action
"TAB" #'helm-execute-persistent-action
"C-z" #'helm-select-action)
(:after swiper-helm
:map swiper-helm-keymap [backtab] #'helm-ag-edit)
@ -394,9 +390,9 @@
:after neotree
:map neotree-mode-map
:n "g" nil
:n [tab] #'neotree-quick-look
:n [return] #'neotree-enter
:n [backspace] #'evil-window-prev
:n "TAB" #'neotree-quick-look
:n "RET" #'neotree-enter
:n "DEL" #'evil-window-prev
:n "c" #'neotree-create-node
:n "r" #'neotree-rename-node
:n "d" #'neotree-delete-node
@ -562,7 +558,7 @@
((featurep! :completion helm) #'+helm/project-search)))
(:when (featurep! :feature workspaces)
(:prefix ([tab] . "workspace")
(:prefix ("TAB" . "workspace")
:desc "Display tab bar" "TAB" #'+workspace/display
:desc "New workspace" "n" #'+workspace/new
:desc "Load workspace from file" "l" #'+workspace/load

View file

@ -132,7 +132,9 @@
(defun +default|setup-input-decode-map ()
"Ensure TAB and [tab] are treated the same in TTY Emacs."
(define-key input-decode-map (kbd "TAB") [tab]))
(define-key input-decode-map [tab] (kbd "TAB"))
(define-key input-decode-map [return] (kbd "RET"))
(define-key input-decode-map [escape] (kbd "ESC")))
(add-hook 'tty-setup-hook #'+default|setup-input-decode-map)
;; A Doom convention where C-s on popups and interactive searches will invoke
@ -178,8 +180,8 @@
:g "s-/" (λ! (save-excursion (comment-line 1)))
:n "s-/" #'evil-commentary-line
:v "s-/" #'evil-commentary
:gni [s-return] #'+default/newline-below
:gni [s-S-return] #'+default/newline-above
:gni "s-RET" #'+default/newline-below
:gni "s-S-RET" #'+default/newline-above
:gi [s-backspace] #'doom/backward-kill-to-bol-and-indent
:gi [s-left] #'doom/backward-to-bol-or-indent
:gi [s-right] #'doom/forward-to-last-non-comment-or-eol

View file

@ -84,6 +84,7 @@ It is passed a user and repository name.")
"%" #'magit-gitflow-popup)
;; Don't use ESC to close magit
(evil-define-key* 'normal magit-mode-map [escape] nil)
(evil-define-key* 'normal magit-status-mode-map (kbd "TAB") #'magit-section-toggle)
(after! git-rebase
(dolist (key '(("M-k" . "gk") ("M-j" . "gj")))
(when-let* ((desc (assoc (car key) evil-magit-rebase-commands-w-descriptions)))