Skip to content

ycpeng8/.doom.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doom Emacs Config

Table of Contents

Description

This is my private configuration file of doom emacs.

Private Config

Global Functional Settings

Set user name and email

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]")

Startup with maximized screen

(add-to-list 'default-frame-alist '(fullscreen . maximized))

Set screen transparency

;;(set-frame-parameter nil 'alpha 90)
;;(add-to-list 'default-frame-alist '(alpha. 90))

Set theme

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)

Display Battery

(unless (equal "Battery status not available"
               (battery))
  (display-battery-mode 1))

Set org default location

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 "~/")

Disable exit confirmation

(setq confirm-kill-emacs nil)

Editor Zone Settings

Display relative number

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)

Set 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-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!

Quick quit Insert mode

Quickly press ‘jj’ to quickly quit Insert mode of vim

(setq-default evil-escape-delay 0.2)
(setq-default evil-escape-key-sequence "jj")

3rd Party Packages Settings

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'
;; (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)))
(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)
(add-hook 'ibuffer-hook
    (lambda ()
      (ibuffer-projectile-set-filter-groups)
      (unless (eq ibuffer-sorting-mode 'alphabetic)
        (ibuffer-do-sort-by-alphabetic))))

Additional Tips from Doom Emacs

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published