You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
328 lines
12 KiB
EmacsLisp
328 lines
12 KiB
EmacsLisp
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
|
|
|
|
;; Place your private configuration here! Remember, you do not need to run 'doom
|
|
;; sync' after modifying this file!
|
|
|
|
(require 'site-gentoo)
|
|
(require-theme 'spacemacs-theme)
|
|
|
|
;; Some functionality uses this to identify you, e.g. GPG configuration, email
|
|
;; clients, file templates and snippets. It is optional.
|
|
;; (load-theme 'spamcemacs-dark t)
|
|
;; (use-package spacemacs-theme
|
|
;; :config
|
|
;; (load-theme 'spacemacs-dark t))
|
|
(setq user-full-name (getenv "CONFIG_FULL_NAME")
|
|
user-mail-address (getenv "CONFIG_EMAIL_ADDRESS"))
|
|
|
|
(setq doom-font (font-spec :family "JetBrains Mono Nerd Font" :size 14 :weight 'semibold)
|
|
doom-big-font (font-spec :family "JetBrains Mono Nerd Font" :size 28 :weight 'bold)
|
|
doom-serif-font (font-spec :family "JetBrains Mono Nerd Font" :size 14 :weight 'bold))
|
|
;; (setq doom-font "JetBrains Mono Nerd Font")
|
|
;; Doom exposes five (optional) variables for controlling fonts in Doom:
|
|
;;
|
|
;; - `doom-font' -- the primary font to use
|
|
;; - `doom-variable-pitch-font' -- a non-monospace font (where applicable)
|
|
;; - `doom-big-font' -- used for `doom-big-font-mode'; use this for
|
|
;; presentations or streaming.
|
|
;; - `doom-unicode-font' -- for unicode glyphs
|
|
;; - `doom-serif-font' -- for the `fixed-pitch-serif' face
|
|
;;
|
|
;; See 'C-h v doom-font' for documentation and more examples of what they
|
|
;; accept. For example:
|
|
;;
|
|
;;(setq doom-font (font-spec :family "Fira Code" :size 12 :weight 'semi-light)
|
|
;; doom-variable-pitch-font (font-spec :family "Fira Sans" :size 13))
|
|
;;
|
|
;; If you or Emacs can't find your font, use 'M-x describe-font' to look them
|
|
;; up, `M-x eval-region' to execute elisp code, and 'M-x doom/reload-font' to
|
|
;; refresh your font settings. If Emacs still can't find your font, it likely
|
|
;; wasn't installed correctly. Font issues are rarely Doom issues!
|
|
|
|
;; There are two ways to load a theme. Both assume the theme is installed and
|
|
;; available. You can either set `doom-theme' or manually load a theme with the
|
|
;; `load-theme' function. This is the default:
|
|
(setq doom-theme 'spacemacs-dark)
|
|
;; (use-package spacemacs-theme-dark
|
|
;; :ensure t
|
|
;; :config
|
|
;; (load-theme 'spacemacs-dark-theme t))
|
|
;; This determines the style of line numbers in effect. If set to `nil', line
|
|
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
|
(setq display-line-numbers-type t)
|
|
|
|
;; If you use `org' and don't want your org files in the default location below,
|
|
;; change `org-directory'. It must be set before org loads!
|
|
(setq org-directory "~/org/")
|
|
(setq projectile-project-search-path '("~/Projects/"))
|
|
|
|
;; Whenever you reconfigure a package, make sure to wrap your config in an
|
|
;; `after!' block, otherwise Doom's defaults may override your settings. E.g.
|
|
;;
|
|
;; (after! PACKAGE
|
|
;; (setq x y))
|
|
;;
|
|
;; The exceptions to this rule:
|
|
;;
|
|
;; - Setting file/directory variables (like `org-directory')
|
|
;; - Setting variables which explicitly tell you to set them before their
|
|
;; package is loaded (see 'C-h v VARIABLE' to look up their documentation).
|
|
;; - Setting doom variables (which start with 'doom-' or '+').
|
|
;;
|
|
;; Here are some additional functions/macros that will help you configure Doom.
|
|
;;
|
|
;; - `load!' for loading external *.el files relative to this one
|
|
;; - `use-package!' for configuring packages
|
|
;; - `after!' for running code after a package has loaded
|
|
;; - `add-load-path!' for adding directories to the `load-path', relative to
|
|
;; this file. Emacs searches the `load-path' when you load packages with
|
|
;; `require' or `use-package'.
|
|
;; - `map!' for binding new keys
|
|
;;
|
|
;; To get information about any of these functions/macros, move the cursor over
|
|
;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
|
|
;; This will open documentation for it, including demos of how they are used.
|
|
;; Alternatively, use `C-h o' to look up a symbol (functions, variables, faces,
|
|
;; etc).
|
|
;;
|
|
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
|
|
;; they are implemented.
|
|
(require 'ansi-color)
|
|
(require 'dap-cpptools)
|
|
(require 'helm-make)
|
|
;; Indenting, formatting, etc
|
|
;; Universal (all langs)
|
|
(map! :leader
|
|
:desc "Comment/Uncomment"
|
|
"/" #'comment-line)
|
|
(map! :leader
|
|
:desc "Search project for text"
|
|
"s /" #'+default/search-project)
|
|
(with-eval-after-load 'evil
|
|
(map!
|
|
(:prefix "g"
|
|
:desc "New line after comment block" :n "o" #'+default/newline-below)))
|
|
(with-eval-after-load 'evil
|
|
(map!
|
|
(:prefix "g"
|
|
:desc "New line after comment block" :n "O" #'+default/newline-above)))
|
|
;; C/C++
|
|
(c-add-style "penguin"
|
|
'("stroustrup"
|
|
(c-offsets-alist
|
|
(innamespace . -)
|
|
(inline-open . 0)
|
|
(inher-cont . c-lineup-multi-inher)
|
|
(arglist-cont-nonempty . +)
|
|
(template-args-cont . +))))
|
|
|
|
(defun penguin-c-hook()
|
|
(setq +format-with-lsp nil)
|
|
(map!
|
|
:leader
|
|
:prefix "p"
|
|
:desc "Compile project" :n "c" #'helm-make-projectile)
|
|
(map!
|
|
:leader
|
|
:prefix "c"
|
|
:desc "Compile project" :n "c" #'helm-make-projectile)
|
|
(map!
|
|
:leader
|
|
:prefix "c"
|
|
:desc "List project errors" :n "x" #'lsp-treemacs-errors-list)
|
|
(c-set-style "penguin")
|
|
(c-set-offset 'case-label '+)
|
|
(c-set-offset 'arglist-intro '+)
|
|
(setq lsp-headerline-breadcrumb-enable 't))
|
|
(add-hook 'c-mode-hook 'penguin-c-hook)
|
|
(add-hook 'c++-mode-hook 'penguin-c-hook)
|
|
(add-hook 'after-change-major-mode-hook
|
|
(lambda ()
|
|
(modify-syntax-entry ?_ "w")))
|
|
|
|
;; Markdown
|
|
(add-hook 'text-mode-hook
|
|
#'(lambda ()
|
|
(setq indent-tabs-mode nil)
|
|
(setq tab-width 4)))
|
|
;; Rust
|
|
(after! rustic
|
|
(setq lsp-rust-server 'rust-analyzer))
|
|
(setq lsp-rust-analyzer-cargo-watch-command "clippy")
|
|
(setq lsp-eldoc-render-all t)
|
|
(setq lsp-idle-delay 0.6)
|
|
(setq lsp-rust-analyzer-server-display-inlay-hints t)
|
|
(setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial")
|
|
(setq lsp-rust-analyzer-display-chaining-hints t)
|
|
(setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil)
|
|
(setq lsp-rust-analyzer-display-closure-return-type-hints t)
|
|
(setq lsp-rust-analyzer-display-parameter-hints nil)
|
|
(setq lsp-rust-analyzer-display-reborrow-hints nil)
|
|
|
|
(setq dap-auto-configure-mode t)
|
|
(map! :map dap-mode-map
|
|
:leader
|
|
:prefix ("d" . "dap")
|
|
;; basics
|
|
:desc "dap next" "n" #'dap-next
|
|
:desc "dap step in" "i" #'dap-step-in
|
|
:desc "dap step out" "o" #'dap-step-out
|
|
:desc "dap continue" "c" #'dap-continue
|
|
:desc "dap hydra" "h" #'dap-hydra
|
|
:desc "dap debug restart" "r" #'dap-debug-restart
|
|
:desc "dap debug" "s" #'dap-debug
|
|
|
|
;; debug
|
|
:prefix ("dd" . "Debug")
|
|
:desc "dap debug recent" "r" #'dap-debug-recent
|
|
:desc "dap debug last" "l" #'dap-debug-last
|
|
|
|
;; eval
|
|
:prefix ("de" . "Eval")
|
|
:desc "eval" "e" #'dap-eval
|
|
:desc "eval region" "r" #'dap-eval-region
|
|
:desc "eval thing at point" "s" #'dap-eval-thing-at-point
|
|
:desc "add expression" "a" #'dap-ui-expressions-add
|
|
:desc "remove expression" "d" #'dap-ui-expressions-remove
|
|
|
|
:prefix ("db" . "Breakpoint")
|
|
:desc "dap breakpoint toggle" "b" #'dap-breakpoint-toggle
|
|
:desc "dap breakpoint condition" "c" #'dap-breakpoint-condition
|
|
:desc "dap breakpoint hit count" "h" #'dap-breakpoint-hit-condition
|
|
:desc "dap breakpoint log message" "l" #'dap-breakpoint-log-message)
|
|
|
|
(after! org
|
|
(setq org-todo-keywords
|
|
'((sequence "TODO(t)" "PROJ(p)" "BLOCKED(b)" "WIP(w)" "|" "KILL(k)" "DONE(d)"))))
|
|
|
|
(setq x-super-keysym 'meta)
|
|
(defhydra doom-window-resize-hydra (:hint nil)
|
|
"
|
|
_k_ increase height _<up>_ increase height
|
|
_h_ decrease width _l_ increase width _<left>_ decrease width _<right>_ increase width
|
|
_j_ decrease height _<down>_ decrease height
|
|
S-arrow key to shift by 5
|
|
"
|
|
("h" evil-window-decrease-width)
|
|
("j" evil-window-increase-height)
|
|
("k" evil-window-decrease-height)
|
|
("l" evil-window-increase-width)
|
|
("<left>" evil-window-decrease-width)
|
|
("<up>" evil-window-increase-height)
|
|
("<down>" evil-window-decrease-height)
|
|
("<right>" evil-window-increase-width)
|
|
("<S-left>" (evil-window-decrease-width 20))
|
|
("<S-up>" (evil-window-increase-height 20))
|
|
("<S-down>" (evil-window-decrease-height 20))
|
|
("<S-right>" (evil-window-increase-width 20))
|
|
|
|
("q" nil))
|
|
(map!
|
|
(:leader
|
|
:prefix "w"
|
|
:desc "Hydra resize" :n "SPC" #'doom-window-resize-hydra/body))
|
|
;; (map! :leader
|
|
;; "f p" nil
|
|
;; "f P" nil)
|
|
(map!
|
|
:leader
|
|
:prefix "f"
|
|
:desc "Open doom config" "p" #'doom/open-private-config)
|
|
(setq evil-split-window-below t)
|
|
|
|
|
|
(defun penguin-helm-posframe-size-function ()
|
|
"The default functon used by `helm-posframe-size-function'."
|
|
(list
|
|
:width (/ (frame-width) 2)
|
|
:height (or helm-posframe-height helm-display-buffer-height)
|
|
:min-height (or helm-posframe-min-height
|
|
(let ((height (+ helm-display-buffer-height 1)))
|
|
(min height (or helm-posframe-height height))))
|
|
:min-width (or helm-posframe-min-width
|
|
(let ((width (round (* (frame-width) 0.62))))
|
|
(min width (or helm-posframe-width width))))))
|
|
|
|
(setq helm-posframe-size-function #'penguin-helm-posframe-size-function)
|
|
(defun penguin-reload-dir-locals-for-current-buffer ()
|
|
"reload dir locals for the current buffer"
|
|
(interactive)
|
|
(let ((enable-local-variables :all))
|
|
(hack-dir-local-variables-non-file-buffer)))
|
|
(defun penguin-reload-dir-locals-for-all-buffer-in-this-directory ()
|
|
"For every buffer with the same `default-directory` as the
|
|
current buffer's, reload dir-locals."
|
|
(interactive)
|
|
(let ((dir default-directory))
|
|
(dolist (buffer (buffer-list))
|
|
(with-current-buffer buffer
|
|
(when (equal default-directory dir)
|
|
(penguin-reload-dir-locals-for-current-buffer))))))
|
|
;; fix compilation buffer error which wouldn't let me jump to errors
|
|
(add-hook 'compilation-filter-hook 'ansi-color-compilation-filter)
|
|
(setq-default evil-kill-on-visual-paste nil)
|
|
(setq lsp-treemacs-sync-mode 1)
|
|
(defun apply-lang-settings-to-open-buffers ()
|
|
"Apply C++ mode settings to open buffers."
|
|
(interactive)
|
|
(dolist (buffer (buffer-list))
|
|
(with-current-buffer buffer
|
|
(when (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode))
|
|
(penguin-c-hook)))))
|
|
(add-hook! 'doom-after-reload-hook #'apply-lang-settings-to-open-buffers)
|
|
|
|
(setq org-noter-notes-search-path '("~/Documents/notes/"))
|
|
;; (setq lsp-clangd-binary-path '("/usr/bin/clangd"))
|
|
(defun wvxvw/export-rel-url (path desc format)
|
|
(cl-case format
|
|
(html (format "<a href=\"%s\">%s</a>" path (or desc path)))
|
|
(latex (format "\\href{%s}{%s}" path (or desc path)))
|
|
(otherwise path)))
|
|
|
|
(eval-after-load "org"
|
|
'(org-link-set-parameters "rel" :follow #'browse-url :export #'wvxvw/export-rel-url))
|
|
|
|
|
|
(setq projectile-enable-caching nil)
|
|
(setq find-file-hook nil)
|
|
|
|
;; kill company completion
|
|
(with-eval-after-load 'company
|
|
(define-key company-active-map (kbd "C-k") 'company-abort))
|
|
|
|
(after! org
|
|
(setq org-agenda-files
|
|
'("~/Documents/notes/agendas")))
|
|
|
|
(after! company
|
|
(set-company-backend!
|
|
'emacs-lisp-mode
|
|
'(:separate
|
|
company-capf company-files))
|
|
(set-company-backend!
|
|
'sh-mode
|
|
'(:separate
|
|
company-capf company-shell company-files))
|
|
)
|
|
|
|
(after! org
|
|
(set-company-backend!
|
|
'org-mode
|
|
'company-capf 'company-files))
|
|
|
|
|
|
(map!
|
|
(:leader
|
|
:prefix "o"
|
|
:desc "Calendar" :n "c" #'cfw:open-org-calendar))
|
|
(add-hook 'calendar-load-hook
|
|
(lambda ()
|
|
(calendar-set-date-style 'american)))
|
|
|
|
(setq calendar-holidays
|
|
(append holiday-general-holidays holiday-local-holidays
|
|
holiday-other-holidays
|
|
holiday-solar-holidays))
|
|
|
|
(setq calendar-christian-all-holidays-flag 't)
|