Files
dotfiles/doom.d/config.org
oreodave d18d7467b1 +Warning level to emergency
This is due to this weird org error I keep getting when booting doom.
Didn't get a fix so this is the closest thing to it.
2019-08-05 02:56:15 +01:00

6.7 KiB

Oreodave's emacs configuration

Preclude

This is my Doom Emacs configuration, which I try to use for as many things as possibe. It is currently my main C# and Python editor but hopefully it will become my C one soon!

Keybinds and tricks

Bind Use
<C-c '> to edit a src block in org
<C-c C-o> when in a counsel buffer to read the buffer results into another buffer, so you can read it and do normal vim stuff with it
<C-c C-p> when in a results buffer to edit results buffer. You can edit specific items or the entire thing using a regex. Incredibly useful

Global variables

(setq doom-localleader-key ",")
(setq projectile-tags-command "exctags -Re --exclude=Makefile --exclude=node_modules --exclude=bin --exclude=obj --exclude=dist")
(setq warning-minimum-level :emergency)
  • '<SPC>m' is right next to ',', so may as well use one tap instead of two
  • Projectile tags commands

Theming

(load-theme 'doom-molokai t)

I like monokai :)

General keymap

(map!
 :leader
 :desc   "M-x"                "<SPC>" 'counsel-M-x
 :desc   "Indent"             "j"     'indent-region
 :desc   "Open calendar"      "rc"    '(lambda() (interactive) (find-file "~/Text/calendar.org"))
 :desc   "Open project files" "pf"    'projectile-find-file
                                        ; Redefine <SPC><SPC> as M-x rather than find-file because of my muscle memory with spacemacs
                                        ; General maps like <SPC>j for indenting because I don't know what else to bind them to
                                        ; <SPC>pf => project -> find file
 (:prefix "/" ; Search
   :desc "Ag!"                "a"     '+ivy/ag
   :desc "FZF!"               "f"     'counsel-fzf
   :desc "RipGrep!"           "r"     'counsel-rg
   :desc "Search Tags"        "t"     'counsel-etags-list-tag
   :desc "Search buffer"      "/"     'swiper
   )
                                        ; I like using <SPC>/ in comparison to <SPC>s: it's closer together (thus quicker, I do searches a lot so this is noticeable) and makes more sense
                                        ; Ag is actually insanely useful, especially at a quick keybind
                                        ; <SPC>// is quicker to do than <SPC>/b, for something that is done so often

 (:prefix "w" ; Windows
   :desc "Close window"       "d"     '+workspace/close-window-or-workspace
   :desc "Switch window"      "W"     'ace-window
   )
                                        ; <SPC>wd is slightly closer together than <SPC>wc
                                        ; <SPC>wd is also used in spacemacs so I'd rather use this
                                        ; <SPC>wW allows me to switch windows more efficiently than before, better than just motions

 (:prefix "b"
   :desc "Close buffer"       "d"     'doom/kill-this-buffer-in-all-windows
   )
                                        ; <SPC>bd is used for the same reasons as above

 (:prefix "p"
   :desc "Regen tags"         "g"     'projectile-regenerate-tags
   )
 )
; <SPC>pg for regenning tags is useful when searching them

Plugins and Packages

Elcord

(after! elcord
  (elcord-mode)
  )

I like displaying that I'm working on discord, though not very useful. May delete.

Languages

C#

(after! csharp-mode
  (setq omnisharp-server-executable-path "~/bin/omnisharp/run")
  (add-hook 'csharp-mode-hook '(lambda() (setq c-basic-offset 4))) ; Hook for csharp setting variables

  (map! ; CSharp Keybinds
   :map csharp-mode-map
   :localleader
   :desc   "Format buffer"  "="    'omnisharp-code-format-entire-file
   (:prefix "t"
     :desc "Unit Test This" "t"   'omnisharp-unit-test-at-point
     :desc "Unit Test Last" "l"   'omnisharp-unit-test-last
     :desc "Unit Test All"  "b"   'omnisharp-unit-test-buffer
     )
   )
  )
  • I have custom installed the omnisharp roslyn executable, so I'd rather use that
  • C# code is better at 4 space indents, but I indent most of my C code at 2 space indents because it looks nicer :)
  • Currently the Doom Emacs keybinds are not working for C# Unit-tests so I had to do them myself
  • I find these keybinds to be more mnemonic (,mtt => Test -> This)

Python

(after! python
  (setq python-version-checked t)
  (setq python-python-command "python3")
  (setq python-shell-interpreter "python3")
  (setq flycheck-python-pycompile-executable "python3")

  (map! ; Python keybinds
   :map python-mode-map
   :localleader
   :desc "Start python minor" "c" 'run-python
   :desc "Format buffer"      "=" 'py-yapf-buffer
   (:prefix "s"
     :desc "Send region REPL" "r" 'python-shell-send-region
     :desc "Send buffer"      "b" 'python-shell-send-buffer
     :desc "Send function"    "f" 'python-shell-send-defun
     )
   )
  )
  • I do python development for Python3 (who doesn't?), so I need to set the flycheck python checker, as well as the interpreter, to be Python3
  • Python keybinds
  • Most of my python work is in scripts or ideas, so I don't need extensive testing utilities or anything like that
  • I run my python code a LOT and thus need commands for sending bits or whole scripts into the REPL

JavaScript/TypeScript

(after! typescript-mode
  (setq typescript-indent-level 2)
  (setq tide-format-options '(:indentSize 2 :tabSize 2))
  (map!
   :localleader
   :map typescript-mode-map
   :desc "Format code" "=" 'tide-format
   )
  )
  • Typescript (in my opinion) should be indented by 2
  • I like having one keybind to format a file, thus need to rebind

Org

(after! org
  (map! ; Org keybinds
   :map org-mode-map
   :localleader
   :desc "Org dispatch" "ee" 'org-export-dispatch
   )
  )

I like using the org dispatch facilities more than the default export keybinds in Doom, so I need this binding