!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.
This commit is contained in:
dx
2020-07-15 15:26:11 +01:00
parent 8b067497da
commit 3e7642cae1
6 changed files with 214 additions and 171 deletions

View File

@@ -36,9 +36,18 @@ For some reason, currently, the org mode keybinds aren't working.
So reload the file again until the issue is fixed.
#+BEGIN_SRC elisp
(load "~/.emacs.d/modules/lang/org/config.el")
* Package Configuration
Configuration for or based heavily around specific packages that I find very important
** Ido
Just add vimish keybindings to ido completion
#+BEGIN_SRC elisp
(map!
:map (ido-common-completion-map ido-file-completion-map ido-buffer-completion-map)
"C-k" #'ido-prev-match
"C-j" #'ido-next-match)
(setq ido-ignore-buffers '("\\` " "^\\*ESS\\*" "^\\*[Hh]elp" "^\\*.*Completions\\*$" "^\\*tramp" "^\\*cvs-" "^*Ido"))
#+END_SRC
* Package Config
Config for or based heavily around specific packages that I find very important
** DAP
*** Function
First to setup is a routine for setting up all the dap-panes for debugging.
@@ -60,56 +69,6 @@ Easier to do than just running all those functions manually
:leader
:desc "Start debugging setup" "cD" #'dx:debug)
#+END_SRC
** Dashboard
My very own dashboard config using doom dashboard, with these features:
- Custom load message
- Custom splash image and dashboard buffer name
- Custom dashboard sections for myself
*** Benchmark display
Redo the display-benchmark function to display a different message
#+BEGIN_SRC elisp
(defun doom-display-benchmark-h (&optional return-p)
"Display a benchmark, showing number of packages and modules, and how quickly
they were loaded at startup.
If RETURN-P, return the message as a string instead of displaying it."
(funcall (if return-p #'format #'message)
"εmacs loaded %d packages, %d modules in %.03fs"
(- (length load-path) (length doom--initial-load-path))
(if doom-modules (hash-table-count doom-modules) 0)
(or doom-init-time
(setq doom-init-time
(float-time (time-subtract (current-time) before-init-time))))))
#+END_SRC
*** Image and buffer name
Set the splash-image and dashboard buffer name
Space image comes from [[https://flaticon.com][website]]
#+BEGIN_SRC elisp
(setq fancy-splash-image "~/Pictures/SplashScreens/space2.png") ; splash image
(setq +doom-dashboard-name "*dashboard*")
#+END_SRC
*** Dashboard items
Set the dashboard functions (segments in overall buffer), set the sections of the interactive menu as well.
#+BEGIN_SRC elisp
(setq +doom-dashboard-functions ; limit the dashboard items
'(doom-dashboard-widget-banner
doom-dashboard-widget-loaded
doom-dashboard-widget-shortmenu))
(setq +doom-dashboard-menu-sections ; Set a specific amount of items
'(("Open org-agenda"
:icon (all-the-icons-octicon "calendar" :face 'font-lock-keyword-face)
:when (fboundp 'org-agenda)
:action org-agenda)
("Jump to bookmark"
:icon (all-the-icons-octicon "bookmark" :face 'font-lock-keyword-face)
:action bookmark-jump)
("Open project"
:icon (all-the-icons-material "folder" :face 'font-lock-keyword-face)
:action projectile-switch-project)))
#+END_SRC
** Spelling checker
Keybinds to org-mode for flyspell package
#+BEGIN_SRC elisp
@@ -373,111 +332,6 @@ General keymap
:desc "Change theme" "t" #'dx:themes/set-new-theme ; From my own collection
:desc "Generate template" "g" #'+gentemplate/generate-template) ; From my own collection
#+END_SRC
** Counsel
- Counsel keybind config
- Mostly just convenience stuff that happens to use counsel
#+BEGIN_SRC elisp
(map!
:leader
(:prefix ("s" . "search")
:desc "RipGrep!" "r" #'counsel-rg ; Ripgrep is faster than Ag in most cases and makes me feel cool
:desc "Search Tags" "t" #'counsel-etags-find-tag)); is quicker to do than <SPC>/b, for something that is done so often
#+END_SRC
** Window
- Keybinds to do with windows
- SPC wc < SPC wd
- Some ace-window config in the window keybind prefix
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("w" . "window") ; Windows
:desc "Close window" "d" #'+workspace/close-window-or-workspace ; is slightly closer together than <SPC>wc
:desc "Switch window" "w" #'ace-window ; is also used in spacemacs so I'd rather use this
:desc "Swap windows" "S" #'ace-swap-window) ; allows me to switch windows more efficiently than before, better than just motions
#+END_SRC
** Code
- Some keybinds for the code prefix which help me with coding or working with code, particularly LSP
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("c" . "code") ; Code
:desc "Compile" "c" #'compile
:desc "Recompile" "C" #'recompile
:desc "Compile via make" "m" #'+make/run
:desc "Undo tree" "u" #'undo-tree-visualize
:desc "Narrow to function" "n" #'+narrow/toggle-narrow
(:after format-all
:desc "Format code" "=" #'format-all-buffer)
(:after lsp
:desc "Format code lsp" "f" #'+default/lsp-format-region-or-buffer
:desc "Execute action" "a" #'lsp-execute-code-action)
(:after dap-mode
:desc "Debug hydra" "h" #'dap-hydra))
#+END_SRC
** Projectile
- Projectile config, for leader and for project prefix
#+BEGIN_SRC elisp
(map!
:leader
:after projectile
:desc "Switch to p-buffer" ">" #'projectile-switch-to-buffer ; Opposing <SPC>< which counsel's all buffers
(:prefix ("p" . "project")
:desc "Regen tags" "g" #'projectile-regenerate-tags
:desc "Open project files" "f" #'projectile-find-file))
#+END_SRC
** Fonts
- Fonts keybinds (prefix "z") for messing with fonts temp on a buffer
- Really useful when I need to zoom into something for whatever reason
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("z" . "font") ; Fonts
:desc "Increase font" "+" #'doom/increase-font-size
:desc "Decrease font" "-" #'doom/decrease-font-size
:desc "Adjust font" "z" #'text-scale-adjust)
#+END_SRC
** Frames
- Keybinds for frame manipulation:
- Generate new frames from current buffer
- Generate new frames from a specific buffer
- Delete frames
- Switch frames
#+BEGIN_SRC elisp
(map!
:leader
:prefix ("F" . "frame") ; Frames
:desc "Kill frame" "d" #'delete-frame
:desc "Current buffer frame" "m" #'make-frame
:desc "Choose Buffer frame" "n" #'display-buffer-other-frame
:desc "Switch frames" "o" #'other-frame)
#+END_SRC
** Misc Leader
Miscellaneous leader bindings that don't really fit into any particular item
#+BEGIN_SRC elisp
(map!
:leader
:desc "M-x" "SPC" #'execute-extended-command ; Redefine as M-x because of my muscle memory with spacemacs
:desc "Shell command" "!" #'async-shell-command ; Better than M-!
:desc "Open eshell" "T" #'eshell
(:prefix ("b" . "buffers")
:desc "Close buffer" "d" #'doom/kill-this-buffer-in-all-windows)
(:prefix ("f" . "files")
:desc "Recent files" "r" #'counsel-recentf
:desc "Find in dotfiles" "p" #'(lambda () (interactive) (doom-project-find-file "~/Dotfiles")))
(: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)))))
#+END_SRC
** Non-leader
Non-leader bindings for text-based commands.
#+BEGIN_SRC elisp
(map!
:n "TAB" #'evil-jump-item
:n "M-v" #'dx:newline
:n "M-V" #'(lambda () (interactive) (dx:newline 1))
:v "M-c" #'count-words-region
:n "M-s" #'occur)
#+END_SRC
** Remaps
Adding a new configuration option.
Remapping functions that other modules set to default functions.
@@ -485,3 +339,10 @@ Remapping functions that other modules set to default functions.
(define-key!
[remap compile] #'compile)
#+END_SRC
** Non-leader
Non-leader bindings for text-based commands.
#+BEGIN_SRC elisp
(map!
"M-v" #'dx:newline
"M-V" #'(lambda () (interactive) (dx:newline 1)))
#+END_SRC