about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-14T15·59+0000
committerVincent Ambo <tazjin@google.com>2019-12-14T15·59+0000
commit7315ca331ea36e616f8c2d63b938421596985e60 (patch)
tree12dd159277b5cbb2ed58359d632efcdefc8adf6b /tools
parent9df9fafd82a03ba0ae7b0db3edd67df44ef46a59 (diff)
chore(emacs.d): Clean up <tab> bindings r/147
One simple rule to rule them all: In prog-mode, <tab> tries to invoke
company.
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs/config/bindings.el18
-rw-r--r--tools/emacs/config/init.el11
2 files changed, 9 insertions, 20 deletions
diff --git a/tools/emacs/config/bindings.el b/tools/emacs/config/bindings.el
index f10869a532..626bdcea8e 100644
--- a/tools/emacs/config/bindings.el
+++ b/tools/emacs/config/bindings.el
@@ -1,15 +1,9 @@
-;; Various keybindings, most of them taken from starter-kit-bindings
-
 ;; Font size
 (define-key global-map (kbd "C-+") 'text-scale-increase)
 (define-key global-map (kbd "C--") 'text-scale-decrease)
 
-;; Use regex searches by default.
-(global-set-key (kbd "\C-r") 'isearch-backward-regexp)
-(global-set-key (kbd "M-%") 'query-replace-regexp)
-(global-set-key (kbd "C-M-s") 'isearch-forward)
-(global-set-key (kbd "C-M-r") 'isearch-backward)
-(global-set-key (kbd "C-M-%") 'query-replace)
+;; What does <tab> do? Well, it depends ...
+(define-key prog-mode-map (kbd "<tab>") #'company-indent-or-complete-common)
 
 ;; Counsel stuff:
 (global-set-key (kbd "C-c r g") 'counsel-rg)
@@ -24,11 +18,10 @@
 (global-set-key (kbd "C-x m") 'eshell)
 
 ;; Start a new eshell even if one is active.
-(global-set-key (kbd "C-x M") (lambda () (interactive) (eshell t)))
-
 (global-set-key (kbd "C-x p") 'ivy-browse-repositories)
 (global-set-key (kbd "M-g M-g") 'goto-line-with-feedback)
 
+;; Miscellaneous editing commands
 (global-set-key (kbd "C-c w") 'whitespace-cleanup)
 (global-set-key (kbd "C-c a") 'align-regexp)
 
@@ -36,11 +29,8 @@
 (global-set-key (kbd "C-c b p") 'browse-url-at-point)
 (global-set-key (kbd "C-c b b") 'browse-url)
 
-;; Goodness from @magnars
-;; I don't need to kill emacs that easily
-;; the mnemonic is C-x REALLY QUIT
+;; C-x REALLY QUIT (idea by @magnars)
 (global-set-key (kbd "C-x r q") 'save-buffers-kill-terminal)
-(global-set-key (kbd "C-x C-c") 'delete-frame)
 
 ;; Open Fefes Blog
 (global-set-key (kbd "C-c C-f") 'fefes-blog)
diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el
index 174c744431..d50e4baa2a 100644
--- a/tools/emacs/config/init.el
+++ b/tools/emacs/config/init.el
@@ -34,8 +34,6 @@
 
 (use-package company
   :hook ((prog-mode . company-mode))
-  :bind (:map rust-mode-map ("<tab>" . company-indent-or-complete-common)
-         :map lisp-mode-map ("<tab>" . company-indent-or-complete-common))
   :init (setq company-tooltip-align-annotations t))
 
 (use-package dash)
@@ -93,8 +91,7 @@
 (use-package f)
 
 (use-package go-mode
-  :bind (:map go-mode-map ("C-c C-r" . recompile)
-         :map go-mode-map ("<tab>" . company-indent-or-complete-common))
+  :bind (:map go-mode-map ("C-c C-r" . recompile))
   :hook ((go-mode . (lambda ()
                       (setq tab-width 2)
                       (setq-local compile-command
@@ -106,7 +103,8 @@
   :init (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode)))
 
 (use-package kotlin-mode
-  :bind (:map kotlin-mode-map ("<tab>" . indent-relative)))
+  :hook ((kotlin-mode . (lambda ()
+                          (setq indent-line-function #'indent-relative)))))
 
 (use-package lsp-mode)
 
@@ -119,7 +117,8 @@
 (use-package markdown-toc)
 
 (use-package nix-mode
-  :bind (:map nix-mode-map ("<tab>" . nix-indent-line)))
+  :hook ((nix-mode . (lambda ()
+                       (setq indent-line-function #'nix-indent-line)))))
 
 (use-package nginx-mode)
 (use-package rust-mode)