Ladicle's Emacs Configuration

Table of Contents

1 Configuration

1.1 Table of Contents

1.2 ScreenShot

1.3 Load Path

(setq user-emacs-directory "~/Developments/src/github.com/Ladicle/dotfiles/common/emacs.d/elisp")

(eval-and-compile
  (setq load-prefer-newer t
	package-user-dir "~/Developments/src/github.com/Ladicle/dotfiles/common/emacs.d/elpa"
	package--init-file-ensured t
	package-enable-at-startup nil)

  (unless (file-directory-p package-user-dir)
    (make-directory package-user-dir t)))
(eval-and-compile
  (setq load-path (append load-path (directory-files package-user-dir t "^[^.]" t))))

(eval-when-compile
  (require 'package)
  (package-initialize)
  (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
  (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
  (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)

  (unless (package-installed-p 'use-package)
    (package-refresh-contents)
    (package-install 'use-package)
    (package-install 'diminish)
    (package-install 'bind-key))

  (setq use-package-always-ensure t)
  (setq use-package-expand-minimally t)

  (require 'use-package))
(require 'diminish)
(require 'bind-key)

1.4 Generic

1.4.1 Server

(use-package server
  :ensure nil
  :hook (after-init . server-mode))

1.4.2 Editing

;; Ignore split window horizontally
(setq split-width-threshold nil)

;; Default Encoding
(prefer-coding-system 'utf-8-unix)
(set-locale-environment "en_US.UTF-8") ; "ja_JP.UTF-8"
(set-default-coding-systems 'utf-8-unix)
(set-selection-coding-system 'utf-8-unix)
(set-buffer-file-coding-system 'utf-8-unix)
(set-clipboard-coding-system 'utf-8) ; included by set-selection-coding-system
(set-keyboard-coding-system 'utf-8) ; configured by prefer-coding-system
(set-terminal-coding-system 'utf-8) ; configured by prefer-coding-system
(setq buffer-file-coding-system 'utf-8) ; utf-8-unix
(setq save-buffer-coding-system 'utf-8-unix) ; nil
(setq process-coding-system-alist
  (cons '("grep" utf-8 . utf-8) process-coding-system-alist))

;; Quiet Startup
(setq inhibit-startup-screen t)
(setq inhibit-startup-message t)
(setq inhibit-startup-echo-area-message t)
(setq initial-scratch-message nil)

(defun display-startup-echo-area-message ()
  (message ""))

(setq frame-title-format nil)
(setq ring-bell-function 'ignore)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets) ; Show path if names are same
(setq adaptive-fill-regexp "[ t]+|[ t]*([0-9]+.|*+)[ t]*")
(setq adaptive-fill-first-line-regexp "^* *$")
(setq sentence-end "\\([。、!?]\\|……\\|[,.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")
(setq sentence-end-double-space nil)
(setq delete-by-moving-to-trash t)    ; Deleting files go to OS's trash folder
(setq make-backup-files nil)          ; Forbide to make backup files
(setq auto-save-default nil)          ; Disable auto save
(setq set-mark-command-repeat-pop t)  ; Repeating C-SPC after popping mark pops it again
(setq track-eol t)			; Keep cursor at end of lines.
(setq line-move-visual nil)		; To be required by track-eol
(setq-default kill-whole-line t)	; Kill line including '\n'
(defalias 'yes-or-no-p #'y-or-n-p)

;; Delete selection if insert someting
(use-package delsel
  :ensure nil
  :hook (after-init . delete-selection-mode))

;; Automatically reload files was modified by external program
(use-package autorevert
  :ensure nil
  :diminish
  :hook (after-init . global-auto-revert-mode))

;; Hungry deletion
(use-package hungry-delete
  :diminish
  :hook (after-init . global-hungry-delete-mode)
  :config (setq-default hungry-delete-chars-to-skip " \t\f\v"))

1.4.3 Smartparens

(use-package smartparens
  :hook
  (after-init . smartparens-global-mode)
  :config
  (sp-local-pair 'org-mode "+" "+")
  (sp-local-pair 'org-mode "=" "=")
  (sp-local-pair 'markdown-mode "`" "`")
  (sp-local-pair 'emacs-lisp-mode "'" nil :actions nil))

1.4.4 History

;; History
(use-package saveplace
  :ensure nil
  :hook (after-init . save-place-mode))

;; Recent files
(use-package recentf
  :ensure nil
  :hook (after-init . recentf-mode)
  :custom
  (recentf-max-saved-items 20000000)
  (recentf-auto-cleanup 'never)
  (recentf-exclude '((expand-file-name package-user-dir)
		     ".cache"
		     "cache"
		     "recentf"
		     "COMMIT_EDITMSG\\'"))
  :preface
  (defun ladicle/recentf-save-list-silence ()
    (interactive)
    (let ((message-log-max nil))
      (if (fboundp 'shut-up)
	  (shut-up (recentf-save-list))
	(recentf-save-list)))
    (message ""))
  (defun ladicle/recentf-cleanup-silence ()
    (interactive)
    (let ((message-log-max nil))
      (if shutup-p
	  (shut-up (recentf-cleanup))
	(recentf-cleanup)))
    (message ""))
  :hook
  (focus-out-hook . (ladicle/recentf-save-list-silence ladicle/recentf-cleanup-silence)))

;; Save changes history
(use-package savehist
    :ensure nil
    :hook (after-init . savehist-mode)
    ;; :custom
    ;; (enable-recursive-minibuffers t)
    ;; (history-length 1000)
    ;; (savehist-autosave-interval 60)
    ;; (savehist-additional-variables '(mark-ring
    ;; 					      global-mark-ring
    ;; 					      search-ring
    ;; 					      regexp-search-ring
    ;; 					      extended-command-history))
)

1.4.5 GUI/Font

font-size check

|abcdef ghijkl|
|ABCDEF GHIJKL|
|'";:-+ =/\~`?|
|∩∪∞≤≥∏ ∑∫×±⊆⊇|
|αβγδεζ ηθικλμ|
|ΑΒΓΔΕΖ ΗΘΙΚΛΜ|
|日本語 の美観|
|あいう えおか|
|アイウ エオカ|
|アイウエオカ キクケコサシ|

| hoge                 | hogeghoe | age               |
|----------------------+----------+-------------------|
| 今日もいい天気ですね | お、     | 等幅になった 👍 |
(if window-system
    (progn
      ;; UI parts
      (toggle-scroll-bar 0)
      (tool-bar-mode 0)
      (menu-bar-mode 0)

      ;; Japanese font settings
      (defun set-japanese-font (family)
	(set-fontset-font (frame-parameter nil 'font) 'japanese-jisx0208        (font-spec :family family))
	(set-fontset-font (frame-parameter nil 'font) 'japanese-jisx0212        (font-spec :family family))
	(set-fontset-font (frame-parameter nil 'font) 'katakana-jisx0201        (font-spec :family family)))

      ;; Overwrite latin and greek char's font
      (defun set-latin-and-greek-font (family)
	(set-fontset-font (frame-parameter nil 'font) '(#x0250 . #x02AF) (font-spec :family family)) ; IPA extensions
	(set-fontset-font (frame-parameter nil 'font) '(#x00A0 . #x00FF) (font-spec :family family)) ; latin-1
	(set-fontset-font (frame-parameter nil 'font) '(#x0100 . #x017F) (font-spec :family family)) ; latin extended-A
	(set-fontset-font (frame-parameter nil 'font) '(#x0180 . #x024F) (font-spec :family family)) ; latin extended-B
	(set-fontset-font (frame-parameter nil 'font) '(#x2018 . #x2019) (font-spec :family family)) ; end quote
	(set-fontset-font (frame-parameter nil 'font) '(#x2588 . #x2588) (font-spec :family family)) ; █
	(set-fontset-font (frame-parameter nil 'font) '(#x0370 . #x03FF) (font-spec :family family)))

      (setq use-default-font-for-symbols nil)
      (setq inhibit-compacting-font-caches t)
      (setq jp-font-family "SF Mono Square")
      (setq default-font-family "FuraCode Nerd Font")

      ;; (set-face-attribute 'default nil :family default-font-family)
      (when (eq system-type 'darwin)
		(set-face-attribute 'default nil :family jp-font-family :height 140))
      (when (eq system-type 'gnu/linux)
		(set-face-attribute 'default nil :family jp-font-family :height 150))
      (set-japanese-font jp-font-family)
      (set-latin-and-greek-font default-font-family)
      (add-to-list 'face-font-rescale-alist (cons default-font-family 0.86))
      (add-to-list 'face-font-rescale-alist (cons jp-font-family 1.0))
      ))

1.4.6 OS

  1. common

    (use-package exec-path-from-shell
      :custom
      (exec-path-from-shell-check-startup-files nil)
      (exec-path-from-shell-variables '("PATH" "GOPATH"))
      :config
      (when (memq window-system '(mac ns x))
        (exec-path-from-shell-initialize)))
  2. Linux

    1. xclip

      (use-package xclip
        :if (eq system-type 'gnu/linux)
        :config
        (xclip-mode 1))
    2. Mozc

      (use-package mozc
        :if (eq system-type 'gnu/linux)
        :commands (mozc-mode mozc-handle-event)
        :custom (default-input-method "japanese-mozc")
        :bind (("M-l" . mozc-start)
           :map mozc-mode-map
           ("," . (lambda () (interactive) (mozc-insert-str "、")))
           ("." . (lambda () (interactive) (mozc-insert-str "。")))
           ("?" . (lambda () (interactive) (mozc-insert-str "?")))
           ("!" . (lambda () (interactive) (mozc-insert-str "!")))
           ("l" . mozc-end)
           ("C-m" . (lambda () (interactive) (mozc-insert-str "")))
           ("<enter>" . (lambda () (interactive) (mozc-insert-str "")))
           ("C-h" . delete-backward-char))
        :init
        (defun mozc-start()
          (interactive)
          (set-cursor-color "#ff79c6")
          (message "Mozc start")
          (mozc-mode 1))
        (defun mozc-end()
          (interactive)
          (mozc-handle-event 'enter)
          (set-cursor-color "cyan")
          (message "Mozc end")
          (mozc-mode -1))
        (defun mozc-insert-str (str)
          (mozc-handle-event 'enter)
          (insert str))
        :config
        (mozc-mode 1)
        ;; Show candidates style
        (use-package mozc-popup
          :custom (mozc-candidates-style "popup")))
  3. macOS

    (when (equal system-type 'darwin)
      (setq mac-option-modifier 'super)
      (setq mac-command-modifier 'meta)
      (setq ns-auto-hide-menu-bar t)
      (setq ns-use-proxy-icon nil)
      (setq initial-frame-alist
         (append
          '((ns-transparent-titlebar . t)
        (ns-appearance . dark)
        (vertical-scroll-bars . nil)
        (internal-border-width . 0)))))
    ;; pbcopy
    (use-package pbcopy
    :if (eq system-type 'darwin)
    :hook (dashboard-mode . (turn-on-pbcopy)))

1.5 Key-bindings

1.5.1 Mouse

(xterm-mouse-mode t)
(global-set-key   [mouse-4] '(lambda () (interactive) (scroll-down 1)))
(global-set-key   [mouse-5] '(lambda () (interactive) (scroll-up   1)))

1.5.2 Custom Maps

(define-prefix-command 'ladicle-window-map)
(define-key global-map (kbd "M-o") 'ladicle-window-map)

(define-prefix-command 'ladicle-toggle-map)
(define-key global-map (kbd "M-t") 'ladicle-toggle-map)

(define-prefix-command 'ladicle-link-map)
(define-key global-map (kbd "M-o l") 'ladicle-link-map)

1.5.3 Global

(global-unset-key "\C-z")
(global-set-key (kbd "M-o m")   'async-shell-command)
(global-set-key (kbd "M-o b")   'switch-to-buffer)
(global-set-key (kbd "C-x C-b") 'switch-to-buffer)
(global-set-key (kbd "C-M-g")   'goto-line)
(global-set-key (kbd "C-h")     'backward-delete-char)
(global-set-key (kbd "C-o")     'other-window)
(global-set-key (kbd "M-:")     'comment-dwim)
(global-set-key (kbd "C-m")     'electric-newline-and-maybe-indent)
(global-set-key (kbd "C-j")     'newline-and-indent)
(global-set-key (kbd "M-r")     'rename-file)
(global-set-key (kbd "M-t l")   'toggle-truncate-lines)

1.5.4 which-key

Guide Key-bindings https://github.com/justbur/emacs-which-key

(use-package which-key
  :diminish which-key-mode
  :hook (after-init . which-key-mode))

1.5.5 Hydra

(use-package hydra)

1.6 Undo/Redo

https://www.emacswiki.org/emacs/UndoTree

(use-package undo-tree
  :bind
  ("M-/" . undo-tree-redo)
  :config
  (global-undo-tree-mode))

1.7 Search/Replace

1.7.1 Projectile

(use-package projectile
  :diminish
  :bind
  ("M-o p" . projectile-switch-project)
  :config
  (projectile-mode +1))

1.7.2 Wgrep

(use-package wgrep
  :defer t
  :custom
  (wgrep-enable-key "e")
  (wgrep-auto-save-buffer t)
  (wgrep-change-readonly-file t))

1.7.3 Ag

(use-package ag
  :custom
  (ag-highligh-search t)
  (ag-reuse-buffers t)
  (ag-reuse-window t)
  :bind
  ("M-s a" . ag-project)
  :config
  (use-package wgrep-ag))

1.7.4 Ivy

https://github.com/abo-abo/swiper

(use-package counsel
  :diminish ivy-mode counsel-mode
  :defines
  (projectile-completion-system magit-completing-read-function)
  :bind
  (("C-s" . swiper)
  ("M-s r" . ivy-resume)
  ("C-c v p" . ivy-push-view)
  ("C-c v o" . ivy-pop-view)
  ("C-c v ." . ivy-switch-view)
  :map counsel-mode-map
  ("M-s c" . counsel-ag)
  ("M-o f" . counsel-fzf)
  ("M-o r" . counsel-recentf)
  ("M-y" . counsel-yank-pop)
  :map ivy-minibuffer-map
  ("C-w" . ivy-backward-kill-word)
  ("C-k" . ivy-kill-line)
  ("C-j" . ivy-immediate-done)
  ("RET" . ivy-alt-done)
  ("C-h" . ivy-backward-delete-char))
  :hook
  (after-init . ivy-mode)
  (ivy-mode . counsel-mode)
  :custom
  (enable-recursive-minibuffers t)
  (ivy-use-selectable-prompt t)
  (ivy-use-virtual-buffers t)
  (ivy-on-del-error-function nil)
  (ivy-format-function 'ivy-format-function-arrow)
  (swiper-action-recenter t)
  (counsel-yank-pop-separator "\n-------\n")
  (counsel-grep-base-command "ag -S --noheading --nocolor --nofilename --numbers '%s' %s")
  :config
  ;; Integration with `projectile'
  (with-eval-after-load 'projectile
    (setq projectile-completion-system 'ivy))
  ;; Integration with `magit'
  (with-eval-after-load 'magit
    (setq magit-completing-read-function 'ivy-completing-read))

  ;; Enhance fuzzy matching
  (use-package flx)
  ;; Enhance M-x
  (use-package amx)
  ;; Ivy integration for Projectile
  (use-package counsel-projectile
    :config (counsel-projectile-mode 1))

;; More friendly display transformer for Ivy
(use-package ivy-rich
  :defines all-the-icons-mode-icon-alist
  :functions (all-the-icons-icon-family-for-mode all-the-icons-icon-family-for-file)
  :preface
  (with-eval-after-load 'all-the-icons
    (add-to-list 'all-the-icons-mode-icon-alist
		 '(gfm-mode  all-the-icons-octicon "markdown" :v-adjust 0.0 :face all-the-icons-lblue)))

  (defun ivy-rich-switch-buffer-icon (candidate)
    "Show buffer icons in `ivy-rich'."
    ;; Only on GUI
    (when (and (display-graphic-p)
	       (featurep 'all-the-icons))
      (when-let* ((buffer (get-buffer candidate))
		  (major-mode (buffer-local-value 'major-mode buffer))
		  (icon (all-the-icons-icon-for-mode major-mode)))
	(propertize
	 (if (symbolp icon)
	     (all-the-icons-icon-for-mode 'text-mode)
	   icon)
	 'face `(
		 :height 1.1
		 :family ,(all-the-icons-icon-family-for-mode
			   (if (symbolp icon)
			       'text-mode
			     major-mode))
		 :inherit
		 )))))

  (defun ivy-rich-file-icon (candidate)
    "Show file icons in `ivy-rich'."
    ;; Only on GUI
    (when (and (display-graphic-p)
	       (featurep 'all-the-icons))
      (let ((icon (all-the-icons-icon-for-file candidate)))
	(propertize
	 (if (symbolp icon)
	     (all-the-icons-icon-for-mode 'text-mode)
	   icon)
	 'face `(
		 :height 1.1
		 :family ,(all-the-icons-icon-family-for-file candidate)
		 :inherit
		 )))))

  (setq ivy-rich--display-transformers-list
	'(ivy-switch-buffer
	  (:columns
	   ((ivy-rich-switch-buffer-icon :width 2)
	    (ivy-rich-candidate (:width 30))
	    (ivy-rich-switch-buffer-size (:width 7))
	    (ivy-rich-switch-buffer-indicators (:width 4 :face error :align right))
	    (ivy-rich-switch-buffer-major-mode (:width 12 :face warning))
	    (ivy-rich-switch-buffer-project (:width 15 :face success))
	    (ivy-rich-switch-buffer-path (:width (lambda (x) (ivy-rich-switch-buffer-shorten-path x (ivy-rich-minibuffer-width 0.3))))))
	   :predicate
	   (lambda (cand) (get-buffer cand)))
	  ivy-switch-buffer-other-window
	  (:columns
	   ((ivy-rich-switch-buffer-icon :width 2)
	    (ivy-rich-candidate (:width 30))
	    (ivy-rich-switch-buffer-size (:width 7))
	    (ivy-rich-switch-buffer-indicators (:width 4 :face error :align right))
	    (ivy-rich-switch-buffer-major-mode (:width 12 :face warning))
	    (ivy-rich-switch-buffer-project (:width 15 :face success))
	    (ivy-rich-switch-buffer-path (:width (lambda (x) (ivy-rich-switch-buffer-shorten-path x (ivy-rich-minibuffer-width 0.3))))))
	   :predicate
	   (lambda (cand) (get-buffer cand)))
	  counsel-M-x
	  (:columns
	   ((counsel-M-x-transformer (:width 50))
	    (ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
	  counsel-describe-function
	  (:columns
	   ((counsel-describe-function-transformer (:width 50))
	    (ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
	  counsel-describe-variable
	  (:columns
	   ((counsel-describe-variable-transformer (:width 50))
	    (ivy-rich-counsel-variable-docstring (:face font-lock-doc-face))))
	  counsel-find-file
	  (:columns
	   ((ivy-rich-file-icon :width 2)
	    (ivy-rich-candidate (:width 30))))
	  counsel-file-jump
	  (:columns
	   ((ivy-rich-file-icon :width 2)
	    (ivy-rich-candidate (:width 30))))
	  counsel-git
	  (:columns
	   ((ivy-rich-file-icon :width 2)
	    (ivy-rich-candidate (:width 30))))
	  counsel-projectile-find-file
	  (:columns
	   ((ivy-rich-file-icon :width 2)
	    (ivy-rich-candidate (:width 30))))
	  counsel-projectile-find-dir
	  (:columns
	   ((ivy-rich-file-icon :width 2)
	    (ivy-rich-candidate (:width 30))))
	  counsel-recentf
	  (:columns
	   ((ivy-rich-file-icon :width 2)
	    (ivy-rich-candidate (:width 150))
	    (ivy-rich-file-last-modified-time (:face font-lock-comment-face))))))
  :custom (ivy-rich-parse-remote-buffer nil)
  :config
  (ivy-rich-mode 1)
  :hook (ivy-rich-mode . (lambda ()
			   (setq ivy-virtual-abbreviate
				 (or (and ivy-rich-mode 'abbreviate) 'name))))))

1.7.5 Anzu

(use-package anzu
  :diminish
  :bind
  ("C-r"   . anzu-query-replace-regexp)
  ("C-M-r" . anzu-query-replace-at-cursor-thing)
  :hook
  (after-init . global-anzu-mode))

1.7.6 Migemo

(use-package migemo
  :custom
  (migemo-command "/usr/local/bin/cmigemo")
  (migemo-options '("-q" "--emacs"))
  (migemo-user-dictionary nil)
  (migemo-regex-dictionary nil)
  (migemo-coding-system 'utf-8-unix)
  (migemo-dictionary "/usr/share/cmigemo/utf-8/migemo-dict")
  :config
  (when (eq system-type 'darwin)
    (setq migemo-dictionary "/usr/local/share/migemo/utf-8/migemo-dict"))
  (migemo-init)
  (use-package avy-migemo
    :after swiper
    :config
    (avy-migemo-mode 1)
    (require 'avy-migemo-e.g.swiper)))

1.8 Cursor

1.8.1 multiple-cursor

(use-package multiple-cursors
  :functions hydra-multiple-cursors
  :bind
  ("M-u" . hydra-multiple-cursors/body)
  :config
  (with-eval-after-load 'hydra
    (defhydra hydra-multiple-cursors (:color pink :hint nil)
"
									╔════════╗
    Point^^^^^^             Misc^^            Insert                            ║ Cursor ║
  ──────────────────────────────────────────────────────────────────────╨────────╜
     _k_    _K_    _M-k_    [_l_] edit lines  [_i_] numbers
     ^↑^    ^↑^     ^↑^     [_m_] mark all    [_a_] letters
    mark^^ skip^^^ un-mk^   [_s_] sort
     ^↓^    ^↓^     ^↓^
     _j_    _J_    _M-j_
  ╭──────────────────────────────────────────────────────────────────────────────╯
			   [_q_]: quit, [Click]: point
"
	  ("l" mc/edit-lines :exit t)
	  ("m" mc/mark-all-like-this :exit t)
	  ("j" mc/mark-next-like-this)
	  ("J" mc/skip-to-next-like-this)
	  ("M-j" mc/unmark-next-like-this)
	  ("k" mc/mark-previous-like-this)
	  ("K" mc/skip-to-previous-like-this)
	  ("M-k" mc/unmark-previous-like-this)
	  ("s" mc/mark-all-in-region-regexp :exit t)
	  ("i" mc/insert-numbers :exit t)
	  ("a" mc/insert-letters :exit t)
	  ("<mouse-1>" mc/add-cursor-on-click)
	  ;; Help with click recognition in this hydra
	  ("<down-mouse-1>" ignore)
	  ("<drag-mouse-1>" ignore)
	  ("q" nil))))

1.8.2 avy/ace

  (use-package avy
    :functions (hydra-avy hydra-viewer)
    :bind
    ("C-'"   . avy-resume)
    ("C-:"   . avy-goto-char)
    ("M-j"   . hydra-avy/body)
    ("C-M-v" . hydra-viewer/body)
    :preface
    ;; fixed cursor scroll-up
    (defun scroll-up-in-place (n)
      (interactive "p")
      (forward-line (- n))
      (scroll-down n))
    ;; fixed cursor scroll-down
    (defun scroll-down-in-place (n)
      (interactive "p")
      (forward-line n)
      (scroll-up n))
    ;; yank inner sexp
    (defun yank-inner-sexp ()
      (interactive)
      (backward-list)
      (mark-sexp)
      (copy-region-as-kill (region-beginning) (region-end)))
    :config
    (when (eq system-type 'darwin)
      (progn
	(global-set-key (kbd "C-;") 'avy-goto-char)
	(global-set-key (kbd "C-:") 'avy-goto-char-2)))

    (use-package avy-zap
      :bind
      ("M-z" . avy-zap-to-char-dwim)
      ("M-z" . avy-zap-up-to-char-dwim))

    (with-eval-after-load 'hydra
	(defhydra hydra-viewer (:color pink :hint nil)
	  "
									╔════════╗
   Char/Line^^^^^^  Word/Page^^^^^^^^  Line/Buff^^^^   Paren                              ║ Window ║
  ──────────────────────────────────────────────────────────────────────╨────────╜
       ^^_k_^^          ^^_u_^^          ^^_g_^^       _(_ ← _y_ → _)_
       ^^^↑^^^          ^^^↑^^^          ^^^↑^^^       _,_ ← _/_ → _._
   _h_ ← _d_ → _l_  _H_ ← _D_ → _L_  _a_ ← _K_ → _e_
       ^^^↓^^^          ^^^↓^^^          ^^^↓^
       ^^_j_^^          ^^_n_^^          ^^_G_
  ╭──────────────────────────────────────────────────────────────────────────────╯
			   [_q_]: quit, [_<SPC>_]: center
	  "
	  ("j" scroll-down-in-place)
	  ("k" scroll-up-in-place)
	  ("l" forward-char)
	  ("d" delete-char)
	  ("h" backward-char)
	  ("L" forward-word)
	  ("H" backward-word)
	  ("u" scroll-up-command)
	  ("n" scroll-down-command)
	  ("D" delete-word-at-point)
	  ("a" mwim-beginning-of-code-or-line)
	  ("e" mwim-end-of-code-or-line)
	  ("g" beginning-of-buffer)
	  ("G" end-of-buffer)
	  ("K" kill-whole-line)
	  ("(" backward-list)
	  (")" forward-list)
	  ("y" yank-inner-sexp)
	  ("." backward-forward-next-location)
	  ("," backward-forward-previous-location)
	  ("/" avy-goto-char :exit t)
	  ("<SPC>" recenter-top-bottom)
	  ("q" nil))

	(defhydra hydra-avy (:color pink :hint nil)
	  "
									╔════════╗
	^^Goto^^        Kill^^        Yank^^        Move^^        Misc            ║  Jump  ║
  ──────────────────────────────────────────────────────────────────────╨────────╜
    _c_ ← char^^        [_k_] region  [_y_] region  [_m_] region  [_n_] line number
    _a_ ← char2 → _b_   [_K_] line    [_Y_] line    [_M_] line    [_v_] Goto viewer
    _w_ ← word  → _W_   [_z_] zap^^^^                             [_o_] Goto clock
    _l_ ← line  → _e_   ^^^^^                                     _,_ ← f!y → _._
  ╭──────────────────────────────────────────────────────────────────────────────╯
		      [_q_]: quit, [_i_]: imenu, [_<SPC>_]: resume
"
	  ("c" avy-goto-char :exit t)
	  ("a" avy-goto-char-2 :exit t)
	  ("b" avy-goto-char-below :exit t)
	  ("w" avy-goto-word-1 :exit t)
	  ("W" avy-goto-word-1-below :exit t)
	  ("l" avy-goto-line :exit t)
	  ("e" avy-goto-end-of-line :exit t)
	  ("M" avy-move-line)
	  ("m" avy-move-region)
	  ("K" avy-kill-whole-line)
	  ("k" avy-kill-region)
	  ("Y" avy-copy-line :exit t)
	  ("y" avy-copy-region :exit t)
	  ("n" goto-line :exit t)
	  ("o" org-clock-jump-to-current-clock :exit t)
	  ("z" avy-zap-to-char-dwim :exit t)
	  ("v" hydra-viewer/body :exit t)
	  ("<SPC>" avy-resume :exit t)
	  ("o" org-clock-jump-to-current-clock :exit t)
	  ("i" counsel-imenu :exit t)
	  ("," flymake-goto-previous-error)
	  ("." flymake-goto-next-error)
	  ("q" nil))))

  (use-package ace-window
    :functions hydra-frame-window/body
    :bind
    ("C-M-o" . hydra-frame-window/body)
    :custom
    (aw-keys '(?j ?k ?l ?i ?o ?h ?y ?u ?p))
    :custom-face
    (aw-leading-char-face ((t (:height 4.0 :foreground "#f1fa8c"))))
    :preface
    (defvar is-window-maximized nil)
    (defun ladicle/toggle-window-maximize ()
	(interactive)
	(progn
	  (if is-window-maximized
	      (balance-windows)
	    (maximize-window))
	  (setq is-window-maximized
		(not is-window-maximized))))
    :config
    (use-package rotate
	:load-path "~/Developments/src/github.com/Ladicle/dotfiles/common/emacs.d/elisp/emacs-rotate"
	:bind
	("M-o SPC" . rotate-layout))
    (with-eval-after-load 'hydra
	(defhydra hydra-frame-window (:color pink :hint nil)
	  "
									╔════════╗
     Size^^    Zoom^^    Split^^     Frame^^               Buffer               ║ Window ║
  ──────────────────────────────────────────────────────────────────────╨────────╜
	^_k_^       _z_      _-_       [_i_] select         _,_ ← switch → _._
	^^↑^^       ^↑^      ^↑^       [_s_] swap           [_d_] delete
    _h_ ←   → _l_   ^ ^      ^ ^       [_o_] next           [_D_] delete and kill
	^^↓^^       ^↓^      ^↓^       [_m_] maximize       [_r_] recentf
	^_j_^       _x_      _/_       [_O_] delete others  [_b_] select
  ╭──────────────────────────────────────────────────────────────────────────────╯
			   [_q_]: quit, [_<SPC>_]: rotate
"
	  ("K" kill-current-buffer :exit t)
	  ("D" kill-buffer-and-window :exit t)
	  ("O" delete-other-windows  :exit t)
	  ("F" toggle-frame-fullscreen)
	  ("i" ace-window)
	  ("s" ace-swap-window :exit t)
	  ("d" ace-delete-window)
	  ("m" ladicle/toggle-window-maximize :exit t)
	  ("x" text-scale-decrease)
	  ("z" text-scale-increase)
	  ("-" split-window-vertically)
	  ("/" split-window-horizontally)
	  ("h" shrink-window-horizontally)
	  ("k" shrink-window)
	  ("j" enlarge-window)
	  ("l" enlarge-window-horizontally)
	  ("," previous-buffer)
	  ("." next-buffer)
	  ("o" other-window)
	  ("d" kill-current-buffer)
	  ("r" counsel-recentf :exit t)
	  ("b" switch-to-buffer :exit t)
	  ("D" kill-buffer-and-window)
	  ("<SPC>" rotate-layout)
	  ("q" nil))))

1.8.3 Smart move

(use-package mwim
  :bind
  ("C-a" . mwim-beginning-of-code-or-line)
  ("C-e" . mwim-end-of-code-or-line))

1.9 Check

1.9.1 flymake

(use-package flymake-diagnostic-at-point
  :after flymake
  :custom
  (flymake-diagnostic-at-point-timer-delay 0.1)
  (flymake-diagnostic-at-point-error-prefix " ")
  (flymake-diagnostic-at-point-display-diagnostic-function 'flymake-diagnostic-at-point-display-popup) ;; or flymake-diagnostic-at-point-display-minibuffer
  :hook
  (flymake-mode . flymake-diagnostic-at-point-mode))

1.9.2 flyspell

(use-package flyspell
  :diminish
  :if (executable-find "aspell")
  :hook
  ((org-mode yaml-mode markdown-mode git-commit-mode) . flyspell-mode)
  (prog-mode . flyspell-prog-mode)
  (flyspell-mode . (lambda ()
		     (dolist (key '("C-;" "C-," "C-."))
		       (unbind-key key flyspell-mode-map))))
  :custom
  (flyspell-issue-message-flag nil)
  (ispell-program-name "aspell")
  (ispell-extra-args '("--sug-mode=ultra" "--lang=en_US" "--run-together"))
  :custom-face
  (flyspell-incorrect ((t (:underline (:color "#f1fa8c" :style wave)))))
  (flyspell-duplicate ((t (:underline (:color "#50fa7b" :style wave)))))
  :preface
  (defun message-off-advice (oldfun &rest args)
    "Quiet down messages in adviced OLDFUN."
    (let ((message-off (make-symbol "message-off")))
      (unwind-protect
	  (progn
	    (advice-add #'message :around #'ignore (list 'name message-off))
	    (apply oldfun args))
	(advice-remove #'message message-off))))
  :config
  (advice-add #'ispell-init-process :around #'message-off-advice)
  (use-package flyspell-correct-ivy
  :bind ("C-M-i" . flyspell-correct-wrapper)
  :custom
  (flyspell-correct-interface #'flyspell-correct-ivy)))

1.10 Project

1.10.1 persp

(use-package persp-mode
  :disabled
  :diminish
  :defines ivy-sort-functions-alist
  :commands (get-current-persp persp-contain-buffer-p persp-add persp-by-name-and-exists)
  :hook ((after-init . persp-mode)
	 (emacs-startup . toggle-frame-maximized))
  :custom
  (persp-keymap-prefix (kbd "C-x p"))
  (persp-nil-name "default")
  (persp-set-last-persp-for-new-frames nil)
  (persp-auto-resume-time 0)
  :config
  ;; NOTE: Redefine `persp-add-new' to address.
  ;; Issue: Unable to create/handle persp-mode
  ;; https://github.com/Bad-ptr/persp-mode.el/issues/96
  ;; https://github.com/Bad-ptr/persp-mode-projectile-bridge.el/issues/4
  ;; https://emacs-china.org/t/topic/6416/7
  (defun* persp-add-new (name &optional (phash *persp-hash*))
    "Create a new perspective with the given `NAME'. Add it to `PHASH'.
  Return the created perspective."
    (interactive "sA name for the new perspective: ")
    (if (and name (not (equal "" name)))
	(destructuring-bind (e . p)
	    (persp-by-name-and-exists name phash)
	  (if e p
	    (setq p (if (equal persp-nil-name name)
			nil (make-persp :name name)))
	    (persp-add p phash)
	    (run-hook-with-args 'persp-created-functions p phash)
	    p))
      (message "[persp-mode] Error: Can't create a perspective with empty name.")
      nil))

  ;; Ignore temporary buffers
  (add-hook 'persp-common-buffer-filter-functions
	    (lambda (b) (or (string-prefix-p "*" (buffer-name b))
		       (string-prefix-p "magit" (buffer-name b)))))

  ;; Integrate IVY
  (with-eval-after-load "ivy"
    (add-hook 'ivy-ignore-buffers
	      #'(lambda (b)
		  (when persp-mode
		    (let ((persp (get-current-persp)))
		      (if persp
			  (not (persp-contain-buffer-p b persp))
			nil)))))

    (setq ivy-sort-functions-alist
	  (append ivy-sort-functions-alist
		  '((persp-kill-buffer   . nil)
		    (persp-remove-buffer . nil)
		    (persp-add-buffer    . nil)
		    (persp-switch        . nil)
		    (persp-window-switch . nil)
		    (persp-frame-switch  . nil))))))

1.11 Complition

1.11.1 Yasnippet

(use-package yasnippet
  :diminish yas-minor-mode
  :custom (yas-snippet-dirs '("~/.emacs.d/snippets"))
  :hook (after-init . yas-global-mode))

1.11.2 Company

(use-package company
  :diminish company-mode
  :defines
  (company-dabbrev-ignore-case company-dabbrev-downcase)
  :bind
  (:map company-active-map
   ("C-n" . company-select-next)
   ("C-p" . company-select-previous)
   ("<tab>" . company-complete-common-or-cycle)
   :map company-search-map
   ("C-p" . company-select-previous)
   ("C-n" . company-select-next))
  :custom
  (company-idle-delay 0)
  (company-echo-delay 0)
  :hook
  (after-init . global-company-mode)
  ((go-mode c++-mode) . (lambda () (set (make-local-variable 'company-backends)
			    '((company-yasnippet
			       company-lsp
			       company-files
			       company-dabbrev-code
			       ;; company-ispell
			       )))))
  :config
  ;; Show pretty icons
  (use-package company-box
    :diminish
    :functions (all-the-icons-faicon
		all-the-icons-material
		all-the-icons-octicon
		all-the-icons-alltheicon)
    :hook (company-mode . company-box-mode)
    :custom
    (company-box-backends-colors nil)
    (company-box-enable-icon (display-graphic-p))
    :config
    (with-eval-after-load 'all-the-icons
      (setq company-box-icons-unknown
	    (all-the-icons-material "text_fields" :v-adjust -0.2))
      (setq company-box-icons-elisp
	    (list
	     (all-the-icons-faicon "cube" :v-adjust -0.0575 :face 'font-lock-constant-face)                     ; Function
	     (all-the-icons-faicon "tag" :v-adjust -0.0575 :face 'font-lock-warning-face)                       ; Variable
	     (all-the-icons-faicon "cubes" :height 0.8 :v-adjust -0.0575 :face 'font-lock-warning-face)         ; Feature
	     (all-the-icons-material "palette" :v-adjust -0.2)))
      (setq company-box-icons-yasnippet
	    (all-the-icons-octicon "code" :v-adjust -0.0575 :face 'font-lock-variable-name-face))               ; Yasnippet
      (setq company-box-icons-lsp
	    `(( 1  . ,(all-the-icons-material "text_fields" :v-adjust -0.2))                                    ; Text
	      ( 2  . ,(all-the-icons-faicon "cube" :v-adjust -0.0575 :face font-lock-constant-face))            ; Method
	      ( 3  . ,(all-the-icons-faicon "cube" :v-adjust -0.0575 :face font-lock-constant-face))            ; Function
	      ( 4  . ,(all-the-icons-faicon "cube" :v-adjust -0.0575 :face font-lock-constant-face))            ; Constructor
	      ( 5  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575 :face 'font-lock-warning-face))             ; Field
	      ( 6  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575 :face 'font-lock-warning-face))             ; Variable
	      ( 7  . ,(all-the-icons-faicon "cubes" :height 0.9 :v-adjust -0.0575 :face 'font-lock-constant-face))             ; Class
	      ( 8  . ,(all-the-icons-faicon "cubes" :height 0.9 :v-adjust -0.0575))            ; Interface
	      ( 9  . ,(all-the-icons-octicon "package" :v-adjust -0.0575 :face 'font-lock-warning-face))                             ; Module
	      (10  . ,(all-the-icons-faicon "wrench" :v-adjust -0.0575))                                        ; Property
	      (11  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575))                                           ; Unit
	      (12  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575 :face 'font-lock-constant-face))             ; Value
	      (13  . ,(all-the-icons-faicon "tags" :v-adjust -0.0575 :face 'font-lock-constant-face))           ; Enum
	      (14  . ,(all-the-icons-material "format_align_center" :v-adjust -0.2))                            ; Keyword
	      (15  . ,(all-the-icons-octicon "code" :v-adjust -0.0575 :face 'font-lock-variable-name-face))     ; Snippet
	      (16  . ,(all-the-icons-material "palette" :v-adjust -0.2))                                        ; Color
	      (17  . ,(all-the-icons-faicon "file-o" :v-adjust -0.0575))                                        ; File
	      (18  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575))                                           ; Reference
	      (19  . ,(all-the-icons-octicon "file-directory" :v-adjust -0.0575))                               ; Folder
	      (20  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575 :face 'font-lock-keyword-face))             ; EnumMember
	      (21  . ,(all-the-icons-faicon "tag" :v-adjust -0.0575))                                           ; Constant
	      (22  . ,(all-the-icons-faicon "cubes" :height 0.9 :v-adjust -0.0575 :face 'font-lock-constant-face))            ; Struct
	      (23  . ,(all-the-icons-faicon "bolt" :v-adjust -0.0575 :face 'font-lock-warning-face))            ; Event
	      (24  . ,(all-the-icons-octicon "tag" :v-adjust -0.0575))                                          ; Operator
	      (25  . ,(all-the-icons-octicon "tag" :v-adjust -0.0575 :face 'font-lock-const-face))             ; TypeParameter
	      ))))
    ;; Show quick tooltip
    (use-package company-quickhelp
      :defines company-quickhelp-delay
      :bind (:map company-active-map
		  ("M-h" . company-quickhelp-manual-begin))
      :hook (global-company-mode . company-quickhelp-mode)
      :custom (company-quickhelp-delay 0.8)))

1.12 Git

1.12.1 Timemachine

(use-package git-timemachine
  :bind ("M-g t" . git-timemachine-toggle))

1.12.2 Diffview

(use-package diffview
  :commands (diffview-region diffview-current)
  :preface
  (defun ladicle/diffview-dwim ()
    (interactive)
    (if (region-active-p)
	(diffview-region)
      (diffview-current)))
  :bind ("M-g v" . ladicle/diffview-dwim))

1.12.3 Magit

(use-package magit
  :custom
  (magit-auto-revert-mode nil)
  :bind
  ("M-g s" . magit-status))

1.12.4 GitModes

(use-package gitattributes-mode :defer t)
(use-package gitconfig-mode :defer t)
(use-package gitignore-mode :defer t)

1.12.5 GitGutter

(use-package git-gutter
    :custom
    (git-gutter:modified-sign "~")		; 
    (git-gutter:added-sign    "+")		; 
    (git-gutter:deleted-sign  "-")		; 
    :custom-face
    (git-gutter:modified ((t (:foreground "#f1fa8c" :background "#f1fa8c"))))
    (git-gutter:added    ((t (:foreground "#50fa7b" :background "#50fa7b"))))
    (git-gutter:deleted  ((t (:foreground "#ff79c6" :background "#ff79c6"))))
    :config
    (global-git-gutter-mode +1))

1.12.6 Git Remote

(use-package browse-at-remote
  :bind ("M-g r" . browse-at-remote))

1.12.7 GitHub

(use-package github-pullrequest)

1.12.8 Smerge

(use-package smerge-mode
  :diminish
  :preface
  (with-eval-after-load 'hydra
    (defhydra smerge-hydra
      (:color pink :hint nil :post (smerge-auto-leave))
      "
^Move^       ^Keep^               ^Diff^                 ^Other^
^^-----------^^-------------------^^---------------------^^-------
_n_ext       _b_ase               _<_: upper/base        _C_ombine
_p_rev       _u_pper              _=_: upper/lower       _r_esolve
^^           _l_ower              _>_: base/lower        _k_ill current
^^           _a_ll                _R_efine
^^           _RET_: current       _E_diff
"
      ("n" smerge-next)
      ("p" smerge-prev)
      ("b" smerge-keep-base)
      ("u" smerge-keep-upper)
      ("l" smerge-keep-lower)
      ("a" smerge-keep-all)
      ("RET" smerge-keep-current)
      ("\C-m" smerge-keep-current)
      ("<" smerge-diff-base-upper)
      ("=" smerge-diff-upper-lower)
      (">" smerge-diff-base-lower)
      ("R" smerge-refine)
      ("E" smerge-ediff)
      ("C" smerge-combine-with-next)
      ("r" smerge-resolve)
      ("k" smerge-kill-current)
      ("ZZ" (lambda ()
	      (interactive)
	      (save-buffer)
	      (bury-buffer))
       "Save and bury buffer" :color blue)
      ("q" nil "cancel" :color blue)))
  :hook ((find-file . (lambda ()
			(save-excursion
			  (goto-char (point-min))
			  (when (re-search-forward "^<<<<<<< " nil t)
			    (smerge-mode 1)))))
	 (magit-diff-visit-file . (lambda ()
				    (when smerge-mode
				      (smerge-hydra/body))))))

1.13 Tools

1.13.1 Google Translater

(use-package google-translate
  :bind
  ("M-o t" . google-translate-at-point)
  ("M-o T" . google-translate-at-point-reverse)
  :custom
  (google-translate-default-source-language "en")
  (google-translate-default-target-language "ja"))

1.13.2 wakatime

(use-package wakatime-mode
  :custom (wakatime-cli-path "/usr/local/bin/wakatime")
  :config (global-wakatime-mode))

1.14 Language

1.14.1 LSP

(use-package lsp-mode
  :custom
  ;; debug
  (lsp-print-io nil)
  (lsp-trace nil)
  (lsp-print-performance nil)
  ;; general
  (lsp-auto-guess-root t)
  (lsp-document-sync-method 'incremental) ;; none, full, incremental, or nil
  (lsp-response-timeout 10)
  (lsp-prefer-flymake 'flymake) ;; flymake, lsp-ui, or :none
  (lsp-enable-completion-at-point nil)
  :hook
  ((go-mode c-mode c++-mode) . lsp)
  :bind
  (:map lsp-mode-map
  ("C-c r"   . lsp-rename))
  :config
  (require 'lsp-clients)
  ;; LSP UI tools
  (use-package lsp-ui
    :custom
    ;; lsp-ui-doc
    (lsp-ui-doc-enable t)
    (lsp-ui-doc-header t)
    (lsp-ui-doc-include-signature nil)
    (lsp-ui-doc-position 'at-point) ;; top, bottom, or at-point
    (lsp-ui-doc-max-width 120)
    (lsp-ui-doc-max-height 30)
    (lsp-ui-doc-use-childframe t)
    (lsp-ui-doc-use-webkit t)
    ;; lsp-ui-flycheck
    (lsp-ui-flycheck-enable nil)
    ;; lsp-ui-sideline
    (lsp-ui-sideline-enable nil)
    (lsp-ui-sideline-ignore-duplicate t)
    (lsp-ui-sideline-show-symbol t)
    (lsp-ui-sideline-show-hover t)
    (lsp-ui-sideline-show-diagnostics nil)
    (lsp-ui-sideline-show-code-actions t)
    (lsp-ui-sideline-code-actions-prefix "")
    ;; lsp-ui-imenu
    (lsp-ui-imenu-enable t)
    (lsp-ui-imenu-kind-position 'top)
    ;; lsp-ui-peek
    (lsp-ui-peek-enable t)
    (lsp-ui-peek-peek-height 20)
    (lsp-ui-peek-list-width 50)
    (lsp-ui-peek-fontify 'on-demand) ;; never, on-demand, or always
    :preface
    (defun ladicle/toggle-lsp-ui-doc ()
      (interactive)
      (if lsp-ui-doc-mode
	(progn
	  (lsp-ui-doc-mode -1)
	  (lsp-ui-doc--hide-frame))
	 (lsp-ui-doc-mode 1)))
    :bind
    (:map lsp-mode-map
    ("C-c C-r" . lsp-ui-peek-find-references)
    ("C-c C-j" . lsp-ui-peek-find-definitions)
    ("C-c i"   . lsp-ui-peek-find-implementation)
    ("C-c m"   . lsp-ui-imenu)
    ("C-c s"   . lsp-ui-sideline-mode)
    ("C-c d"   . ladicle/toggle-lsp-ui-doc))
    :hook
    (lsp-mode . lsp-ui-mode))
  ;; DAP
  (use-package dap-mode
    :config
    (dap-mode 1)
    (use-package dap-ui
      :ensure nil
      :config
      (dap-ui-mode 1)
      (require 'dap-hydra)
      (require 'dap-gdb-lldb)		; download and expand lldb-vscode to the =~/.extensions/webfreak.debug=
      (require 'dap-go)			; download and expand vscode-go-extenstion to the =~/.extensions/go=
      ))
  ;; Lsp completion
  (use-package company-lsp
    :custom
    (company-lsp-cache-candidates t) ;; auto, t(always using a cache), or nil
    (company-lsp-async t)
    (company-lsp-enable-snippet t)
    (company-lsp-enable-recompletion t)))

1.14.2 Golang

(use-package go-mode
  :mode "\\.go\\'"
  :custom (gofmt-command "goimports")
  :bind (:map go-mode-map
	 ("C-c C-n" . go-run)
	 ("C-c ."   . go-test-current-test)
	 ("C-c f"   . go-test-current-file)
	 ("C-c a"   . go-test-current-project))
  :config
  (add-hook 'before-save-hook #'gofmt-before-save)
  (use-package gotest)
  (use-package go-tag
    :config (setq go-tag-args (list "-transform" "camelcase"))))

1.14.3 C/C++

(use-package cc-mode
  :bind (:map c-mode-base-map
	 ("C-c c" . compile))
  :hook (c-mode-common . (lambda ()
			    (c-set-style "bsd")
			    (setq tab-width 4)
			    (setq c-base-offset 4))))
(use-package ccls
  :custom (ccls-executable "/usr/local/bin/ccls")
  :hook ((c-mode c++-mode objc-mode) .
	 (lambda () (require 'ccls) (lsp))))

1.14.4 Org

  (use-package org
    :custom
    (org-src-fontify-natively t)
    (private-directory "~/Private/")
    (task-file (concat private-directory "task.org"))
    (schedule-file (concat private-directory "schedule.org"))
    (org-directory private-directory)
    (org-ditaa-jar-path "/usr/share/ditaa/ditaa.jar")
    (org-plantuml-jar-path "~/.emacs.d/plantuml.jar")
    (org-confirm-babel-evaluate t)
    (org-clock-out-remove-zero-time-clocks t)
    (org-startup-folded 'content)
    (org-columns-default-format "%50ITEM(Task) %5TODO(Todo) %10Effort(Effort){:} %10CLOCKSUM(Clock) %2PRIORITY %TAGS")
    (org-agenda-columns-add-appointments-to-effort-sum t)
    (org-agenda-span 'day)
    (org-agenda-log-mode-items (quote (closed clock)))
    (org-agenda-clockreport-parameter-plist
      '(:maxlevel 5 :block t :tstart t :tend t :emphasize t :link t :narrow 80 :indent t :formula nil :timestamp t :level 5 :tcolumns nil :formatter nil))
    (org-global-properties (quote ((
      "Effort_ALL" . "00:05 00:10 00:15 00:30 01:00 01:30 02:00 02:30 03:00"))))
    (org-agenda-files (quote (
      "~/Private/task.org"
      "~/Private/task.org_archive"
      "~/Private/schedule.org")))
    :custom-face
    (org-link ((t (:foreground "#ebe087" :underline t))))
    (org-list-dt ((t (:foreground "#bd93f9"))))
    (org-special-keyword ((t (:foreground "#6272a4"))))
    (org-todo ((t (:background "#272934" :foreground "#51fa7b" :weight bold))))
    (org-document-title ((t (:foreground "#f1fa8c" :weight bold))))
    (org-done ((t (:background "#373844" :foreground "#216933" :strike-through nil :weight bold))))
    (org-footnote ((t (:foreground "#76e0f3"))))
    ;; do not scale outline header
    ;; (org-level-1 ((t (:inherit outline-1 :height 1.0))))
    ;; (org-level-2 ((t (:inherit outline-2 :height 1.0))))
    ;; (org-level-3 ((t (:inherit outline-3 :height 1.0))))
    ;; (org-level-4 ((t (:inherit outline-4 :height 1.0))))
    ;; (org-level-5 ((t (:inherit outline-5 :height 1.0))))
    :bind (("M-o c" . org-capture)
	   ("M-o a" . org-agenda)
	   ("C-x C-l" . org-store-link)
	   :map org-mode-map
	   ("C-c i" . org-clock-in)
	   ("C-c o" . org-clock-out)
	   ("C-c n" . org-narrow-to-subtree)
	   ("C-c b" . org-narrow-to-block)
	   ("C-c w" . widen)
	   ("C-c e" . org-set-effort)
	   ;; custom functions
	   ("C-c 1" . (lambda () (interactive) (org-cycle-list-bullet 2)))
	   ("M-o l i" . (lambda () (interactive) (ladicle/open-org-file task-file)))
	   ("M-o l s" . (lambda () (interactive) (ladicle/open-org-file schedule-file)))
	   ("M-o l y" . (lambda () (interactive) (ladicle/open-org-file (ladicle/get-yesterday-diary))))
	   ("M-o l p" . (lambda () (interactive) (ladicle/open-org-file (ladicle/get-diary-from-cal))))
	   ("M-o l t" . (lambda () (interactive) (ladicle/open-org-file (ladicle/get-today-diary)))))
    :hook
    (kill-emacs . ladicle/org-clock-out-and-save-when-exit)
    (org-clock-in .
		(lambda ()
		  (setq org-mode-line-string (ladicle/task-clocked-time))
		  (run-at-time 0 60 '(lambda ()
				       (setq org-mode-line-string (ladicle/task-clocked-time))
				       (force-mode-line-update)))
		  (force-mode-line-update)))
    (org-mode . (lambda ()
		       (dolist (key '("C-'" "C-," "C-."))
			 (unbind-key key org-mode-map))))
    :preface
    (defun ladicle/get-today-diary ()
      (concat private-directory
	(format-time-string "diary/%Y/%m/%Y-%m-%d.org" (current-time))))
    (defun ladicle/get-yesterday-diary ()
      (concat private-directory
	(format-time-string "diary/%Y/%m/%Y-%m-%d.org" (time-add (current-time) (* -24 3600)))))
    (defun ladicle/get-diary-from-cal ()
      (concat private-directory
	(format-time-string "diary/%Y/%m/%Y-%m-%d.org"
	  (apply 'encode-time (parse-time-string (concat (org-read-date) " 00:00"))))))
    (defun ladicle/open-org-file (fname)
      (switch-to-buffer (find-file-noselect fname)))
    (defun ladicle/org-get-time ()
      (format-time-string "<%H:%M>" (current-time)))
    (defun ladicle/code-metadata ()
      (concat ":" (projectile-project-name) ":"))
    (defun ladicle/org-clock-out-and-save-when-exit ()
	"Save buffers and stop clocking when kill emacs."
	  (ignore-errors (org-clock-out) t)
	  (save-some-buffers t))
    (defun ladicle/task-clocked-time ()
	"Return a string with the clocked time and effort, if any"
	(interactive)
	(let* ((clocked-time (org-clock-get-clocked-time))
	       (h (truncate clocked-time 60))
	       (m (mod clocked-time 60))
	       (work-done-str (format "%d:%02d" h m)))
	  (if org-clock-effort
	      (let* ((effort-in-minutes
		      (org-duration-to-minutes org-clock-effort))
		     (effort-h (truncate effort-in-minutes 60))
		     (effort-m (truncate (mod effort-in-minutes 60)))
		     (effort-str (format "%d:%02d" effort-h effort-m)))
		(format "%s/%s" work-done-str effort-str))
	    (format "%s" work-done-str))))
    :config
    ;; Pomodoro
    (use-package org-pomodoro
    :after org-agenda
    :custom
    (org-pomodoro-ask-upon-killing t)
    (org-pomodoro-format "%s") ;;     
    (org-pomodoro-short-break-format "%s")
    (org-pomodoro-long-break-format  "%s")
    :custom-face
    (org-pomodoro-mode-line ((t (:foreground "#ff5555"))))
    (org-pomodoro-mode-line-break   ((t (:foreground "#50fa7b"))))
    :hook
    (org-pomodoro-started . (lambda () (notifications-notify
					       :title "org-pomodoro"
					       :body "Let's focus for 25 minutes!"
					       :app-icon "~/.emacs.d/img/001-food-and-restaurant.png")))
    (org-pomodoro-finished . (lambda () (notifications-notify
					       :title "org-pomodoro"
					       :body "Well done! Take a break."
					       :app-icon "~/.emacs.d/img/004-beer.png")))
    :config
    (require 'alert)
    :bind (:map org-agenda-mode-map
		("p" . org-pomodoro)))
    (use-package org-pretty-table
      :disabled
      :load-path "~/Developments/src/github.com/Ladicle/dotfiles/common/emacs.d/elisp/org-pretty-table"
      :hook (org-mode . org-pretty-table-mode))
    (setq org-agenda-current-time-string "← now")
    (setq org-agenda-time-grid ;; Format is changed from 9.1
	'((daily today require-timed)
	  (0900 01000 1100 1200 1300 1400 1500 1600 1700 1800 1900 2000 2100 2200 2300 2400)
	  "-"
	  "────────────────"))
    (setq org-todo-keyword-faces
	    '(("WAIT" . (:foreground "#6272a4":weight bold))
	      ("NEXT"   . (:foreground "#f1fa8c" :weight bold))
	      ("CARRY/O" . (:foreground "#6272a4" :background "#373844" :weight bold))))
    (setq org-capture-templates
	  '(("t" " tweet" item
	     (file+headline ladicle/get-today-diary "Log")
	     "%(ladicle/org-get-time) %? \n")
	    ;; memo
	    ("d" " Memo" entry
	     (file+headline ladicle/get-today-diary "Memo")
	     "** %? \n")
	    ;; tasks
	    ("i" " Inbox" entry
	     (file+headline "~/Private/task.org" "Inbox")
	     "** TODO %?"
	     :jump-to-captured 1 :unnarrowed 1)
	    ("g" " Goal" entry
	     (file+headline ladicle/get-today-diary "Goal")
	     "** TODO %? [%]\n   :PROPERTIES:\n   :COOKIE_DATA: recursive\n   :CREATE_AT: %T\n   :END:\n"
	     :jump-to-captured 1 :unnarrowed 1)
	    ("h" " Hack Emacs" item
	     (file+headline "~/Private/task.org" "Hacking Emacs")
	     "- [ ] %?"
	     :prepend t)
	    ("p" " Private" entry
	     (file+olp schedule-file "Calendar" "2019" "02" "Private")
	     "** %?\n   SCHEDULED: <%(org-read-date)>\n"
	     :prepend t)
	    ("e" " English" plain
	     (file+olp schedule-file "Calendar" "2019" "02" "CallanMethod")
	     "     <%(org-read-date)>\n")
	    ("s" " StoreLink" item
	     (clock)
	     "- %A\n"
	     :immediate t :prepend t)
	    ("l" " TaskLink" entry
	     (file+headline ladicle/get-today-diary "Goal")
	     "** %?\n%A\n")
	    ;; code-reading
	    ("c" " CodeLink" entry
	     (file+headline ladicle/get-today-diary "Code")
	     ;;(file+headline ladicle/get-today-diary "Code")
	     "** %? %(ladicle/code-metadata)\n%A\n")))

    ;; delete unused modules
    (setq org-modules (delete '(org-gnus org-w3m org-bbdb org-bibtex org-docview org-info org-irc org-mhe org-rmail org-eww) org-modules))
    ;; load org-protocol for capturing websites
    (use-package org-protocol
      :ensure nil)
    ;; load babel languages
    (org-babel-do-load-languages
	 'org-babel-load-languages
	 '((dot . t)
	   (plantuml . t)
	   (latex . t)
	   (R . t)))
    ;; Pretty bullets
    (use-package org-bullets
      :custom (org-bullets-bullet-list '("" "" "" "" "" "" "" "" "" ""))
      :hook (org-mode . org-bullets-mode))
  (use-package ox-hugo
    :after ox
    :custom
    (org-blackfriday--org-element-string '((src-block . "Code")
					      (table . "Table")
					      (figure . "Figure"))))
    ;; Download Drag&Drop images
    (use-package org-download)

  (with-eval-after-load 'hydra
    (eval-and-compile
      (defun hot-expand (str &optional mod)
	"Expand org template."
	(let (text)
	  (when (region-active-p)
	    (setq text (buffer-substring (region-beginning) (region-end)))
	    (delete-region (region-beginning) (region-end)))
	  (insert str)
	  (org-try-structure-completion)
	  (when mod (insert mod) (forward-line))
	  (when text (insert text)))))

    (defhydra hydra-org-template (:color blue :hint nil)
      "
_c_aption: _q_uote     _e_macs-lisp    _L_aTeX:
_l_ink:    ^ ^         _f_ish          _i_nfo
_a_scii    _v_erse     ip_Y_thon       _I_NCLUDE:
_s_rc      _g_o        _r_uby          _H_TML:
_h_tml     _S_HELL     _p_erl          _A_SCII:
_n_ote     ^ ^         _P_erl tangled  plant_u_ml
"
      ("s" (hot-expand "<s"))
      ("q" (hot-expand "<q"))
      ("v" (hot-expand "<v"))
      ("c" (hot-expand "<c"))
      ("h" (hot-expand "<h"))
      ("a" (hot-expand "<a"))
      ("L" (hot-expand "<L"))
      ("i" (hot-expand "<i"))
      ("c" (insert "#+CAPTION: "))
      ("l" (insert "#+NAME: "))
      ("n" (insert "#+BEGIN_NOTE\n\n#+END_NOTE"))
      ("n" (insert "#+BEGIN_INFO\n\n#+END_INFO"))
      ("e" (hot-expand "<s" "emacs-lisp"))
      ("f" (hot-expand "<s" "fish"))
      ("b" (hot-expand "<s" "bash"))
      ("Y" (hot-expand "<s" "ipython :session :exports both :results raw drawer\n$0"))
      ("g" (hot-expand "<s" "go"))
      ("p" (hot-expand "<s" "perl"))
      ("r" (hot-expand "<s" "ruby"))
      ("S" (hot-expand "<s" "sh"))
      ("u" (hot-expand "<s" "plantuml :file CHANGE.png"))
      ("P" (progn
	     (insert "#+HEADERS: :results output :exports both :shebang \"#!/usr/bin/env perl\"\n")
	     (hot-expand "<s" "perl")))
      ("I" (hot-expand "<I"))
      ("H" (hot-expand "<H"))
      ("A" (hot-expand "<A"))
      ("<" self-insert-command "ins")
      ("q" nil "quit"))

    (bind-key "<"
	      (lambda () (interactive)
		(if (or (region-active-p) (looking-back "^\s*" 1))
		    (hydra-org-template/body)
		  (self-insert-command 1)))
	      org-mode-map))
)

1.14.5 R

(use-package ess
  :disabled
  :custom (ess-ask-for-ess-directory nil)
  :config
  (require 'ess-site))

1.14.6 HTML/CSS/JS

(use-package js2-mode
  :mode ("\\.js\\'" . js2-mode))

1.14.7 Protobuf

(use-package protobuf-mode
  :mode "\\.proto$")

1.14.8 Fish

(use-package fish-mode
  :mode "\\.fish\\'")

1.14.9 Markdown

(use-package markdown-mode
  :custom
  (markdown-hide-markup nil)
  (markdown-bold-underscore t)
  (markdown-italic-underscore t)
  (markdown-header-scaling t)
  (markdown-indent-function t)
  (markdown-enable-math t)
  (markdown-hide-urls nil)
  :custom-face
  (markdown-header-delimiter-face ((t (:foreground "mediumpurple"))))
  (markdown-header-face-1 ((t (:foreground "violet" :weight bold :height 1.0))))
  (markdown-header-face-2 ((t (:foreground "lightslateblue" :weight bold :height 1.0))))
  (markdown-header-face-3 ((t (:foreground "mediumpurple1" :weight bold :height 1.0))))
  (markdown-link-face ((t (:background "#0e1014" :foreground "#bd93f9"))))
  (markdown-list-face ((t (:foreground "mediumpurple"))))
  (markdown-pre-face ((t (:foreground "#bd98fe"))))
  :mode "\\.md\\'")

1.14.10 Log

(use-package logview :defer t)

1.14.11 Systemd

(use-package systemd
  :mode
  ("\\.service\\'" "\\.timer\\'" "\\.target\\'" "\\.mount\\'"
   "\\.automount\\'" "\\.slice\\'" "\\.socket\\'" "\\.path\\'"
   "\\.netdev\\'" "\\.network\\'" "\\.link\\'"))

1.14.12 YAML

(use-package yaml-mode
  :mode ("\\.yaml\\'" "\\.yml\\'")
  :custom-face
  (font-lock-variable-name-face ((t (:foreground "violet")))))

1.14.13 Bazel

(use-package bazel-mode :defer t)

1.14.14 Dockerfile

(use-package dockerfile-mode
  :mode "\\Dockerfile\\'")

1.15 Custom Functions

1.15.1 Change letter case

(defun upcase-backward-word (arg)
  (interactive "p")
  (upcase-word (- arg)))

(defun downcase-backward-word (arg)
  (interactive "p")
  (downcase-word (- arg)))

(defun capitalize-backward-word (arg)
  (interactive "p")
  (capitalize-word (- arg)))

(global-set-key (kbd "C-M-u")	 'upcase-backward-word)
(global-set-key (kbd "C-M-l")	 'downcase-backward-word)
(global-set-key (kbd "M-c")	 'capitalize-backward-word)

1.15.2 Change smart Kill-word

(defun kill-word-at-point ()
  (interactive)
  (let ((char (char-to-string (char-after (point)))))
    (cond
     ((string= " " char) (delete-horizontal-space))
     ((string-match "[\t\n -@\[-`{-~],.、。" char) (kill-word 1))
     (t (forward-char) (backward-word) (kill-word 1)))))

(global-set-key (kbd "M-d")  'kill-word-at-point)

1.15.3 Kill word or Region

(defun backward-kill-word-or-region (&optional arg)
  (interactive "p")
  (if (region-active-p)
      (call-interactively #'kill-region)
    (backward-kill-word arg)))

(global-set-key (kbd "C-w")  'backward-kill-word-or-region)

1.15.4 Add execution flag to a file with shelbang

(defun add-chmod()
    (interactive)
    (save-restriction
      (widen)
      (let ((name (buffer-file-name)))
	(if (and (not (string-match ":" name))
		 (not (string-match "/\\.[^/]+$" name))
		 (equal "#!" (buffer-substring 1 (min 3 (point-max)))))
	    (progn (set-file-modes name (logior (file-modes name) 73))
		   (message "Wrote %s (chmod +x)" name))))))

(add-hook 'after-save-hook
	  'executable-make-buffer-file-executable-if-script-p)

1.15.5 Copy file path

(defun put-current-path-to-clipboard ()
    (interactive)
    (let ((file-path buffer-file-name)
	  (dir-path default-directory))
      (cond (file-path
	     (kill-new (expand-file-name file-path))
	     (message "This file path is on the clipboard!"))
	    (dir-path
	     (kill-new (expand-file-name dir-path))
	     (message "This directory path is on the clipboard!"))
	    (t
	     (error-message-string "Fail to get path name.")))))

  (defun put-current-filename-to-clipboard ()
    (interactive)
    (let ((file-path buffer-file-name)
	  (dir-path default-directory))
      (cond (file-path
	     (kill-new (file-name-nondirectory file-path))
	     (message "This file path is on the clipboard!"))
	    (dir-path
	     (kill-new (file-name-nondirectory dir-path))
	     (message "This directory path is on the clipboard!"))
	    (t
	     (error-message-string "Fail to get path name.")))))

  (defun put-current-filename-with-line-to-clipboard ()
    (interactive)
    (let ((file-path buffer-file-name)
	  (dir-path default-directory))
      (cond (file-path
	     (kill-new (format "%s:%s"
			       (file-name-nondirectory file-path)
			       (count-lines (point-min) (point))))
	     (message "This file path is on the clipboard!"))
	    (dir-path
	     (kill-new (file-name-nondirectory dir-path))
	     (message "This directory path is on the clipboard!"))
	    (t
	     (error-message-string "Fail to get path name.")))))

1.16 UI

1.16.1 Dashboard

(use-package dashboard
  :diminish
  (dashboard-mode page-break-lines-mode)
  :custom
  (dashboard-startup-banner 4)
  (dashboard-items '((recents . 15)
		     (projects . 5)
		     (bookmarks . 5)
		     (agenda . 5)))
  :hook
  (after-init . dashboard-setup-startup-hook)
  :config
  (add-to-list 'dashboard-items '(agenda) t))

1.16.2 General

;; Change cursor style
(add-to-list 'default-frame-alist '(cursor-type . bar))
;; vertical border
(let ((display-table (or standard-display-table (make-display-table))))
  (set-display-table-slot display-table 'vertical-border (make-glyph-code ?│)) ; or ┃
  (setq standard-display-table display-table))
(set-face-background 'vertical-border "#0e0f1b")
(set-face-foreground 'vertical-border (face-background 'vertical-border))

1.16.3 imenu-list

(use-package imenu-list
  :bind
  ("<f10>" . imenu-list-smart-toggle)
  :custom-face
  (imenu-list-entry-face-1 ((t (:foreground "white"))))
  :custom
  (imenu-list-focus-after-activation t)
  (imenu-list-auto-resize nil))

1.16.4 Trancepancy

(defun ladicle/toggle-window-transparency ()
  "Cycle the frame transparency from default to transparent."
  (interactive)
  (if (and (not (eq (frame-parameter nil 'alpha) nil))
	   (< (frame-parameter nil 'alpha) cft--non-transparent))
      (set-frame-parameter nil 'alpha 100)
    (set-frame-parameter nil 'alpha 90)))

(global-set-key (kbd "M-t t") 'ladicle/toggle-window-transparency)

1.16.5 Icons

(use-package all-the-icons :defer t)

1.16.6 Minimap

(use-package minimap
  :commands
  (minimap-bufname minimap-create minimap-kill)
  :custom
  (minimap-major-modes '(prog-mode))
  (minimap-window-location 'right)
  (minimap-update-delay 0.2)
  (minimap-minimum-width 20)
  :bind
  ("M-t m" . ladicle/toggle-minimap)
  :preface
  (defun ladicle/toggle-minimap ()
    "Toggle minimap for current buffer."
    (interactive)
    (if (null minimap-bufname)
	(minimap-create)
      (minimap-kill)))
  :config
  (custom-set-faces
   '(minimap-active-region-background
    ((((background dark)) (:background "#555555555555"))
      (t (:background "#C847D8FEFFFF"))) :group 'minimap)))

1.16.7 Neotree

(use-package neotree
  :after
  projectile
  :commands
  (neotree-show neotree-hide neotree-dir neotree-find)
  :custom
  (neo-theme 'nerd2)
  :bind
  ("<f8>" . neotree-current-dir-toggle)
  ("<f9>" . neotree-projectile-toggle)
  :preface
  (defun neotree-projectile-toggle ()
    (interactive)
    (let ((project-dir
	   (ignore-errors
	   ;;; Pick one: projectile or find-file-in-project
	     (projectile-project-root)
	     ))
	  (file-name (buffer-file-name))
	  (neo-smart-open t))
      (if (and (fboundp 'neo-global--window-exists-p)
	       (neo-global--window-exists-p))
	  (neotree-hide)
	(progn
	  (neotree-show)
	  (if project-dir
	      (neotree-dir project-dir))
	  (if file-name
	      (neotree-find file-name))))))
  (defun neotree-current-dir-toggle ()
    (interactive)
    (let ((project-dir
	   (ignore-errors
	     (ffip-project-root)
	     ))
	  (file-name (buffer-file-name))
	  (neo-smart-open t))
      (if (and (fboundp 'neo-global--window-exists-p)
	       (neo-global--window-exists-p))
	  (neotree-hide)
	(progn
	  (neotree-show)
	  (if project-dir
	      (neotree-dir project-dir))
	  (if file-name
	      (neotree-find file-name)))))))

1.16.8 Doom dracula Theme/Modeline

(use-package doom-themes
  :custom
  (doom-themes-enable-italic t)
  (doom-themes-enable-bold t)
  :custom-face
  (doom-modeline-bar ((t (:background "#6272a4"))))
  :config
  (load-theme 'doom-dracula t)
  (doom-themes-neotree-config)
  (doom-themes-org-config)
  ;; Modeline
  (use-package doom-modeline
    :custom
    (doom-modeline-buffer-file-name-style 'truncate-with-project)
    (doom-modeline-icon t)
    (doom-modeline-major-mode-icon nil)
    (doom-modeline-minor-modes nil)
    :hook
    (after-init . doom-modeline-mode)
    :config
    (set-cursor-color "cyan")
    (line-number-mode 0)
    (column-number-mode 0)
    (doom-modeline-def-modeline 'main
      '(bar workspace-number window-number evil-state god-state ryo-modal xah-fly-keys matches buffer-info remote-host buffer-position parrot selection-info)
      '(misc-info persp-name lsp github debug minor-modes input-method major-mode process vcs checker))))

1.16.9 Nyan-mode

(use-package nyan-mode
   :custom
   (nyan-cat-face-number 4)
   (nyan-animate-nyancat t)
   :hook
   (doom-modeline-mode . nyan-mode))

1.16.10 Hide Modeline

(use-package hide-mode-line
  :hook
  ((neotree-mode imenu-list-minor-mode minimap-mode) . hide-mode-line-mode))

1.16.11 Line number

(use-package display-line-numbers
  :ensure nil
  :hook
  ((prog-mode yaml-mode systemd-mode) . display-line-numbers-mode))

1.16.12 Dimmer

(use-package dimmer
  :disabled
  :custom
  (dimmer-fraction 0.5)
  (dimmer-exclusion-regexp-list
       '(".*Minibuf.*"
	 ".*which-key.*"
	 ".*NeoTree.*"
	 ".*Messages.*"
	 ".*Async.*"
	 ".*Warnings.*"
	 ".*LV.*"
	 ".*Ilist.*"))
  :config
  (dimmer-mode t))

1.16.13 fill-column-indicator

(use-package fill-column-indicator
  :hook
  ((markdown-mode
    git-commit-mode) . fci-mode))

1.17 High-Lights

1.17.1 Highlight Line

(use-package hl-line
  :ensure nil
  :hook
  (after-init . global-hl-line-mode))

1.17.2 Paren

(use-package paren
  :ensure nil
  :hook
  (after-init . show-paren-mode)
  :custom-face
  (show-paren-match ((nil (:background "#44475a" :foreground "#f1fa8c")))) ;; :box t
  :custom
  (show-paren-style 'mixed)
  (show-paren-when-point-inside-paren t)
  (show-paren-when-point-in-periphery t))

1.17.3 Highlight-symbol

(use-package highlight-symbol
  :bind
  (:map prog-mode-map
  ("M-o h" . highlight-symbol)
  ("M-p" . highlight-symbol-prev)
  ("M-n" . highlight-symbol-next)))

1.17.4 Beacon

(use-package beacon
  :custom
  (beacon-color "#f1fa8c")
  :hook (after-init . beacon-mode))

1.17.5 Rainbow delimiters

(use-package rainbow-delimiters
  :hook
  (prog-mode . rainbow-delimiters-mode))

1.17.6 Rainbow Mode

(use-package rainbow-mode
  :diminish
  :hook (emacs-lisp-mode . rainbow-mode))

1.17.7 Volatile

(use-package volatile-highlights
  :diminish
  :hook
  (after-init . volatile-highlights-mode)
  :custom-face
  (vhl/default-face ((nil (:foreground "#FF3333" :background "#FFCDCD")))))

1.17.8 Indent

(use-package highlight-indent-guides
  :diminish
  :hook
  ((prog-mode yaml-mode) . highlight-indent-guides-mode)
  :custom
  (highlight-indent-guides-auto-enabled t)
  (highlight-indent-guides-responsive t)
  (highlight-indent-guides-method 'character)) ; column

1.18 Mark

1.18.1 backward-forward

(use-package backward-forward
  :bind
  ("C-," . backward-forward-previous-location)
  ("C-." . backward-forward-next-location)
  :custom
  (mark-ring-max 60)
  (set-mark-command-repeat-pop t)
  :config
  (backward-forward-mode t))
.