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

  (setq load-prefer-newer t
        package-user-dir "~/Developments/src/"
        package--init-file-ensured t
        package-enable-at-startup nil)

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

  (require 'package)
  (add-to-list 'package-archives '("gnu" . "") t)
  (add-to-list 'package-archives '("melpa" . "") t)
  (add-to-list 'package-archives '("org" . "") t)

  (unless (package-installed-p 'use-package)
    (package-install 'use-package)
    (package-install 'diminish)
    (package-install 'quelpa)
    (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)
(setq split-width-threshold 160)

;; Default Encoding
(prefer-coding-system 'utf-8-unix)
(set-locale-environment "en_US.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'
(setq-default indent-tabs-mode nil)   ; use space
(defalias 'yes-or-no-p #'y-or-n-p)

(when (functionp 'mac-auto-ascii-mode)
  (mac-auto-ascii-mode 1))

;; 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
  :hook (after-init . global-auto-revert-mode))

;; Hungry deletion
(use-package hungry-delete
  :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
  (after-init . smartparens-global-mode)
  (require 'smartparens-config)
  (sp-pair "=" "=" :actions '(wrap))
  (sp-pair "+" "+" :actions '(wrap))
  (sp-pair "<" ">" :actions '(wrap))
  (sp-pair "$" "$" :actions '(wrap)))

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)
  (recentf-max-saved-items 20000000)
  (recentf-auto-cleanup 'never)
  (recentf-exclude '((expand-file-name package-user-dir)
  (defun ladicle/recentf-save-list-silence ()
    (let ((message-log-max nil))
      (if (fboundp 'shut-up)
          (shut-up (recentf-save-list))
    (message ""))
  (defun ladicle/recentf-cleanup-silence ()
    (let ((message-log-max nil))
      (if shutup-p
          (shut-up (recentf-cleanup))
    (message ""))
  (focus-out-hook . (ladicle/recentf-save-list-silence ladicle/recentf-cleanup-silence)))

1.4.5 GUI/Font

font-size check

|abcdef ghijkl|
|'";:-+ =/\~`?|
|∞≤≥∏∑∫ ×±⊆⊇|
|αβγδεζ ηθικλμ|
|日本語 の美観|
|あいう えおか|
|アイウ エオカ|
|アイウエオカ キクケコサシ|

| hoge                 | hogeghoe | age               |
| 今日もいい天気ですね | お、     | 等幅になった 👍 |
(if window-system
      ;; 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) '(#x2500 . #x2500) (font-spec :family family)) ; ─
        (set-fontset-font (frame-parameter nil 'font) '(#x2504 . #x257F) (font-spec :family family)) ; box character
        (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
  (exec-path-from-shell-check-startup-files nil)
  (exec-path-from-shell-variables '("PATH" "GOPATH"))
  (when (memq window-system '(mac ns x))
  1. Linux
1.   xclip

    (use-package xclip
      :if (eq system-type 'gnu/linux)
      (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))
      (defun mozc-start()
        (set-cursor-color "#ff79c6")
        (message "Mozc start")
        (mozc-mode 1))
      (defun mozc-end()
        (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))
      (mozc-mode 1)
      ;; Show candidates style
      (use-package mozc-popup
        :custom (mozc-candidates-style "popup")))
  1. 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
      '((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.4.7 Icons

(use-package all-the-icons
  :defer t
  :load-path "~/Developments/src/")

1.4.8 posframe

(use-package posframe)

1.4.9 point

(use-package popwin)
(use-package point-history
  :load-path "~/Developments/src/"
  (point-history-mode t))

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

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

1.5.5 Hydra

(use-package hydra
  (use-package hydra-posframe
    :load-path "~/Developments/src/"
      '((left-fringe . 5)
        (right-fringe . 5)))
    (hydra-posframe-border-face ((t (:background "#6272a4"))))
    :hook (after-init . hydra-posframe-enable)))

1.6 Undo/Redo

(use-package undo-tree
  ("M-/" . undo-tree-redo)

1.7 Search/Replace

1.7.1 Projectile

(use-package projectile
  ("M-o p" . counsel-projectile-switch-project)
  (projectile-mode +1))

1.7.2 Wgrep

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

1.7.3 Ag

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

1.7.4 Ivy

  (use-package counsel
    :diminish ivy-mode counsel-mode
    (projectile-completion-system magit-completing-read-function)
    (("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)
    ("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))
    (defun ivy-format-function-pretty (cands)
      "Transform CANDS into a string for minibuffer."
       (lambda (str)
             (all-the-icons-faicon "hand-o-right" :height .85 :v-adjust .05 :face 'font-lock-constant-face)
             (ivy--add-face str 'ivy-current-match)))
       (lambda (str)
         (concat "  " str))
    (after-init . ivy-mode)
    (ivy-mode . counsel-mode)
    (counsel-yank-pop-height 15)
    (enable-recursive-minibuffers t)
    (ivy-use-selectable-prompt t)
    (ivy-use-virtual-buffers t)
    (ivy-on-del-error-function nil)
    (swiper-action-recenter t)
    (counsel-grep-base-command "ag -S --noheading --nocolor --nofilename --numbers '%s' %s")
    ;; using ivy-format-fuction-arrow with counsel-yank-pop
    (lambda (cand-pairs)
       (lambda (str)
          (lambda (s)
            (ivy--add-face (concat (propertize "┃ " 'face `(:foreground "#61bfff")) s) 'ivy-current-match))
           (counsel--yank-pop-truncate str) "\n" t)
       (lambda (str)
         (counsel--yank-pop-truncate str))

    ;; NOTE: this variable do not work if defined in :custom
    (setq ivy-format-function 'ivy-format-function-pretty)
    (setq counsel-yank-pop-separator
        (propertize "\n────────────────────────────────────────────────────────\n"
               'face `(:foreground "#6272a4")))

    ;; 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))

  ;; Show ivy frame using posframe
  (use-package ivy-posframe
    (ivy-display-function #'ivy-posframe-display-at-frame-center)
    ;; (ivy-posframe-width 130)
    ;; (ivy-posframe-height 11)
      '((left-fringe . 5)
        (right-fringe . 5)))
    (ivy-posframe ((t (:background "#282a36"))))
    (ivy-posframe-border ((t (:background "#6272a4"))))
    (ivy-posframe-cursor ((t (:background "#61bfff"))))
    (ivy-mode . ivy-posframe-enable))

  ;; ghq
  (use-package ivy-ghq
    :load-path "~/Developments/src/"
    :commands (ivy-ghq-open)
    ("M-o p" . ivy-ghq-open-and-fzf)
    (ivy-ghq-short-list t)
    (defun ivy-ghq-open-and-fzf ()

  ;; More friendly display transformer for Ivy
  (use-package ivy-rich
    :defines (all-the-icons-dir-icon-alist bookmark-alist)
    :functions (all-the-icons-icon-family
    (defun ivy-rich-bookmark-name (candidate)
      (car (assoc candidate bookmark-alist)))

    (defun ivy-rich-repo-icon (candidate)
      "Display repo icons in `ivy-rich`."
      (all-the-icons-octicon "repo" :height .9))

    (defun ivy-rich-org-capture-icon (candidate)
      "Display repo icons in `ivy-rich`."
      (pcase (car (last (split-string (car (split-string candidate)) "-")))
         ("emacs" (all-the-icons-fileicon "emacs" :height .68 :v-adjust .001))
         ("schedule" (all-the-icons-faicon "calendar" :height .68 :v-adjust .005))
         ("tweet" (all-the-icons-faicon "commenting" :height .7 :v-adjust .01))
         ("link" (all-the-icons-faicon "link" :height .68 :v-adjust .01))
         ("memo" (all-the-icons-faicon "pencil" :height .7 :v-adjust .01))
         (_       (all-the-icons-octicon "inbox" :height .68 :v-adjust .01))

    (defun ivy-rich-org-capture-title (candidate)
      (let* ((octl (split-string candidate))
             (title (pop octl))
             (desc (mapconcat 'identity octl " ")))
        (format "%-25s %s"
                 (propertize desc 'face `(:inherit font-lock-doc-face)))))

    (defun ivy-rich-buffer-icon (candidate)
      "Display buffer icons in `ivy-rich'."
      (when (display-graphic-p)
        (when-let* ((buffer (get-buffer candidate))
                    (major-mode (buffer-local-value 'major-mode buffer))
                    (icon (if (and (buffer-file-name buffer)
                                   (all-the-icons-auto-mode-match? candidate))
                              (all-the-icons-icon-for-file candidate)
                            (all-the-icons-icon-for-mode major-mode))))
          (if (symbolp icon)
              (setq icon (all-the-icons-icon-for-mode 'fundamental-mode)))
          (unless (symbolp icon)
            (propertize icon
                        'face `(
                                :height 1.1
                                :family ,(all-the-icons-icon-family icon)

    (defun ivy-rich-file-icon (candidate)
      "Display file icons in `ivy-rich'."
      (when (display-graphic-p)
        (let ((icon (if (file-directory-p candidate)
                         ((and (fboundp 'tramp-tramp-file-p)
                               (tramp-tramp-file-p default-directory))
                          (all-the-icons-octicon "file-directory"))
                         ((file-symlink-p candidate)
                          (all-the-icons-octicon "file-symlink-directory"))
                         ((all-the-icons-dir-is-submodule candidate)
                          (all-the-icons-octicon "file-submodule"))
                         ((file-exists-p (format "%s/.git" candidate))
                          (all-the-icons-octicon "repo"))
                         (t (let ((matcher (all-the-icons-match-to-alist candidate all-the-icons-dir-icon-alist)))
                              (apply (car matcher) (list (cadr matcher))))))
                      (all-the-icons-icon-for-file candidate))))
          (unless (symbolp icon)
            (propertize icon
                        'face `(
                                :height 1.1
                                :family ,(all-the-icons-icon-family icon)
    :hook (ivy-rich-mode . (lambda ()
                             (setq ivy-virtual-abbreviate
                                   (or (and ivy-rich-mode 'abbreviate) 'name))))
    (setq ivy-rich-display-transformers-list
              (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))))))
             (lambda (cand) (get-buffer cand)))
              (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))))))
             (lambda (cand) (get-buffer cand)))
             ((counsel-M-x-transformer (:width 40))
              (ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
             ((counsel-describe-function-transformer (:width 45))
              (ivy-rich-counsel-function-docstring (:face font-lock-doc-face))))
             ((counsel-describe-variable-transformer (:width 45))
              (ivy-rich-counsel-variable-docstring (:face font-lock-doc-face))))
              (ivy-rich-candidate (:width 110))))
              (ivy-rich-bookmark-name (:width 30))
              (ivy-rich-bookmark-info (:width 80))))

    (setq ivy-rich-parse-remote-buffer nil)
    (ivy-rich-mode 1))

1.7.5 Anzu

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

1.7.6 Migemo

(use-package migemo
  (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")
  (when (eq system-type 'darwin)
    (setq migemo-dictionary "/usr/local/share/migemo/utf-8/migemo-dict"))
  (use-package avy-migemo
    :after swiper
    ;; (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
  ("M-u" . hydra-multiple-cursors/body)
  ;; insert specific serial number
  (defvar ladicle/mc/insert-numbers-hist nil)
  (defvar ladicle/mc/insert-numbers-inc 1)
  (defvar ladicle/mc/insert-numbers-pad "%01d")

  (defun ladicle/mc/insert-numbers (start inc pad)
    "Insert increasing numbers for each cursor specifically."
     (list (read-number "Start from: " 0)
           (read-number "Increment by: " 1)
           (read-string "Padding (%01d): " nil ladicle/mc/insert-numbers-hist "%01d")))
    (setq mc--insert-numbers-number start)
    (setq ladicle/mc/insert-numbers-inc inc)
    (setq ladicle/mc/insert-numbers-pad pad)

  (defun ladicle/mc--insert-number-and-increase ()
    (insert (format ladicle/mc/insert-numbers-pad mc--insert-numbers-number))
    (setq mc--insert-numbers-number (+ mc--insert-numbers-number ladicle/mc/insert-numbers-inc)))

  (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_] 0...
     ^↑^    ^↑^     ^↑^     [_m_] mark all    [_a_] letters
    mark^^ skip^^^ un-mk^   [_s_] sort        [_n_] numbers
     ^↓^    ^↓^     ^↓^
     _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)
          ("n" ladicle/mc/insert-numbers :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)
    ("C-'"   . avy-resume)
    ("C-:"   . avy-goto-char-2-below)
    ("C-;"   . avy-goto-char)
    ("M-j"   . hydra-avy/body)
    ("C-M-v" . hydra-viewer/body)
    ;; 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 ()
      (copy-region-as-kill (region-beginning) (region-end)))
    (when (eq system-type 'darwin)
        (global-set-key (kbd "C-:") 'avy-goto-char)
        (global-set-key (kbd "C-;") 'avy-goto-char-2-below)))

    (use-package avy-zap
      ("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
    ("C-M-o" . hydra-frame-window/body)
    ("M-t m" . ladicle/toggle-window-maximize)
    (aw-keys '(?j ?k ?l ?i ?o ?h ?y ?u ?p))
    (aw-leading-char-face ((t (:height 4.0 :foreground "#f1fa8c"))))
    (defvar is-window-maximized nil)
    (defun ladicle/toggle-window-maximize ()
          (if is-window-maximized
          (setq is-window-maximized
                (not is-window-maximized))))
    (defun hydra-title(title) (propertize title 'face `(:inherit font-lock-warning-face :weight bold)))
    (defun command-name(title) (propertize title 'face `(:foreground "#f8f8f2")))
    (defun spacer() (propertize "." 'face `(:foreground "#282a36")))
    (use-package rotate
        :load-path "~/Developments/src/"
        ("M-o SPC" . rotate-layout))
    (with-eval-after-load 'hydra
        (defhydra hydra-frame-window (:color blue :hint nil)
         (format "%s" (propertize "                                                                       ╔════════╗
    ((%s))^^^^^^^^   ((%s))^^^^  ((%s))^^  ((%s))^^  ((%s))^^^^^^  ((%s))^   ║ Window ║
^^^^^^ ──────────────────────────────────────────────────────────────────────╨────────╜
        ^_k_^        %s_+_         _-_       %s     _,_ ← %s → _._^  %s
        ^^↑^^          ^↑^         ^↑^       %s
    _h_ ←   → _l_   ^^%s%s^^^^^    ^%s    ^^^%s^^^^     %s
        ^^↓^^          ^↓^         ^↓^       %s^^       %s
        ^_j_^        %s_=_         _/_       %s
^^^^^^ ┌──────────────────────────────────────────────────────────────────────────────┘
                           [_q_]: %s, [_<SPC>_]: %s" 'face `(:inherit font-lock-doc-face)))
                           (hydra-title "Size")
                           (hydra-title "Zoom")
                           (hydra-title "Split")
                           (hydra-title "Window")
                           (hydra-title "Buffer")
                           (hydra-title "Misc")
                           (all-the-icons-material "zoom_in" :height .85 :face 'font-lock-doc-face)
                           (command-name "_o_ther")
                           (command-name "page")
                           (command-name "_r_centf")
                           (command-name "_s_wap")
                           (all-the-icons-faicon "slideshare" :height .85 :face 'font-lock-doc-face)
                           (command-name "_p_mode")
                           (command-name "w_i_ndow")
                           (command-name "_m_aximize")
                           (command-name "_s_witch")
                           (command-name "_d_elete")
                           (command-name "_D_elete")
                           (all-the-icons-material "zoom_out" :height .85 :face 'font-lock-doc-face)
                           (command-name "del_O_thers")
                           (command-name "quit")
                           (command-name "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)
          ("=" text-scale-decrease)
          ("+" 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)
          ("p" presentation-mode)
          ("r" counsel-recentf :exit t)
          ("s" switch-to-buffer :exit t)
          ("D" kill-buffer-and-window)
          ("<SPC>" rotate-layout)
          ("q" nil)))

1.8.3 Smart move

(use-package mwim
  ("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-posframe
  :load-path "~/Developments/src/"
  (flymake-posframe-error-prefix " ")
  (flymake-posframe-foreground-face ((t (:foreground "white"))))
  :hook (flymake-mode . flymake-posframe-mode))

(use-package flymake-diagnostic-at-point
  :after flymake
  (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
  (flymake-mode . flymake-diagnostic-at-point-mode))

1.9.2 flyspell

(use-package flyspell
  :if (executable-find "aspell")
  ((org-mode yaml-mode markdown-mode git-commit-mode) . flyspell-mode)
  (prog-mode . flyspell-prog-mode)
  (before-save-hook . flyspell-buffer)
  (flyspell-mode . (lambda ()
                     (dolist (key '("C-;" "C-," "C-."))
                       (unbind-key key flyspell-mode-map))))
  (flyspell-issue-message-flag nil)
  (ispell-program-name "aspell")
  (ispell-extra-args '("--sug-mode=ultra" "--lang=en_US" "--run-together"))
  (flyspell-incorrect ((t (:underline (:color "#f1fa8c" :style wave)))))
  (flyspell-duplicate ((t (:underline (:color "#50fa7b" :style wave)))))
  (defun message-off-advice (oldfun &rest args)
    "Quiet down messages in adviced OLDFUN."
    (let ((message-off (make-symbol "message-off")))
            (advice-add #'message :around #'ignore (list 'name message-off))
            (apply oldfun args))
        (advice-remove #'message message-off))))
  (advice-add #'ispell-init-process :around #'message-off-advice)
  (use-package flyspell-correct-ivy
    :bind ("C-M-:" . flyspell-correct-at-point)
    (when (eq system-type 'darwin)
        (global-set-key (kbd "C-M-;") 'flyspell-correct-at-point)))
    (setq flyspell-correct-interface #'flyspell-correct-ivy)))

1.10 Project

1.10.1 persp

(use-package persp-mode
  :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))
  (persp-keymap-prefix (kbd "C-x p"))
  (persp-nil-name "default")
  (persp-set-last-persp-for-new-frames nil)
  (persp-auto-resume-time 0)
  ;; NOTE: Redefine `persp-add-new' to address.
  ;; Issue: Unable to create/handle persp-mode
  (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)
      (message "[persp-mode] Error: Can't create a perspective with empty name.")

  ;; 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))

    (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
  (company-dabbrev-ignore-case company-dabbrev-downcase)
  (: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))
  (company-idle-delay 0)
  (company-echo-delay 0)
  (company-minimum-prefix-length 1)
  (after-init . global-company-mode)
  (plantuml-mode . (lambda () (set (make-local-variable 'company-backends)
                               ;; company-dabbrev
    objc-mode) . (lambda () (set (make-local-variable 'company-backends)
                               ;; company-dabbrev-code
  ;; using child frame
  (use-package company-posframe
    :hook (company-mode . company-posframe-mode))
  ;; Show pretty icons
  (use-package company-box
    :hook (company-mode . company-box-mode)
    :init (setq company-box-icons-alist 'company-box-icons-all-the-icons)
    (setq company-box-backends-colors nil)
    (setq company-box-show-single-candidate t)
    (setq company-box-max-candidates 50)

    (defun company-box-icons--elisp (candidate)
      (when (derived-mode-p 'emacs-lisp-mode)
        (let ((sym (intern candidate)))
          (cond ((fboundp sym) 'Function)
                ((featurep sym) 'Module)
                ((facep sym) 'Color)
                ((boundp sym) 'Variable)
                ((symbolp sym) 'Text)
                (t . nil)))))

    (with-eval-after-load 'all-the-icons
      (declare-function all-the-icons-faicon 'all-the-icons)
      (declare-function all-the-icons-fileicon 'all-the-icons)
      (declare-function all-the-icons-material 'all-the-icons)
      (declare-function all-the-icons-octicon 'all-the-icons)
      (setq company-box-icons-all-the-icons
            `((Unknown . ,(all-the-icons-material "find_in_page" :height 0.7 :v-adjust -0.15))
              (Text . ,(all-the-icons-faicon "book" :height 0.68 :v-adjust -0.15))
              (Method . ,(all-the-icons-faicon "cube" :height 0.7 :v-adjust -0.05 :face 'font-lock-constant-face))
              (Function . ,(all-the-icons-faicon "cube" :height 0.7 :v-adjust -0.05 :face 'font-lock-constant-face))
              (Constructor . ,(all-the-icons-faicon "cube" :height 0.7 :v-adjust -0.05 :face 'font-lock-constant-face))
              (Field . ,(all-the-icons-faicon "tags" :height 0.65 :v-adjust -0.15 :face 'font-lock-warning-face))
              (Variable . ,(all-the-icons-faicon "tag" :height 0.7 :v-adjust -0.05 :face 'font-lock-warning-face))
              (Class . ,(all-the-icons-faicon "clone" :height 0.65 :v-adjust 0.01 :face 'font-lock-constant-face))
              (Interface . ,(all-the-icons-faicon "clone" :height 0.65 :v-adjust 0.01))
              (Module . ,(all-the-icons-octicon "package" :height 0.7 :v-adjust -0.15))
              (Property . ,(all-the-icons-octicon "package" :height 0.7 :v-adjust -0.05 :face 'font-lock-warning-face)) ;; Golang module
              (Unit . ,(all-the-icons-material "settings_system_daydream" :height 0.7 :v-adjust -0.15))
              (Value . ,(all-the-icons-material "format_align_right" :height 0.7 :v-adjust -0.15 :face 'font-lock-constant-face))
              (Enum . ,(all-the-icons-material "storage" :height 0.7 :v-adjust -0.15 :face 'all-the-icons-orange))
              (Keyword . ,(all-the-icons-material "filter_center_focus" :height 0.7 :v-adjust -0.15))
              (Snippet . ,(all-the-icons-faicon "code" :height 0.7 :v-adjust 0.02 :face 'font-lock-variable-name-face))
              (Color . ,(all-the-icons-material "palette" :height 0.7 :v-adjust -0.15))
              (File . ,(all-the-icons-faicon "file-o" :height 0.7 :v-adjust -0.05))
              (Reference . ,(all-the-icons-material "collections_bookmark" :height 0.7 :v-adjust -0.15))
              (Folder . ,(all-the-icons-octicon "file-directory" :height 0.7 :v-adjust -0.05))
              (EnumMember . ,(all-the-icons-material "format_align_right" :height 0.7 :v-adjust -0.15 :face 'all-the-icons-blueb))
              (Constant . ,(all-the-icons-faicon "tag" :height 0.7 :v-adjust -0.05))
              (Struct . ,(all-the-icons-faicon "clone" :height 0.65 :v-adjust 0.01 :face 'font-lock-constant-face))
              (Event . ,(all-the-icons-faicon "bolt" :height 0.7 :v-adjust -0.05 :face 'all-the-icons-orange))
              (Operator . ,(all-the-icons-fileicon "typedoc" :height 0.65 :v-adjust 0.05))
              (TypeParameter . ,(all-the-icons-faicon "hashtag" :height 0.65 :v-adjust 0.07 :face 'font-lock-const-face))
              (Template . ,(all-the-icons-faicon "code" :height 0.7 :v-adjust 0.02 :face 'font-lock-variable-name-face))))))
    ;; 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)
  (defun ladicle/diffview-dwim ()
    (if (region-active-p)
  :bind ("M-g v" . ladicle/diffview-dwim))

1.12.3 Magit

(use-package magit
  (magit-auto-revert-mode nil)
  ("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
    (git-gutter:modified-sign "~")		; 
    (git-gutter:added-sign    "+")		; 
    (git-gutter:deleted-sign  "-")		; 
    (git-gutter:modified ((t (:foreground "#f1fa8c" :background "#f1fa8c"))))
    (git-gutter:added    ((t (:foreground "#50fa7b" :background "#50fa7b"))))
    (git-gutter:deleted  ((t (:foreground "#ff79c6" :background "#ff79c6"))))
    (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
  (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 ()
       "Save and bury buffer" :color blue)
      ("q" nil "cancel" :color blue)))
  :hook ((find-file . (lambda ()
                          (goto-char (point-min))
                          (when (re-search-forward "^<<<<<<< " nil t)
                            (smerge-mode 1)))))
         (magit-diff-visit-file . (lambda ()
                                    (when smerge-mode

1.13 Tools

1.13.1 Google Translater

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

1.13.2 google this!

(use-package google-this)

1.13.3 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
  ;; 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 t) ;; t(flymake), nil(lsp-ui), or :none
  ;; go-client
  (lsp-clients-go-server-args '("--cache-style=always" "--diagnostics-style=onsave" "--format-style=goimports"))
  ((go-mode c-mode c++-mode) . lsp)
  (:map lsp-mode-map
  ("C-c r"   . lsp-rename))
  (require 'lsp-clients)
  ;; LSP UI tools
  (use-package lsp-ui
    ;; lsp-ui-doc
    (lsp-ui-doc-enable nil)
    (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
    (defun ladicle/toggle-lsp-ui-doc ()
      (if lsp-ui-doc-mode
          (lsp-ui-doc-mode -1)
         (lsp-ui-doc-mode 1)))
    (: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))
    (lsp-mode . lsp-ui-mode))

    (make-lsp-client :new-connection (lsp-stdio-connection
                                 (lambda () (cons "bingo"
                :major-modes '(go-mode)
                :priority 2
                :initialization-options 'lsp-clients-go--make-init-options
                :server-id 'go-bingo
                :library-folders-fn (lambda (_workspace)

  ;; DAP
  (use-package dap-mode
    (dap-go-debug-program `("node" "~/.extensions/go/out/src/debugAdapter/goDebug.js"))
    (dap-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=
    (use-package dap-ui
      :ensure nil
      (dap-ui-mode 1)))

  ;; Lsp completion
  (use-package company-lsp
    (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))
  (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
  (ccls-executable "/usr/local/bin/ccls")
  (ccls-sem-highlight-method 'font-lock)
  :hook ((c-mode c++-mode objc-mode) .
         (lambda () (require 'ccls) (lsp))))

1.14.4 PlantUML

(use-package plantuml-mode
  (plantuml-jar-path "~/.emacs.d/plantuml.jar")
  :mode "\\.uml\\'")

1.14.5 Org

  1. ob-async
(use-package ob-async
  :load-path "~/Developments/src/"
  (add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
  (add-hook 'ob-async-pre-execute-src-block-hook
      '(lambda ()
         (setq org-plantuml-jar-path "~/.emacs.d/plantuml.jar"))))
  1. screenshot
(defun my-org-screenshot ()
  "Take a screenshot into a time stamped unique-named file in the
same directory as the org-buffer and insert a link to this file."
  (setq filename
          (concat (file-name-nondirectory (buffer-file-name))
                  (format-time-string "%Y%m%d_%H%M%S_")) ) ".png"))
  (unless (file-exists-p (file-name-directory filename))
    (make-directory (file-name-directory filename)))
  ; take screenshot
  (if (eq system-type 'darwin)
      (call-process "screencapture" nil nil nil "-i" filename))
  (if (eq system-type 'gnu/linux)
      (call-process "import" nil nil nil filename))
  ; insert into file if correctly taken
  (if (file-exists-p filename)
    (insert (concat "[[file:" filename "]]"))))
  1. org
  (use-package org
    (org-src-fontify-natively t)
    (private-directory "~/Private/")
    (task-file (concat private-directory ""))
    (schedule-file (concat private-directory ""))
    (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 nil)
    (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)))
      '(: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 (
    (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" . counsel-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)))))
    (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))
    (org-mode . (lambda ()
                       (dolist (key '("C-'" "C-," "C-."))
                         (unbind-key key org-mode-map))))
    (defun ladicle/get-today-diary ()
      (concat private-directory
        (format-time-string "diary/%Y/%m/" (current-time))))
    (defun ladicle/get-yesterday-diary ()
      (concat private-directory
        (format-time-string "diary/%Y/%m/" (time-add (current-time) (* -24 3600)))))
    (defun ladicle/get-diary-from-cal ()
      (concat private-directory
        (format-time-string "diary/%Y/%m/"
          (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"
        (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))))
    ;; Pomodoro
    (use-package org-pomodoro
    :after org-agenda
    (org-pomodoro-ask-upon-killing t)
    (org-pomodoro-format "%s") ;;     
    (org-pomodoro-short-break-format "%s")
    (org-pomodoro-long-break-format  "%s")
    (org-pomodoro-mode-line ((t (:foreground "#ff5555"))))
    (org-pomodoro-mode-line-break   ((t (:foreground "#50fa7b"))))
    (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")))
    (when (eq system-type 'darwin)
      (setq alert-default-style 'osx-notifier))
    (require 'alert)

    :bind (:map org-agenda-mode-map
                ("p" . org-pomodoro)))

    (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
          '(("tweet" "Write down the thoughts of this moment with a timestamp." item
             (file+headline ladicle/get-today-diary "Log")
             "%(ladicle/org-get-time) %? \n")
            ;; memo
            ("memo" "Memorize something in the memo section of today's diary." entry
             (file+headline ladicle/get-today-diary "Memo")
             "** %? \n"
             :unnarrowed 1)
            ;; tasks
            ("inbox" "Create a general task to the inbox and jump to the task file." entry
             (file+headline "~/Private/" "Inbox")
             "** TODO %?"
             :jump-to-captured 1)
            ("interrupt-task" "Create an interrupt task to the inbox and start clocking." entry
             (file+headline "~/Private/" "Inbox")
             "** TODO %?"
             :jump-to-captured 1 :clock-in 1 :clock-resume 1)
            ("hack-emacs" "Collect hacking Emacs ideas!" item
             (file+headline "~/Private/" "Hacking Emacs")
             "- [ ] %?"
             :prepend t)
            ("private-schedule" "Add an event to the private calendar." entry
             (file+olp schedule-file "Calendar" "2019" "Private")
             "** %?\n   SCHEDULED: <%(org-read-date)>\n"
             :prepend t)
            ("work-schedule" "Add an event to the work calendar." entry
             (file+olp schedule-file "Calendar" "2019" "Work")
             "** %?\n   SCHEDULED: <%(org-read-date)>\n")
            ("store-link" "Store the link of the current position in the clocking task." item
             "- %A\n"
             :immediate t :prepend t)
            ;; code-reading
            ("code-link" "Store the code reading memo to today's diary with metadata." 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
         '((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
    (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
      (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)
          (when mod (insert mod) (forward-line))
          (when text (insert text)))))

    (defhydra hydra-org-template (:color blue :hint nil)
      (format "   %s^^     %s^^^^       %s^^^^^        %s
  %s _e_lisp      %s _h_ugo        %s plant_u_ml      %s _s_ource
  %s _r_uby       %s _c_aption     %s La_t_ex         %s _n_ote
  %s _f_ish       %s _l_ink        %s i_P_ython       %s _i_nfo
  %s _b_ash       %s %s^^^^^       %s %s^^^^          %s qu_o_te
  %s _g_o
  %s _y_aml
                     %s quit%s insert
(concat (propertize "((" 'face `(:foreground "#6272a4"))
        (propertize "CODE" 'face `(:foreground "#ff79c6" :weight bold))
        (propertize "))" 'face `(:foreground "#6272a4")))
(concat (propertize "((" 'face `(:foreground "#6272a4"))
        (propertize "META" 'face `(:foreground "#ff79c6" :weight bold))
        (propertize "))" 'face `(:foreground "#6272a4")))
(concat (propertize "((" 'face `(:foreground "#6272a4"))
        (propertize "DRAW" 'face `(:foreground "#ff79c6" :weight bold))
        (propertize "))" 'face `(:foreground "#6272a4")))
(concat (propertize "((" 'face `(:foreground "#6272a4"))
        (propertize "BLOCK" 'face `(:foreground "#ff79c6" :weight bold))
        (propertize "))" 'face `(:foreground "#6272a4")))

(propertize " ──────────────────────────────────────────────────────────── " 'face `(:foreground "#6272a4"))
;; L1
(all-the-icons-fileicon "emacs" :v-adjust .00001 :height .68 :face '(:foreground "#6272a4"))
(all-the-icons-material "web" :v-adjust -.1 :height .7 :face '(:foreground "#6272a4"))
(all-the-icons-material "format_shapes" :v-adjust -.15 :height .7 :face '(:foreground "#6272a4"))
(all-the-icons-octicon "code" :v-adjust -.05 :height .75  :face '(:foreground "#6272a4"))
;; L2
(all-the-icons-alltheicon "ruby-alt" :v-adjust .0505 :height .7 :face '(:foreground "#6272a4"))
(all-the-icons-faicon "flag" :v-adjust -.05 :height .69  :face '(:foreground "#6272a4"))
(all-the-icons-faicon "text-height" :v-adjust -.05 :height .69 :face '(:foreground "#6272a4"))
(all-the-icons-octicon "light-bulb" :v-adjust -.1 :height .78 :face '(:foreground "#6272a4"))
;; L3
(all-the-icons-alltheicon "script" :v-adjust .05 :height .7 :face '(:foreground "#6272a4"))
(all-the-icons-faicon "link" :v-adjust -.05 :height .69 :face '(:foreground "#6272a4"))
(all-the-icons-fileicon "test-python" :v-adjust -.1 :height .75 :face '(:foreground "#6272a4"))
(all-the-icons-faicon "info-circle" :v-adjust -.1 :height .72 :face '(:foreground "#6272a4"))
;; L4
(all-the-icons-alltheicon "script" :v-adjust .05 :height .7 :face '(:foreground "#6272a4"))
(all-the-icons-fileicon "test-python" :v-adjust -.1 :height .7 :face '(:foreground "#282a36")) ;; dummy
(propertize "link" 'face `(:foreground "#282a36"))
(all-the-icons-fileicon "test-python" :v-adjust -.1 :height .7 :face '(:foreground "#282a36")) ;; dummy
(propertize "latex" 'face `(:foreground "#282a36"))
(all-the-icons-faicon "quote-right" :v-adjust -.05 :height .65 :face '(:foreground "#6272a4"))
;; L5
(all-the-icons-fileicon "go" :v-adjust -.1 :height .75 :face '(:foreground "#6272a4"))
;; L6
(all-the-icons-octicon "settings" :v-adjust -.1 :height .75 :face '(:foreground "#6272a4"))
;; Draw
(propertize " ┌──────────────────────────────────────────────────────────┘ " 'face `(:foreground "#6272a4"))
(propertize "[_q_]:" 'face `(:foreground "#6272a4"))
(propertize ", [_<_]:" 'face `(:foreground "#6272a4"))
      ("s" (hot-expand "<s"))
      ("o" (hot-expand "<q"))
      ("c" (hot-expand "<c"))
      ("t" (hot-expand "<L"))
      ("c" (insert "#+CAPTION: "))
      ("l" (insert "#+NAME: "))
      ("n" (insert "#+BEGIN_NOTE\n\n#+END_NOTE"))
      ("i" (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" "yaml"))
      ("P" (hot-expand "<s" "ipython :session :exports both :async :cache yes :results raw drawer\n$0"))
      ("g" (hot-expand "<s" "go"))
      ("r" (hot-expand "<s" "ruby"))
      ("S" (hot-expand "<s" "sh"))
      ("u" (hot-expand "<s" "plantuml :file overview.svg :cache yes :cmdline -config \"$HOME/Private/style.uml\" :async"))
      ("<" self-insert-command)
      ("q" nil))

    (bind-key "<"
              (lambda () (interactive)
                (if (or (region-active-p) (looking-back "^\s*" 1))
                  (self-insert-command 1)))

1.14.6 R

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

1.14.7 HTML/CSS/JS

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

1.14.8 Protobuf

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

1.14.9 Fish

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

1.14.10 Markdown

(use-package markdown-mode
  (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)
  (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\\'")

(use-package markdown-toc)

1.14.11 Log

(use-package logview :defer t)

1.14.12 Systemd

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

1.14.13 YAML

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

1.14.14 Bazel

(use-package bazel-mode :defer t)

1.14.15 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 ()
  (let ((char (char-to-string (char-after (point)))))
     ((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()
      (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

1.15.5 Copy file path

(defun put-current-path-to-clipboard ()
    (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!"))
             (kill-new (expand-file-name dir-path))
             (message "This directory path is on the clipboard!"))
             (error-message-string "Fail to get path name.")))))

  (defun put-current-filename-to-clipboard ()
    (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!"))
             (kill-new (file-name-nondirectory dir-path))
             (message "This directory path is on the clipboard!"))
             (error-message-string "Fail to get path name.")))))

  (defun put-current-filename-with-line-to-clipboard ()
    (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!"))
             (kill-new (file-name-nondirectory dir-path))
             (message "This directory path is on the clipboard!"))
             (error-message-string "Fail to get path name.")))))

1.16 UI

1.16.1 Dashboard

(use-package dashboard
  (dashboard-mode page-break-lines-mode)
  (dashboard-center-content t)
  (dashboard-startup-banner 4)
  (dashboard-items '((recents . 15)
                     (projects . 5)
                     (bookmarks . 5)))
  (dashboard-heading ((t (:foreground "#f1fa8c" :weight bold))))
  (after-init . dashboard-setup-startup-hook))

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 persp

(use-package persp-mode
  :commands (get-current-persp persp-contain-buffer-p)
  :hook (after-init . persp-mode))

1.16.4 imenu-list

(use-package imenu-list
  :load-path "~/Developments/src/"
  ("<f10>" . imenu-list-smart-toggle)
  (imenu-list-entry-face-1 ((t (:foreground "white"))))
  (imenu-list-focus-after-activation t)
  (imenu-list-auto-resize t))

1.16.5 Transparency

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

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

1.16.6 Minimap

(use-package minimap
  (minimap-bufname minimap-create minimap-kill)
  (minimap-major-modes '(prog-mode))
  (minimap-window-location 'right)
  (minimap-update-delay 0.2)
  (minimap-minimum-width 20)
  ("M-t p" . ladicle/toggle-minimap)
  (defun ladicle/toggle-minimap ()
    "Toggle minimap for current buffer."
    (if (null minimap-bufname)
    ((((background dark)) (:background "#555555555555"))
      (t (:background "#C847D8FEFFFF"))) :group 'minimap)))

1.16.7 Neotree

(use-package neotree
  (neotree-show neotree-hide neotree-dir neotree-find)
  (neo-theme 'nerd2)
  ("<f8>" . neotree-current-dir-toggle)
  ("<f9>" . neotree-projectile-toggle)
  (defun neotree-projectile-toggle ()
    (let ((project-dir
           ;;; Pick one: projectile or find-file-in-project
          (file-name (buffer-file-name))
          (neo-smart-open t))
      (if (and (fboundp 'neo-global--window-exists-p)
          (if project-dir
              (neotree-dir project-dir))
          (if file-name
              (neotree-find file-name))))))
  (defun neotree-current-dir-toggle ()
    (let ((project-dir
          (file-name (buffer-file-name))
          (neo-smart-open t))
      (if (and (fboundp 'neo-global--window-exists-p)
          (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
  (doom-themes-enable-italic t)
  (doom-themes-enable-bold t)
  ;; (vertical-bar   (doom-darken base5 0.4))
  ;; (doom-darken bg 0.4)
  (load-theme 'doom-dracula t)
  ;; Modeline
  (use-package doom-modeline
    (doom-modeline-buffer-file-name-style 'truncate-with-project)
    (doom-modeline-icon t)
    (doom-modeline-major-mode-icon nil)
    (doom-modeline-minor-modes nil)
    (after-init . doom-modeline-mode)
    (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
   (nyan-cat-face-number 4)
   (nyan-animate-nyancat t)
   (doom-modeline-mode . nyan-mode))

1.16.10 Hide Modeline

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

1.16.11 Line number

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

1.16.12 Dimmer

(use-package dimmer
  (dimmer-fraction 0.5)
  (dimmer-mode t))

1.16.13 fill-column-indicator

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

1.16.14 Presentation

(use-package presentation)

1.16.15 Eshell

(setq eshell-prompt-function
      (lambda ()
        (format "%s %s\n%s%s%s "
                (all-the-icons-octicon "repo")
                (propertize (cdr (shrink-path-prompt default-directory)) 'face `(:foreground "white"))
                (propertize "❯" 'face `(:foreground "#ff79c6"))
                (propertize "❯" 'face `(:foreground "#f1fa8c"))
                (propertize "❯" 'face `(:foreground "#50fa7b")))))

(setq eshell-hist-ignoredups t)
(setq eshell-cmpl-cycle-completions nil)
(setq eshell-cmpl-ignore-case t)
(setq eshell-ask-to-save-history (quote always))
(setq eshell-prompt-regexp "❯❯❯ ")
(add-hook 'eshell-mode-hook
          '(lambda ()
               (define-key eshell-mode-map "\C-a" 'eshell-bol)
               (define-key eshell-mode-map "\C-r" 'counsel-esh-history)
               (define-key eshell-mode-map [up] 'previous-line)
               (define-key eshell-mode-map [down] 'next-line)

1.17 High-Lights

1.17.1 Highlight Line

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

1.17.2 Paren

(use-package paren
  :ensure nil
  (after-init . show-paren-mode)
  (show-paren-match ((nil (:background "#44475a" :foreground "#f1fa8c")))) ;; :box t
  (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
  (: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
  (beacon-color "#f1fa8c")
  :hook (after-init . beacon-mode))

1.17.5 Rainbow delimiters

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

1.17.6 Rainbow Mode

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

1.17.7 Volatile

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

1.17.8 Indent

(use-package highlight-indent-guides
  ((prog-mode yaml-mode) . highlight-indent-guides-mode)
  (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
  ("C-," . backward-forward-previous-location)
  ("C-." . backward-forward-next-location)
  (mark-ring-max 60)
  (set-mark-command-repeat-pop t)
  (backward-forward-mode t))

1.18.2 Point Undo

(use-package point-undo
  :load-path "~/Developments/src/"
  ("C-," . point-undo)
  ("C-." . point-redo))