Files
dotfiles/Doom/.doom.d/modules/private/bindings/README.org
dx 3e7642cae1 !REFACTOR: cleaning doom
This refactor removes a lot of the 'training wheels' that doom
provides (i.e. no modeline, bindings, etc). Instead, I defined my own
modules and systems to help with those tasks. I am now using the default
emacs modeline, customised to my liking, as well as the default scratch
buffer as my startup page.

This basically allows me to have a finer degree of control over what my
Emacs is doing, which is great as I can remove redundant pieces that I
don't use.
2020-07-15 15:26:11 +01:00

3.6 KiB

private/bindings Literate configuration

Introduction

This is the main document for this module (private/bindings). To compile, simply execute the source code block below

(org-babel-tangle-file "README.org" "config.el")

Initial

;;; private/bindings/config.el -*- lexical-binding: t; -*-

Leader

Bindings for the leader map

Single binds

These are immediate bindings to the leader map that instantly launch functions when pressed. This binding space is reserved for stuff I use quite often.

(map!
 :leader
 "SPC" #'execute-extended-command
 "!"   #'async-shell-command
 "T"   #'eshell
 "-"   #'dired-jump
 "_"   #'dired-jump-other-window
 ";"   #'eval-expression
 "h"   #'help-command
 "w"   #'ace-window)

Files

(map!
 :leader
 :prefix "f"
 "r"  #'counsel-recentf
 "f"  #'find-file
 "p"  #'(lambda () (interactive) (doom-project-find-file "~/Dotfiles"))
 "s"  #'save-buffer
 "d"  #'dired)

Buffers

(map!
 :leader
 :prefix "b"
 "n" #'next-buffer
 "p" #'previous-buffer
 "d" #'kill-current-buffer
 "b" #'switch-to-buffer
 "i" #'ibuffer)

Search

(map!
 :leader
 :prefix "s"
 "i"  #'imenu
 (:after counsel
  "s" #'swiper
  "r" #'counsel-rg)
 (:after counsel-etags
  "t" #'counsel-etags-find-tag)
 "o"  #'+lookup/online)

Projectile

(map!
 :leader
 :after projectile
 :desc   "Switch to p-buffer" ">"     #'projectile-switch-to-buffer
 :desc   "Projects"           "p"     #'projectile-switch-project
 (:prefix ("p" . "project")
  :desc "Regen tags"          "g"     #'projectile-regenerate-tags
  :desc "Open project files"  "f"     #'projectile-find-file))

Code

(map!
 :leader
 :prefix ("c" . "code") ; Code
 :desc "Compile"            "c"       #'compile
 :desc "Compile via make"   "m"       #'+make/run
 :desc "Undo tree"          "u"       #'undo-tree-visualize
 (:after lsp
  :desc "Format code lsp"   "f"       #'+default/lsp-format-region-or-buffer
  :desc "Execute action"    "a"       #'lsp-execute-code-action))

Magit and VC

(map!
 :leader
 :prefix "g"
 "g" #'magit-status
 "c" #'magit-clone
 "f" #'magit-fetch
 "p" #'magit-pull)

Notes

(map!
 :leader
 :prefix ("n" . "notes")
 :desc  "Open notes in dired" "-"  #'(lambda () (interactive) (dired org-directory))
 :desc  "Open quicknotes"     "q"  #'(lambda () (interactive) (find-file (format "%s/qnotes.org" org-directory))))

Frames

(map!
 :leader
 :prefix "F"
 "d" #'delete-frame)

Company

(map!
 :map (company-search-map company-mode-map)
 "C-j"   #'company-select-next
 "C-k"   #'company-select-previous
 "C-SPC" #'company-complete)

Multi cursors

Setup bindings for multi cursors. As it's a motion based system, use the "gz" namespace.

(map!
 :prefix "g"
 (:prefix "z"
   "m" #'evil-mc-resume-cursors
   "p" #'evil-mc-pause-cursors
   "d" #'evil-mc-make-all-cursors
   "j" #'evil-mc-make-cursor-move-next-line
   "k" #'evil-mc-make-cursor-move-prev-line
   "z" #'evil-mc-make-cursor-at-pos))

Quit

Quit Emacs or restart it

(map!
 :prefix "q"
 "q" #'save-buffers-kill-terminal
 "r" #'doom/restart)

Remaps

(define-key!
  [remap org-goto] #'counsel-org-goto)

Misc

Misc bindings that don't fit to any other category.

(map!
 "C-x C-z" #'text-scale-adjust
 "TAB" #'evil-jump-item
 "M-c" #'count-words-region
 "M-s" #'occur)