This is my private configuration file of doom emacs.
Some functionality uses this to identify you, e.g. GPG configuration, email clients, file templates and snippets. It is optional.
(setq user-full-name "ycpeng"
user-mail-address "[email protected]")
(add-to-list 'default-frame-alist '(fullscreen . maximized))
;;(set-frame-parameter nil 'alpha 90)
;;(add-to-list 'default-frame-alist '(alpha. 90))
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.
;; (setq doom-theme 'doom-plain-dark)
(setq doom-theme 'spacemacs-dark)
(unless (equal "Battery status not available"
(battery))
(display-battery-mode 1))
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 "~/")
(setq confirm-kill-emacs nil)
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 'relative)
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-symbol-font – for symbols doom-serif-font – for the ‘fixed-pitch-serif’ face See ‘C-h v doom-font’ for documentation and more examples of what they accept.
;; (setq doom-font (font-spec :family "JetBrainsMono Nerd Font" :size 14))
;; (setq doom-font (font-spec :family "BigBlueTerm437 Nerd Font Mono" :size 14))
;; (setq doom-font (font-spec :family "GohuFont uni14 Nerd Font Mono" :size 14))
(setq doom-font (font-spec :family "MesloLGS Nerd Font Mono" :size 14))
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!
Quickly press ‘jj’ to quickly quit Insert mode of vim
(setq-default evil-escape-delay 0.2)
(setq-default evil-escape-key-sequence "jj")
Enable org-bullets mode
(require 'org-bullets)
(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))
Enable dirvish
(use-package dirvish
:init
(dirvish-override-dired-mode)
:config
(setq dirvish-mode-line-format
'(:left (sort symlink) :right (omit yank index)))
(setq dirvish-mode-line-height 10)
(setq dirvish-hide-details nil)
(setq dirvish-attributes
'(vc-state nerd-icons subtree-state file-size file-time))
(setq dirvish-preview-dispatchers
(cl-substitute 'pdf-preface 'pdf dirvish-preview-dispatchers))
(setq dirvish-subtree-state-style 'nerd)
(setq delete-by-moving-to-trash t)
(setq dirvish-path-separators (list
(format " %s " (nerd-icons-codicon "nf-cod-home"))
(format " %s " (nerd-icons-codicon "nf-cod-root_folder"))
(format " %s " (nerd-icons-faicon "nf-fa-angle_right"))))
(setq dired-listing-switches
"-l --almost-all --human-readable --group-directories-first --no-group")
(dirvish-peek-mode) ; Preview files in minibuffer
(dirvish-side-follow-mode)) ; similar to `treemacs-follow-mode'
Enable all-the-icons
;; (use-package all-the-icons
;; :if
;; (display-graphic-p)
;; :config
;; (set-fontset-font t 'unicode (font-spec :family "all-the-icons") nil 'append)
;; (set-fontset-font t 'unicode (font-spec :family "file-icons") nil 'append)
;; (set-fontset-font t 'unicode (font-spec :family "Material Icons") nil 'append)
;; (set-fontset-font t 'unicode (font-spec :family "github-octicons") nil 'append)
;; (set-fontset-font t 'unicode (font-spec :family "FontAwesome") nil 'append)
;; (set-fontset-font t 'unicode (font-spec :family "Weather Icons") nil 'append))
Enable dashboard
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook)
(page-break-lines-mode)
:custom
(dashboard-center-content t)
(dashboard-vertically-center-content t)
(dashboard-display-icons-p t)
(dashboard-icon-type 'nerd-icons)
(dashboard-set-heading-icons t)
;; (dashboard-startup-banner 'logo)
(dashboard-startup-banner "~/.doom.d/assets/ycpeng.txt")
(dashboard-set-file-icons t)
;; (dashboard-page-separator "\n\f\n")
(dashboard-projects-backend 'projectile)
(dashboard-items '((recents . 5)
(bookmarks . 5)
(projects . 5)
(agenda . 5)))
(dashboard-banner-logo-title "Welcome to ycpeng's Emacs~")
(dashboard-footer-messages '("While any text editor can save your files, only Emacs can save your soul.")))
configure initial-buffer-choice to show Dashboard in frames created with “emacsclient -c”
(setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
Enable nerd-icons-ibuffer
(use-package nerd-icons-ibuffer
:ensure t
:hook (ibuffer-mode . nerd-icons-ibuffer-mode)
:config
(setq nerd-icons-ibuffer-icon t)
(setq nerd-icons-ibuffer-color-icon t))
Enable projectile
(projectile-mode +1)
;; Recommended keymap prefix on macOS
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
;; Recommended keymap prefix on Windows/Linux
;; (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
Enable ibuffer-projectile
(add-hook 'ibuffer-hook
(lambda ()
(ibuffer-projectile-set-filter-groups)
(unless (eq ibuffer-sorting-mode 'alphabetic)
(ibuffer-do-sort-by-alphabetic))))
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,
You can also try ‘gd’ (or ‘C-c c d’) to jump to their definition and see how they are implemented.