Created
October 19, 2021 17:32
-
-
Save sedme0/3e7a41d1ce9e7a4caa5295741e01f60e to your computer and use it in GitHub Desktop.
Doom Emacs configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; I'm only uploading this because I had to rebuild it after I accidentally deleted it. | |
;; This isn't my whole config.el file, just the stuff after the defaults (hence "END OF DEFAULTS") | |
;; This isn't the most well-commented or anything, it's only public because I don't see any | |
;; reason for it not to be, if I'm going to be uploading it anyway. Also, why doesn't github support 5-space indents? | |
;; 5 spaces is obviously the best number of spaces for an indent, if you're going to use them instead of tabs. | |
;; And tabs are obviously superior to spaces for indentation. | |
;; ---------------------------------------------------------------------------- | |
;; | END OF DEFAULTS | | |
;; ---------------------------------------------------------------------------- | |
;; TODO: | |
;; -Figure out how to make treemacs open when the first file of a project is opened | |
;; -Figure out how to make electric indent not suck. Apparently it's responsible | |
;; for removing trailing whitespace. While removing the whitespace at the end | |
;; of a file is okay, removing it for individual lines is absolutely horrible | |
;; Also, it just acts weird. Maybe disable most of its features, if possible? | |
;; Or find another auto-indent solution | |
;; -See about setting up a script that saves the current cursor position when | |
;; scrolling, then reloads it when moving the cursor again, to emulate the | |
;; behavior of most modern editors. | |
;; -Figure out how to create menus in the menu bar. Maybe create a package or | |
;; module or whatever that does it for all of Doom Emacs. It would be like a training | |
;; wheels mode, and it could be called ITYTD, short for "I'm Too Young To Die", Doom's easy mode | |
;; -Find a better theme. Preferably one that's like Notepad++'s "Deep Black" since I remember really liking that. | |
;; -See about a graphical way to fold and unfold code | |
;; -Maybe create a key binding that just feels like Notepad++ or Atom, or other modern editors. | |
;; Not that I mind most of Doom Emacs's bindings, but it's confusing switching between editors. | |
;; Automatic fullscreen | |
(custom-set-variables '(initial-frame-alist (quote ((fullscreen . maximized))))) | |
;; Re-enable GUI | |
(tool-bar-mode t) | |
(menu-bar-mode t) | |
(scroll-bar-mode t) | |
;; Make it so that enter doesn't autocomplete, and tab autocompletes | |
(with-eval-after-load 'company | |
(define-key company-active-map (kbd "<return>") nil) | |
(define-key company-active-map (kbd "RET") nil) | |
(define-key company-active-map (kbd "<tab>") nil) | |
(define-key company-active-map (kbd "TAB") 'company-complete-selection) | |
) | |
;; ---------------------------------------------------------------------------- | |
;; Start of indentation configuration | |
;; ---------------------------------------------------------------------------- | |
(setq custom-tab-width 5) | |
(defun disable-tabs () | |
(setq indent-tabs-mode nil) | |
) | |
(defun enable-tabs () | |
(local-set-key (kbd "TAB") 'tab-to-tab-stop) | |
(setq indent-tabs-mode t) | |
(setq tab-width custom-tab-width) | |
(whitespace-mode t) | |
) | |
;; Enable tabs in programming mode | |
(add-hook 'prog-mode-hook 'enable-tabs) | |
;; TODO: Enable tabs for text modes, but not TeX modes because apparently that fucks shit up. Probably fucks shit in some other markup modes too. | |
;; Disable tabs in certain languages' modes | |
(add-hook 'lisp-mode-hook 'disable-tabs) | |
(add-hook 'emacs-lisp-mode-hook 'disable-tabs) | |
;; Language-Specific Tweaks | |
;; Apparently python has a standard indentation amount. | |
;;(setq-default python-indent-offset custom-tab-width) ;; Python | |
;; I don't know what the deal with JavaScript is... Wouldn't most JS devs want to use VS Code or Atom, anyways? | |
;;(setq-default js-indent-level custom-tab-width) ;; Javascript | |
;; Makes electric indent operate in an apparently sane manner. I only think it's slightly better than default. | |
(setq-default electric-indent-inhibit t) | |
;; Shift width for evil-mode users | |
;; For the vim-like motions of ">>" and "<<". | |
;; (I don't know what this actually does, but I use evil mode, so I better enable this) | |
(setq-default evil-shift-width custom-tab-width) | |
;; Visualize tabs as a pipe character - "|" | |
;; put "trailing" after "tab-mark" to make trailing whitespace red. | |
(setq whitespace-style '(face tabs tab-mark)) | |
(custom-set-faces | |
'(whitespace-tab ((t (:foreground "#636363")))) | |
) | |
(setq whitespace-display-mappings | |
'((tab-mark 9 [124 9] [92 9])) ; 124 is the ascii ID for '\|' | |
) | |
;; ---------------------------------------------------------------------------- | |
;; End of indentation configuration | |
;; ---------------------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment