Skip to content

akaWolf/emacs.d

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Emacs configuration file

Credits

Inspired by vyorkin’s setup.

Setup

  • Symlink init.org to ~/.emacs.d/init.org
  • Symlink init.el to ~/.emacs.d/init.el
ln -sf $(pwd)/init.org ~/.emacs.d/init.org
ln -sf $(pwd)/init.el ~/.emacs.d/init.el

On the first run Emacs will install some packages. It’s best to restart Emacs after that process is done for the first time.

There is no reason to track the init.el that is generated; by running the following command git will not bother tracking it:

git update-index --assume-unchanged init.el

If one wishes to make changes to the repo-version of init.el start tracking again with:

git update-index --no-assume-unchanged init.el

When this configuration is loaded for the first time, the init.el is the file that is loaded. It looks like this:

;; We can't tangle without org!
(require 'org)
;; Open the configuration
(find-file (concat user-emacs-directory "init.org"))
;; tangle it
(org-babel-tangle)
;; load it
(load-file (concat user-emacs-directory "init.el"))
;; finally byte-compile it
(byte-compile-file (concat user-emacs-directory "init.el"))

Config

Lexical binding for the init-file is needed, it can be specified in the header. This is the first line of the actual configuration.

;;; -*- lexical-binding: t -*-

Tangle and compile this file on save automatically:

(defun tangle-init ()
  "If the current buffer is 'init.org' the code-blocks are
tangled, and the tangled file is compiled."
  (when (equal (buffer-file-name)
               (file-truename (concat user-emacs-directory "init.org")))
    ;; Avoid running hooks when tangling.
    (let ((prog-mode-hook nil))
      (org-babel-tangle)
;;    (byte-compile-file (concat user-emacs-directory "init.el"))
     )))

(add-hook 'after-save-hook 'tangle-init)

Use package

Initialize package and add package archives.

(require 'package)

Set package-enable-at-startup to nil for slightly faster startup. See this post on Reddit.

(setq package-enable-at-startup nil)

Use MELPA as shown here.

(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
    (proto (if no-ssl "http" "https")))
    ;; Comment/uncomment these two lines to disable/enable MELPA and MELPA Stable as desired
    (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
    ;; (add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
    (when (< emacs-major-version 24)
      ;; For important compatibility libraries like cl-lib
      (add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))

It is ok to use both package-initialize and use-package for a well behaved package: package-initialize will not load the whole package, but only autoload functions selected by the package author.

(package-initialize)

Install use-package.

Install missing packages automatically if not already present on the system and be less verbose.

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

(eval-when-compile (require 'use-package))

(setq
 use-package-always-ensure t
 use-package-verbose nil)

Warnings

Decrease the obsolete warnings annoyance level.

(setq byte-compile-warnings '(not obsolete))

This helps to get rid of functions might not be defined at runtime warnings. See this issue for details.

(eval-when-compile
  (setq use-package-expand-minimally byte-compile-current-file))

Defaults

Backups & lock files

Don’t create lock files.

(setq create-lockfiles nil)

I don’t care about auto save and backup files. Also I don’t like distracting alarms.

(setq
 make-backup-files nil        ; disable backup files
 auto-save-list-file-name nil ; disable .saves files
 auto-save-default nil        ; disable auto saving
 ring-bell-function 'ignore)  ; turn off alarms completely

Misc

Use y/n instead of yes/no.

(fset 'yes-or-no-p 'y-or-n-p)

Don’t prompt for non existent name when creating new buffers.

(setq-default confirm-nonexistent-file-or-buffer t)

Enable recentf-mode and remember a lot of files.

(setq
 recentf-auto-cleanup 'never
 recentf-max-menu-items 0
 recentf-max-saved-items 1000
 recentf-filename-handlers '(file-truename abbreviate-file-name))

(recentf-mode 1)

Automatically save place in each file.

(setq
 save-place-forget-unreadable-files t
 save-place-limit 1000)

(save-place-mode 1)

Location

Set the location name and coordinates.

(setq
 calendar-location-name "Moscow, RU"
 calendar-latitude 55.76
 calendar-longitude 37.78)

Core

Utils

Utility functions.

(defun my/emacs-path (path)
  "Expands `path` with Emacs home directory."
  (expand-file-name path user-emacs-directory))

(defun my/tmp-path (path)
  "Expand `path` with Emacs temporary directory."
  (my/emacs-path (format "tmp/%s" path)))

(defun my/lisp-path (path)
  "Expand `path` with Emacs `/lisp` directory."
  (my/emacs-path (format "lisp/%s" path)))

Builtin

Files

On save/write file:

  • Automatically delete trailing whitespace.
  • Silently put a newline at the end of file if there isn’t already one there.
(use-package files
 :ensure nil
 :commands
 (generate-new-buffer
  executable-find
  file-name-base
  file-name-extension)
 :custom
 (require-final-newline t)
 :hook
 (before-save . delete-trailing-whitespace))

Reverting

Enable and diminish autorevert mode.

(use-package autorevert
 :ensure nil
 :custom
 ;; Don't generate any messages whenever a buffer is reverted
 ;;(auto-revert-verbose nil)
 ;; Operate on non-file-visiting buffers
 (global-auto-revert-non-file-buffers t)
 :config
 ;; Operate on file-visiting buffers
 (global-auto-revert-mode)
 :diminish auto-revert-mode)

Reverse-im

Reverse-im translates local bindings (like russian-computer used here) to Emacs bindings.

(use-package char-fold
  :custom
  (char-fold-symmetric t)
  (search-default-mode #'char-fold-to-regexp))
(use-package reverse-im
  :ensure t
  :demand t
  :after char-fold
  :bind
  ("M-T" . reverse-im-translate-word)
  :custom
  (reverse-im-char-fold t)
  (reverse-im-read-char-advice-function #'reverse-im-read-char-exclude)
  (reverse-im-input-methods '("russian-computer"))
  :config
  (reverse-im-mode t))

Uniquify

Using reverse naming method, buffers visiting the files /u/rms/tmp/Makefile and /usr/projects/zaphod/Makefile would be named ‘Makefile\tmp’ and ‘Makefile\zaphod’. It puts the directory names in reverse order, so that /top/middle/file becomes ‘file\middle\top’.

(use-package uniquify
 :ensure nil
 :custom
 ;; use "qux\bar\foo"
 (uniquify-buffer-name-style 'reverse))

Frame

  • Disable blinking cursor.
  • Disable suspending on C-z.
  • Stretch cursor on wide characters.
(use-package frame
 :ensure nil
 :config
 (blink-cursor-mode 0)
 (setq x-stretch-cursor t)
 :bind
 ("C-z" . nil))

savehist

Many editors (e.g. Vim) have the feature of saving minibuffer history to an external file after exit. This package provides the same feature in Emacs. When set up, it saves recorded minibuffer histories to a file (~/.emacs-history bydefault). Vertico sorts by history position.

(use-package savehist
  :ensure nil
  :custom
  (savehist-additional-variables
   '(kill-ring
     ;; search entries
     search-ring
     regexp-search-ring))
  ;; save every minute
  (savehist-autosave-interval 60)
  (savehist-save-minibuffer-history t)
  :init
  (savehist-mode))

Delsel

Simple

Pixel scroll

Prog mode

Prettify symbols.

(use-package prog-mode
 :ensure nil
 :commands
 (global-prettify-symbols-mode)
 :init
 (setq prettify-symbols-unprettify-at-point 'right-edge)
 :hook
 (prog-mode .
  (lambda () (local-set-key (kbd "M-o") #'comment-or-uncomment-region)))
 :config
 ;; convert certain words into symbols, e.g. lambda becomes λ.
 ;(global-prettify-symbols-mode t)
)

IBuffer

Mule

ETags

Man

Format man pages properly.

(use-package man
 :ensure nil
 :custom-face
 (Man-overstrike ((t (:inherit font-lock-type-face :weight bold))))
 (Man-underline ((t (:inherit font-lock-keyword-face :slant italic)))))

Calendar

(use-package calendar
 :ensure nil
 :custom
 (calendar-week-start-day 1))

Ido

Use Ido mode.

(use-package ido
 :ensure nil
 :config
 (ido-mode 1)
 ;; let's try with vertical aligned variants
 (setf (nth 2 ido-decorations) "\n")
 :custom
 ;; show any name that has the chars you typed
 (ido-enable-flex-matching t)
 ;; enable ido for all buffers
 (ido-everywhere t))

Term

Disable mandatory parameter to term function.

(use-package term
 :ensure nil
 :custom-face
;; dark theme
;; (term ((t :inherit default :background "black" :foreground "white")))
;; (term-color-black ((t :foreground "gray" :background "gray")))
;; (term-color-red ((t :foreground "red" :background "red")))
;; (term-color-green ((t :foreground "green" :background "green")))
;; (term-color-yellow ((t :foreground "yellow" :background "yellow")))
;; (term-color-blue ((t :foreground "blue" :background "blue")))
;; (term-color-magenta ((t :foreground "magenta" :background "magenta")))
;; (term-color-cyan ((t :foreground "cyan" :background "cyan")))
;; (term-color-white ((t :foreground "white" :background "white")))
;; gray80 theme
 (term ((t :inherit default :background "gray80" :foreground "black")))
 (term-color-black ((t :foreground "gray80" :background "gray15")))
 (term-color-red ((t :foreground "red3" :background "red3")))
 (term-color-green ((t :foreground "green4" :background "green4")))
 (term-color-yellow ((t :foreground "yellow4" :background "yellow4")))
 (term-color-blue ((t :foreground "blue3" :background "blue3")))
 (term-color-magenta ((t :foreground "magenta4" :background "magenta4")))
 (term-color-cyan ((t :foreground "cyan4" :background "cyan4")))
 (term-color-white ((t :foreground "white" :background "white")))
 :config
 (fset 'origterm
  (symbol-function 'term))
 (defun term (&optional term)
  (interactive)
  (origterm
   (or term
       explicit-shell-file-name
       shell-file-name))))

Face remap

Diminish remap mode.

(use-package face-remap
 :commands
 (buffer-face-mode-face
  face-remap-add-relative
  buffer-face-mode)
 :ensure nil
 :diminish buffer-face-mode)

CC mode

UI

Basics.

(setq
 inhibit-startup-screen t ; Don't show splash screen
 use-dialog-box nil       ; Disable dialog boxes
 use-file-dialog nil)     ; Disable file dialog

Scroll

UI elements

Set cursor color. Use default-frame-alist instead of set-cursor-color to ensure that newly created frames will have right settings.

(add-to-list 'default-frame-alist '(cursor-color . "red3"))

Hide toolbar and scrollbars.

(tool-bar-mode -1)
(scroll-bar-mode -1)
(when (fboundp 'horizontal-scroll-bar-mode)
  (horizontal-scroll-bar-mode -1))

I generally prefer to hide the menu bar, but doing this on OS X simply makes it update unreliably in GUI frames, so we make an exception.

(if (eq system-type 'darwin)
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (set-frame-parameter frame 'menu-bar-lines
                                     (if (display-graphic-p frame) 1 0))))
  (when (fboundp 'menu-bar-mode)
    (menu-bar-mode -1)))

Cursor

Show full path in the title bar.

(setq-default frame-title-format "%b (%f)")

Fringe

Window-divider

Line-spacing

Startup

Start maximized.

(toggle-frame-maximized)

Mode-line

Time

(use-package time
 :ensure nil
 :custom
 (display-time-default-load-average nil)
 (display-time-24hr-format t)
 :config
 (display-time-mode t))

Editor

Customizations

I don’t use the customizations UI. Lets keep those automated customizations in a separate file. The 'noerror argument passed to load prevents errors if the file doesn’t exist.

(setq custom-file (my/emacs-path "custom.el"))
(load custom-file 'noerror)

Basics

Some basic things.

(setq
 sentence-end-double-space nil  ; sentences should end in one space
 initial-scratch-message nil    ; empty scratch buffer
 enable-recursive-minibuffers nil ; disallow minibuffer commands in the minibuffer
 echo-keystrokes 0.1            ; show keystrokes right away, don't show the message in the scratch buffer
 ns-use-native-fullscreen nil   ; disable native fullscreen support
)

Tabs & spaces

  • Allow to use tabs for indent
  • One tab is 4 spaces.
(setq-default
 indent-tabs-mode t
 tab-width 4)

Display line and column numbers in the mode-line.

(setq
  line-number-mode t
  column-number-mode t)

Line wrapping

Long lines will show a continuation character in the right margin at the window’s edge to indicate that next line is the continuation of current. Long lines will show a continuation character in the right margin at the window’s edge to indicate that next line is the continuation of current. When non-nil line will be displayed with continuation.

(setq-default truncate-lines nil)

Break line at N characters.

(setq-default fill-column 80)

Enable automatic line breaking for all text mode buffers.

(add-hook 'text-mode-hook 'turn-on-auto-fill)

Always wrap lines. When enabled lines will be wrapped by words

(global-visual-line-mode -1)

Disable special glyph for non-ASCII spaces.

(setq nobreak-char-display nil)

Benchmarking

Usage:

  • M-x benchmark-init/show-durations-tabulated

M-x benchmark-init/show-durations-tree

;; Disabled, see: https://github.com/dholm/benchmark-init-el/issues/15
(use-package benchmark-init
 :hook
 ;; To disable collection of benchmark data after init is done.
 (after-init . benchmark-init/deactivate))

Quelpa

Setup quelpa.

(if (require 'quelpa nil t)
  ;; Prevent quelpa from doing anyting that requires network connection.
  (setq
   quelpa-update-melpa-p nil    ; Don't update MELPA git repo
   quelpa-checkout-melpa-p nil  ; Don't clone MELPA git repo
   quelpa-upgrade-p nil         ; Don't try to update packages automatically
   quelpa-self-upgrade-p nil)   ; Don't upgrade quelpa automatically

  ;; Comment/uncomment line below to disable/enable quelpa auto-upgrade.
  ;; (quelpa-self-upgrade)

  (with-temp-buffer
    (url-insert-file-contents "https://github.com/quelpa/quelpa/raw/master/quelpa.el")
    (eval-buffer)))

Install use-package and the quelpa handler.

(quelpa
 '(quelpa-use-package
   :fetcher github
   :repo "quelpa/quelpa-use-package"))
(require 'quelpa-use-package)

Advice setting :ensure nil for use-package + quelpa.

(quelpa-use-package-activate-advice)

Use-package plugins

Font

Faces

(use-package faces
  :ensure nil
  :custom
  (face-font-family-alternatives
   '(("Ricty Diminished L")))
  :init
  (set-face-attribute
   'default nil
   :family (caar face-font-family-alternatives)
   :weight 'regular
   :height 100
   :width 'semi-condensed)
  (set-fontset-font
   "fontset-default"
   'cyrillic
   (font-spec :registry "iso10646-1" :script 'cyrillic))
  (set-face-attribute
   'fixed-pitch-serif
   nil
   :family "Iosevka"))

Theme

Use Nord Emacs theme.

(use-package nord-theme
  :ensure t
  :config
  (load-theme 'nord t))

Use Dracula Emacs theme. Note that despite set-cursor-color function belongs to the frame package, it used here since load-theme call overwrite cursor color value.

  • Set cursor color to red.
(use-package dracula-theme
  :ensure t
  :config
  (load-theme 'dracula t))
(deftheme lg-xemacs-like "xemacs-like theme")

(custom-theme-set-faces 'lg-xemacs-like

 '(default ((t (:background "gray80" :foreground "black"))))
 '(cursor ((t (:foregound "Red3"))))
 '(border ((t (:foregound "black"))))

 '(blue ((t (:foreground "blue"))))
 '(bold ((t (:bold t))))
 '(bold-italic ((t (:italic t :bold t))))
 '(border-glyph ((t (nil))))
 '(custom-button-face ((t (:bold t))))
 '(custom-changed-face ((t (:background "blue" :foreground "white"))))
 '(custom-documentation-face ((t (nil))))
 '(custom-face-tag-face ((t (:underline t))))
 '(custom-group-tag-face ((t (:underline t :foreground "blue"))))
 '(custom-group-tag-face-1 ((t (:underline t :foreground "red"))))
 '(custom-invalid-face ((t (:background "red" :foreground "yellow"))))
 '(custom-modified-face ((t (:background "blue" :foreground "white"))))
 '(custom-rogue-face ((t (:background "black" :foreground "pink"))))
 '(custom-saved-face ((t (:underline t))))
 '(custom-set-face ((t (:background "white" :foreground "blue"))))
 '(custom-state-face ((t (:foreground "dark green"))))
 '(custom-variable-button-face ((t (:underline t :bold t))))
 '(custom-variable-tag-face ((t (:underline t :foreground "blue"))))
 '(dired-face-boring ((t (:foreground "Gray65"))))
 '(dired-face-directory ((t (:bold t))))
 '(dired-face-executable ((t (:foreground "SeaGreen"))))
 '(dired-face-flagged ((t (:background "LightSlateGray"))))
 '(dired-face-marked ((t (:background "PaleVioletRed"))))
 '(dired-face-permissions ((t (:background "grey75" :foreground "black"))))
 '(dired-face-setuid ((t (:foreground "Red"))))
 '(dired-face-socket ((t (:foreground "magenta"))))
 '(dired-face-symlink ((t (:foreground "cyan"))))
 '(font-lock-builtin-face ((t (:foreground "red3"))))
 '(font-lock-comment-face ((t (:foreground "blue4"))))
 '(font-lock-constant-face ((t (:foreground "red3"))))
 '(font-lock-doc-string-face ((t (:foreground "green4"))))
 '(font-lock-function-name-face ((t (:foreground "brown4"))))
 '(font-lock-keyword-face ((t (:foreground "red4"))))
 '(font-lock-preprocessor-face ((t (:foreground "blue3"))))
 '(font-lock-reference-face ((t (:foreground "red3"))))
 '(font-lock-string-face ((t (:foreground "green4"))))
 '(font-lock-type-face ((t (:foreground "steelblue"))))
 '(font-lock-variable-name-face ((t (:foreground "magenta4"))))
 '(font-lock-warning-face ((t (:bold t :foreground "Red"))))
 '(green ((t (:foreground "green"))))
 '(gui-button-face ((t (:background "grey75" :foreground "black"))))
 '(gui-element ((t (:background "Gray80"))))
 '(highlight ((t (:background "darkseagreen2"))))
 '(info-node ((t (:italic t :bold t))))
 '(info-xref ((t (:bold t))))
 '(isearch ((t (:background "paleturquoise"))))
 '(italic ((t (:italic t))))
 '(left-margin ((t (nil))))
 '(list-mode-item-selected ((t (:background "gray68"))))
 '(modeline ((t (:background "Gray80"))))
 '(modeline-buffer-id ((t (:background "Gray80" :foreground "blue4"))))
 '(modeline-mousable ((t (:background "Gray80" :foreground "firebrick"))))
 '(modeline-mousable-minor-mode ((t (:background "Gray80" :foreground "green4"))))
 '(paren-blink-off ((t (:foreground "gray80"))))
 '(paren-match ((t (:background "darkseagreen2"))))
 '(paren-mismatch ((t (:background "DeepPink" :foreground "black"))))
 '(pointer ((t (nil))))
 '(primary-selection ((t (:background "gray65"))))
 '(red ((t (:foreground "red"))))
 '(region ((t (:background "gray65"))))
 '(right-margin ((t (nil))))
 '(secondary-selection ((t (:background "paleturquoise"))))
 '(text-cursor ((t (:background "Red3" :foreground "gray80"))))
 '(toolbar ((t (:background "Gray80"))))
 '(underline ((t (:underline t))))
 '(vertical-divider ((t (:background "Gray80"))))
 '(widget-button-face ((t (:bold t))))
 '(widget-button-pressed-face ((t (:foreground "red"))))
 '(widget-documentation-face ((t (:foreground "dark green"))))
 '(widget-field-face ((t (:background "gray85"))))
 '(widget-inactive-face ((t (:foreground "dim gray"))))
 '(yellow ((t (:foreground "yellow"))))
 '(zmacs-region ((t (:background "gray65"))))
 '(escape-glyph ((t (:weight bold :background "gold" :foreground "blue"
                             :box (:line-width -1 :color "black")))))
 )

(enable-theme 'lg-xemacs-like)

Key bindings

General package

There should be keybinding congiguration

(use-package general)

Behavior

Trashing

Automatic updates

Automatically update Emacs packages. Useful if you’re working in multiple machines and tend to forget to manually update packages from time to time.

The main idea is that you set a desired periodicity for the updates, and when you start Emacs, the packages will be automatically updated if enough days have passed since the last update.

See the package repo for more info.

(use-package auto-package-update
 :config
 (setq
  auto-package-update-delete-old-versions t ; Delete residual old version directory when updating
  auto-package-update-interval 1)           ; Update packages every day
; (auto-package-update-maybe)                ; Check for updates on startup
 (auto-package-update-at-time "06:00"))     ; Update at =6:00=

Clipboard

Copy as

Posframe

Pop a posframe (a child-frame) at point.

(use-package posframe
  :custom
  (posframe-mouse-banish nil))

Extra whitespace trimming

Unobtrusively trim extraneous whitespace only in lines edited.

(use-package ws-butler
 :config
 (ws-butler-global-mode)
 :diminish ws-butler-mode)

Aggressive indent

Auto-save buffers

Save buffers when they lose focus.

(use-package super-save
 :config
 (super-save-mode +1)
 :diminish)

Auto read-only

Zoom

Transparency

Go to last change

Fullframe

Folding

Which key

(use-package which-key
 :diminish which-key-mode
 :init
 (setq
  which-key-idle-delay 0.5
  which-key-sort-order 'which-key-prefix-then-key-order-reverse)
 :config
 (which-key-mode))

Free keys

Show free bindings in current buffer. To use, call the command M-x free-keys. See the package repo for more info.

(use-package free-keys)

Sudo edit

Utilities for opening files with sudo. Just type M-x sudo on an already opened read-only file.

(use-package sudo-edit)

Try

Allows you to try out Emacs packages without installing them. Just type M-x try.

(use-package try)

Restart

(use-package restart-emacs
 :after general
 :demand t)

backward-forward

(use-package backward-forward
 :after general
 :demand t
 :config
 (backward-forward-mode t)
 :bind
 (:map backward-forward-mode-map
  ("<C-left>" . nil)
  ("<C-right>" . nil)
  ("<M-left>" . backward-forward-previous-location)
  ("<M-right>" . backward-forward-next-location)))

Appearance

Customization

Page break lines

Display ugly ^L page breaks as tidy horizontal lines.

(use-package page-break-lines
 :init
 (global-page-break-lines-mode 1)
 :diminish page-break-lines-mode)

Rainbow delimiters

(use-package rainbow-delimiters
 :commands
 (rainbow-delimiters-unmatched-face)
 :config
 ;; Pastels..
 (set-face-attribute 'rainbow-delimiters-depth-1-face nil :foreground "#78c5d6")
 (set-face-attribute 'rainbow-delimiters-depth-2-face nil :foreground "#bf62a6")
 (set-face-attribute 'rainbow-delimiters-depth-3-face nil :foreground "#459ba8")
 (set-face-attribute 'rainbow-delimiters-depth-4-face nil :foreground "#e868a2")
 (set-face-attribute 'rainbow-delimiters-depth-5-face nil :foreground "#79c267")
 (set-face-attribute 'rainbow-delimiters-depth-6-face nil :foreground "#f28c33")
 (set-face-attribute 'rainbow-delimiters-depth-7-face nil :foreground "#c5d647")
 (set-face-attribute 'rainbow-delimiters-depth-8-face nil :foreground "#f5d63d")
 (set-face-attribute 'rainbow-delimiters-depth-9-face nil :foreground "#78c5d6")
 ;; Make unmatched parens stand out more
 (set-face-attribute
  'rainbow-delimiters-unmatched-face nil
   :foreground 'unspecified
   :inherit 'show-paren-mismatch
   :strike-through t)
 (set-face-foreground 'rainbow-delimiters-unmatched-face "magenta")
 :hook
 (prog-mode . rainbow-delimiters-mode)
 :diminish rainbow-delimiters-mode)

Rainbow identifiers

(use-package rainbow-identifiers
 :hook
 (prog-mode . rainbow-identifiers-mode)
 :diminish rainbow-identifiers-mode)

Rainbow mode

(use-package rainbow-mode
 :diminish rainbow-mode
 :hook prog-mode)

Idle highlight mode

Basically its the same as highlight-thing but seems to be smarter and less distracting.

(use-package idle-highlight-mode
 :custom
 (idle-highlight-idle-time 0.2)
 :hook
 (prog-mode . idle-highlight-mode)
 :config
 ;; (set-face-background 'idle-highlight "#c51060")
 (set-face-foreground 'idle-highlight "#999")
 (set-face-background 'idle-highlight "#222"))

Hl-todo

Highlight TODO and similar keywords in comments and strings. See the package repository for more info.

(use-package hl-todo
 :config
 (global-hl-todo-mode))

Highlight indentation

Highlight chars

Highlight leading spaces

VI Tilde fringe

Info colors

(use-package info-colors
 :hook
 (Info-selection #'info-colors-fontify-node))

Fill column

All the icons

Emojify

Mode line

Good-line (disabled)

Mood-line fork.

(use-package good-line
 :ensure nil
 :hook
 (after-init . good-line-mode)
 :quelpa (good-line :fetcher github :repo "TatriX/good-line"))

Mood-line

A minimal mode-line configuration that aims to replicate some of the features of the doom-modeline package.

(use-package mood-line
 :hook
 (after-init . mood-line-mode))

Moody + minions

Spaceline

Flycheck color

Beacon

Git gutter

Mark uncommitted changes in the fringe.

(use-package git-gutter
 :ensure t
 :config
 (global-git-gutter-mode t)
 :diminish git-gutter-mode)

Tracking

(use-package tracking
 :ensure t)

Evil

Main

Evil collection

Alignment

Sentence navigation

Multiple cursors

Matchit

Surround

Args

Embrace

Visualstar

Vimish fold

Indent plus

Commentary

Exchange

Numbers

Diff

Eldoc

Secrets

Bookmarks

Completion

Company

(use-package company
 :hook
 ;; Use company-mode in all buffers
 (after-init . global-company-mode)
 :custom
 (company-dabbrev-ignore-case nil)
 (company-dabbrev-code-ignore-case nil)
 (company-dabbrev-downcase nil)
 (company-idle-delay 0.0 "adjust this setting according to your typing speed")
 (company-minimum-prefix-length 1)
 ;; Disable in org
 ;;(company-global-modes '(not org-mode))

 :bind (;; Replace `completion-at-point' and `complete-symbol' with
         ;; `company-manual-begin'. You might think this could be put
         ;; in the `:bind*' declaration below, but it seems that
         ;; `bind-key*' does not work with remappings.
         ([remap completion-at-point] . company-manual-begin)
         ([remap complete-symbol] . company-manual-begin)

         ;; The following are keybindings that take effect whenever
         ;; the completions menu is visible, even if the user has not
         ;; explicitly interacted with Company.

         :map company-active-map

         ;; Make TAB always complete the current selection. Note that
         ;; <tab> is for windowed Emacs and TAB is for terminal Emacs.
         ("<tab>" . company-complete-selection)
         ("TAB" . company-complete-selection)

         ;; Prevent SPC from ever triggering a completion.
         ("SPC" . nil)

         ;; The following are keybindings that only take effect if the
         ;; user has explicitly interacted with Company.

         :map company-active-map
         :filter (company-explicit-action-p)

         ;; Make RET trigger a completion if and only if the user has
         ;; explicitly interacted with Company. Note that <return> is
         ;; for windowed Emacs and RET is for terminal Emacs.
         ("<return>" . company-complete-selection)
         ("RET" . company-complete-selection)

         ;; We then do the same for the up and down arrows. Note that
         ;; we use `company-select-previous' instead of
         ;; `company-select-previous-or-abort'. I think the former
         ;; makes more sense since the general idea of this `company'
         ;; configuration is to decide whether or not to steal
         ;; keypresses based on whether the user has explicitly
         ;; interacted with `company', not based on the number of
         ;; candidates.

         ("<up>" . company-select-previous)
         ("<down>" . company-select-next))

  :bind* (;; The default keybinding for `completion-at-point' and
          ;; `complete-symbol' is M-TAB or equivalently C-M-i. Here we
          ;; make sure that no minor modes override this keybinding.
          ("M-TAB" . company-manual-begin))

 :config
 ;; Style nicely
 (let* ((bg (face-attribute 'default :background))
       (bg-light (color-lighten-name bg 2))
       (bg-lighter (color-lighten-name bg 5))
       (bg-lightest (color-lighten-name bg 10))
       (ac (face-attribute 'match :foreground)))
  (custom-set-faces
   `(company-tooltip
     ((t (:inherit default :background ,bg-light))))
   `(company-scrollbar-bg ((t (:background ,bg-lightest))))
   `(company-scrollbar-fg ((t (:background ,bg-lighter))))
   `(company-tooltip-selection
     ((t (:inherit font-lock-function-name-face))))
   `(company-tooltip-common
     ((t (:inherit font-lock-constant-face))))
   `(company-preview-common
     ((t (:foreground ,ac :background ,bg-lightest))))))
 :diminish company-mode)

(use-package company-prescient
  :after company
  :config
  (company-prescient-mode 1))

Company quickhelp

(use-package company-quickhelp
 :after company
 :custom
 (company-quickhelp-delay 3))

Company FLX

FLX fuzzy matching for company. This only works with the company-capf backend.

(use-package flx)

(use-package company-flx
 :after (company flx)
 :commands
 (company-flx-mode)
 :demand t
 :config
 ;; use C-o to switch backend and
 ;; enable company mode fuzziness
 (company-flx-mode +1))

Spellcheck

Flycheck

(use-package flycheck
  :after (general)
  :demand t
  :commands
  (global-flycheck-mode)
  :init
  (setq-default
   flycheck-disabled-checkers
   '(emacs-lisp-checkdoc
     javascript-jshint
     haskell-stack-ghc
     haskell-ghc
     haskell-hlint))
  (setq
   flycheck-highlighting-mode 'lines
   flycheck-indication-mode 'left-fringe
   flycheck-mode-line-prefix "fly"
   flycheck-javascript-eslint-executable "eslint_d")
  :config
  (global-flycheck-mode 1)
  ;; Make the error list display like similar lists in contemporary IDEs
  ;; like VisualStudio, Eclipse, etc.
  (add-to-list
   'display-buffer-alist
   `(,(rx bos "*errors*" eos)
     ;; (display-buffer-reuse-window
     ;;  display-buffer-in-side-window)
     (side . bottom)
     (reusable-frames . visible)
     (window-height . 0.33)))
  :diminish flycheck-mode)

Flyspell

Compilation

Dictionary

Powerthesaurus

Define word

Dired

Constants (file extensions)

Dired

Dired hide dotfiles

Dired fl

Dired rsync

Dired launch

Dired+

Dired hacks.

Prerequisites

Filter

Avfs

Open

Narrow

Peep dired

Neotree

Treemacs

Treemacs - a tree layout file explorer for Emacs.

(use-package treemacs
  :ensure t
;  :defer t
  :init
  (with-eval-after-load 'winum
    (define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
  :config
  (progn
    (setq treemacs-collapse-dirs                 (if treemacs-python-executable 3 0)
          treemacs-deferred-git-apply-delay      0.5
          treemacs-display-in-side-window        t
          treemacs-eldoc-display                 'simple
          treemacs-file-event-delay              2000
          treemacs-file-extension-regex          treemacs-last-period-regex-value
          treemacs-file-follow-delay             0.0
          treemacs-follow-after-init             t
          treemacs-git-command-pipe              ""
          treemacs-goto-tag-strategy             'refetch-index
          treemacs-indentation                   2
          treemacs-indentation-string            " "
          treemacs-is-never-other-window         t
          treemacs-max-git-entries               5000
          treemacs-missing-project-action        'ask
          treemacs-no-png-images                 nil
          treemacs-no-delete-other-windows       t
          treemacs-project-follow-cleanup        nil
          treemacs-persist-file                  (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
          treemacs-position                      'left
          treemacs-recenter-distance             0.1
          treemacs-recenter-after-file-follow    nil
          treemacs-recenter-after-tag-follow     nil
          treemacs-recenter-after-project-jump   'always
          treemacs-recenter-after-project-expand 'on-distance
          treemacs-show-cursor                   nil
          treemacs-show-hidden-files             t
          treemacs-silent-filewatch              nil
          treemacs-silent-refresh                nil
          treemacs-sorting                       'alphabetic-asc
          treemacs-space-between-root-nodes      t
          treemacs-tag-follow-cleanup            t
;          treemacs--project-follow-delay         0.1
          treemacs-tag-follow-delay              1.5
          treemacs-width                         35)

    ;; The default width and height of the icons is 22 pixels. If you are
    ;; using a Hi-DPI display, uncomment this to double the icon size.
    ;(treemacs-resize-icons 44)

    (treemacs-follow-mode t)
    (treemacs-project-follow-mode t)
    (treemacs-filewatch-mode t)
    (treemacs-fringe-indicator-mode t)
    (pcase (cons (not (null (executable-find "git")))
                 (not (null treemacs-python-executable)))
      (`(t . t)
       (treemacs-git-mode 'deferred))
      (`(t . _)
       (treemacs-git-mode 'simple))))
  (defun my/treemacs ()
    (interactive)
    (pcase (treemacs-current-visibility)
      ('visible (delete-window (treemacs-get-local-window)))
      ('exists (treemacs-select-window) (treemacs-select-window))
      ('none (treemacs--init) (treemacs-select-window))))
  ;:hook (after-init . (lambda () (treemacs) (treemacs)))
  :bind
        ("<f12>" . my/treemacs)
  (:map global-map
        ("M-0"       . treemacs-select-window)
        ("C-x t 1"   . treemacs-delete-other-windows)
        ("C-x t t"   . treemacs)
        ("C-x t B"   . treemacs-bookmark)
        ("C-x t C-t" . treemacs-find-file)
        ("C-x t M-t" . treemacs-find-tag)))

Allows to quickly add your projectile projects to the treemacs workspace.

(use-package treemacs-projectile
  :after treemacs projectile
  :ensure t)

Allows you to use treemacs icons in dired buffers with treemacs-icons-dired-mode.

(use-package treemacs-icons-dired
  :after treemacs dired
  :ensure t
  :config (treemacs-icons-dired-mode))

A small utility package to fill the small gaps left by using filewatch-mode and git-mode in conjunction with magit: it will inform treemacs about (un)staging of files and commits happening in magit.

(use-package treemacs-magit
  :after treemacs magit
  :ensure t)

Icons

Navigation

Ace window

Winner

Expand region

Ivy

Setup ivy.

(use-package ivy
  :preface
;;  (defun my/ivy/switch-buffer-occur ()
;;    "Occur function for `ivy-switch-buffer' using `ibuffer'."
;;    (ibuffer nil (buffer-name) (list (cons 'name ivy--old-re))))
  :commands
  (ivy-mode ivy-set-occur)
  :custom
  (ivy-count-format "%d/%d " "Show anzu-like counter")
  :custom-face
  ;; (ivy-current-match ((t (:inherit 'hl-line))))
  ;; TODO: Make this theme-dependent (use :inherit)
  (ivy-current-match ((t (:background "#333333" :foreground "#fff"))))
  :init
  (setq
   ;; Enable bookmarks and recentf
   ;; (add 'recentf-mode' and bookmarks to 'ivy-switch-buffer')
   ivy-use-virtual-buffers t
   ;; Display full buffer name
   ivy-virtual-abbreviate 'full
   ;; Number of result lines to display
   ivy-height 12
   ;; Current input becomes selectable as a candidate
   ;; solves the issue of creating a file or
   ;; a directory `foo` when a file `foobar` already exists
   ;; another way is to use C-M-j
   ivy-use-selectable-prompt t
   ;; Wrap around ivy results
   ivy-wrap t
   ;; Omit ^ at the beginning of regexp
   ivy-initial-inputs-alist nil)
  :config
  (ivy-mode 1)
  ;; Enable fuzzy searching everywhere except:
  ;; - Switching buffers with Ivy
  ;; - Swiper
  ;; - Counsel projectile (find-file)
  (setq
   ivy-re-builders-alist
   '((swiper . ivy--regex-plus)
     (swiper-isearch . regexp-quote)
     (ivy-switch-buffer . ivy--regex-plus)
     (counsel-projectile-find-file . ivy--regex-plus)))
  ;;(ivy-set-occur 'ivy-switch-buffer 'my/ivy/switch-buffer-occur)
  :bind
  ("C-<tab>" . ivy-switch-buffer)
  :diminish ivy-mode)

Ivy prescient

(use-package ivy-prescient
  :after counsel
  :config
  (ivy-prescient-mode 1)
  ;; Remember candidate frequencies across sessions
  (prescient-persist-mode 1))

Ivy posframe

(use-package ivy-posframe
  :after (posframe ivy)
  :config
  (setq ivy-posframe-height-alist
        '((swiper . 20)
          (t. 20)))
  (setq
   ivy-posframe-display-functions-alist
   '((swiper . nil)
     (counsel-bookmark . ivy-posframe-display-at-frame-center)
     (counsel-find-file . ivy-posframe-display-at-frame-center)
     (counsel-git-grep . ivy-posframe-display-at-frame-center)
     (counsel-package . ivy-posframe-display-at-frame-center)
     (counsel-load-theme . ivy-posframe-display-at-frame-center)
     (counsel-rg . ivy-posframe-display-at-frame-center)
     (counsel-fzf . ivy-posframe-display-at-frame-center)
     (counsel-imenu . ivy-posframe-display-at-frame-center)
     (counsel-describe-variable . ivy-posframe-display-at-frame-center)
     (counsel-describe-face . ivy-posframe-display-at-frame-center)
     (counsel-describe-function . ivy-posframe-display-at-frame-center)
     (counsel-unicode-char . ivy-posframe-display-at-frame-top-center)
     (counsel-ace-link . ivy-posframe-display-at-frame-top-center)
     (complete-symbol . ivy-posframe-display-at-point)
     (counsel-M-x . ivy-posframe-display-at-frame-center)
     (t . ivy-posframe-display)))
  (ivy-posframe-mode 1))

Ivy icons

(use-package all-the-icons-ivy
 :after (ivy projectile)
 :commands
 (all-the-icons-ivy-setup)
 :custom
 (all-the-icons-ivy-buffer-commands '() "Don't use for buffers.")
 (all-the-icons-ivy-file-commands
  '(counsel-find-file
    counsel-file-jump
    counsel-recentf
    counsel-projectile-find-file
    counsel-projectile-find-dir) "Prettify more commands.")
 :config
 (all-the-icons-ivy-setup))

Rich

More friendly interface for ivy. Here is the package repo.

(use-package ivy-rich
 :after (ivy ivy-posframe)
 :demand t
 :commands
 ivy-rich-mode
 :init
 (setq
  ;; To abbreviate paths using abbreviate-file-name
  ;; (e.g. replace “/home/username” with “~”)
  ivy-rich-path-style 'abbrev)
 :config
 (ivy-rich-mode 1))

Xref

Flyspell correct

Hydra

IBuffer VC

FZF

(use-package fzf)

Counsel

(use-package counsel
 :after general
 ;;:demand t
 :init
 ;; Much faster than grep
 (setq
  counsel-git-cmd "rg --files"
  ;; Truncate all lines that are longer than 120 characters
  counsel-grep-base-command
  "rg -i -M 120 --no-heading --line-number --color never %s .")
 :config
  (counsel-mode 1))

Ace link

Counsel etags

Swiper

Ivy-enhanced alternative to isearch.

(use-package swiper
  :after general
  :init
  ;; Recenter after swiper is finished
  (setq swiper-action-recenter t)
  :bind
  ("C-s" . swiper-isearch))

Dumb jump

Avy

Avy zap

Avy flycheck

Tmux integration

Consult

Consult provides search and navigation commands.

(use-package consult
  :bind (;; C-c bindings (mode-specific-map)
         ("C-c h" . consult-history)
         ("C-c m" . consult-mode-command)
         ("C-c k" . consult-kmacro)
         ;; C-x bindings (ctl-x-map)
         ("C-x M-:" . consult-complex-command)     ;; orig. repeat-complex-command
         ("C-x b" . consult-buffer)                ;; orig. switch-to-buffer
         ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
         ("C-x 5 b" . consult-buffer-other-frame)  ;; orig. switch-to-buffer-other-frame
         ("C-x r b" . consult-bookmark)            ;; orig. bookmark-jump
         ("C-x p b" . consult-project-buffer)      ;; orig. project-switch-to-buffer
         ;; Custom M-# bindings for fast register access
         ("M-#" . consult-register-load)
         ("M-'" . consult-register-store)          ;; orig. abbrev-prefix-mark (unrelated)
         ("C-M-#" . consult-register)
         ;; Other custom bindings
         ("M-y" . consult-yank-pop)                ;; orig. yank-pop
         ;; M-g bindings (goto-map)
         ("M-g e" . consult-compile-error)
         ("M-g f" . consult-flymake)               ;; Alternative: consult-flycheck
         ("M-g g" . consult-goto-line)             ;; orig. goto-line
         ("M-g M-g" . consult-goto-line)           ;; orig. goto-line
         ("M-g o" . consult-outline)               ;; Alternative: consult-org-heading
         ("M-g m" . consult-mark)
         ("M-g k" . consult-global-mark)
         ("M-g i" . consult-imenu)
         ("M-g I" . consult-imenu-multi)
         ;; M-s bindings (search-map)
         ("M-s d" . consult-find)
         ("M-s D" . consult-locate)
         ("M-s g" . consult-grep)
         ("M-s G" . consult-git-grep)
         ("M-s r" . consult-ripgrep)
         ("M-s l" . consult-line)
         ("M-s L" . consult-line-multi)
         ("M-s k" . consult-keep-lines)
         ("M-s u" . consult-focus-lines)
         ;; Isearch integration
         ("M-s e" . consult-isearch-history)
         :map isearch-mode-map
         ("M-e" . consult-isearch-history)         ;; orig. isearch-edit-string
         ("M-s e" . consult-isearch-history)       ;; orig. isearch-edit-string
         ("M-s l" . consult-line)                  ;; needed by consult-line to detect isearch
         ("M-s L" . consult-line-multi)            ;; needed by consult-line to detect isearch
         ;; Minibuffer history
         :map minibuffer-local-map
         ("M-s" . consult-history)                 ;; orig. next-matching-history-element
         ("M-r" . consult-history))                ;; orig. previous-matching-history-element
  :init
  (setq register-preview-delay 0
        register-preview-function #'consult-register-format)
  :config
  (setq consult-narrow-key "<")
  (autoload 'projectile-project-root "projectile")
  (setq consult-project-function (lambda (_) (projectile-project-root))))

Consult company

A consulting-read interface for company-mode.

(use-package consult-company
  :after (consult company)
  :commands (consult-company))

Consult flycheck

Consult integration for Flycheck.

(use-package consult-flycheck
  :after (consult flycheck)
  :commands (consult-flycheck))

Consult lsp

Consult LSP-mode integration.

(use-package consult-lsp
  :after (consult lsp)
  :commands (consult-symbols consult-diagnostics consult-file-symbols))

Consult projectile

A package to incorporate projectile into consult.

(use-package consult-projectile
  :after (consult projectile)
  :commands (consult-projectile))

Vertico

Vertico provides a performant and minimalistic vertical completion UI based on the default completion system.

(use-package vertico
  :config (vertico-mode +1))

Vertico posframe

Vertico extension, which lets vertico use posframe to show its candidate menu.

(use-package vertico-posframe
  :after (vertico posframe)
  :config (vertico-posframe-mode 1))

Orderless

Provides an orderless completion style that divides the pattern into space-separated components, and matches candidates that match all of the components in any order

(use-package orderless
  :custom
  (completion-styles '(orderless basic))
  (completion-category-overrides '((file (styles basic partial-completion))))
  :init
  (setq orderless-component-separator "[ &]")
  (setq orderless-matching-styles '(char-fold-to-regexp))
  (defun just-one-face (fn &rest args)
  (let ((orderless-match-faces [completions-common-part]))
    (apply fn args)))
  (advice-add 'company-capf--candidates :around #'just-one-face))

Marginalia

Provides marginalia-mode which adds marginalia to the minibuffer completions.

(use-package marginalia
  :init
  (marginalia-mode)
  :bind (:map minibuffer-local-completion-map
              ("M-A" . marginalia-cycle)
              ("C-i" . marginalia-cycle-annotators)))

Embark

Provides Mini-Buffer Actions Rooted in Keymaps

(use-package embark
  :defer 3
  :config
  (load-library "embark-org")
  (setq embark-prompter 'embark-keymap-prompter))

Embark consult

Consult integration for embark

(use-package
  embark-consult
  :after (embark consult)
  :demand t                ; only necessary if you have the hook below
  ;; if you want to have consult previews as you move around an
  ;; auto-updating embark collect buffer
  :hook (embark-collect-mode . embark-consult-preview-minor-mode))

Projectile

Project Interaction Library for Emacs. https://github.com/bbatsov/projectile/blob/master/doc/usage.md https://projectile.readthedocs.io/en/latest/usage/

Setup

(use-package projectile
 ;:after (general ivy)
 :demand t
 :commands
 projectile-mode
 :init
 (setq
  projectile-indexing-method 'alien
  ;projectile-completion-system 'ivy
  ;; useful for very large projects
  projectile-enable-caching t
  projectile-sort-order 'recently-active
  projectile-mode-line nil
  projectile-use-git-grep t
  projectile-file-exists-remote-cache-expire (* 10 60)
  projectile-file-exists-local-cache-expire (* 5 60)
  projectile-require-project-root nil
  projectile-globally-ignored-directories
  '(".git" ".svn" ".hg" "_darcs"
    "out" "output" "repl"
    "dist" "dist-newstyle"
    ".vagrant"
    "project" "target" "compiled" ".bundle"
    "*build" "jar"
    "venv" ".virtualenv"
    "*__pycache__*" "*.egg-info"
    ".tox" ".cache" ".cabal-sandbox" ".stack-work"
    ".emacs.d" "elpa" "site-lisp"
    "bin" "eclipse-bin" ".ensime_cache" ".idea"
    ".eunit" ".bzr"
    "vendor" "uploads" "assets"
    "node_modules" "bower_components"
    "_build" ".psci_modules" ".pulp-cache")
  projectile-globally-ignored-files
  '(".DS_Store" "TAGS" ".nrepl-port" "*.gz" "*.pyc" ".purs-repl"
    "*.jar" "*.tar.gz" "*.tgz" "*.zip" "package-lock.json"))
 :config
 ;; use projectile everywhere
 (projectile-mode 1)
 ;; remove the mode name for projectile-mode, but show the project name
 ;; :delight '(:eval (concat " " (projectile-project-name)))
 :bind-keymap
 ("M-[" . projectile-command-map)
 :diminish projectile-mode)

Counsel

Git

With editor

Magit

Evil-Magit

Magit todos

Forge

Git gutter

Time machine

Syntactic modes

Magithub

Gist

Shell

Eshell

EM-smart

Esh help

Esh autosuggest

EShell toggle

VTerm

Install https://github.com/akermu/emacs-libvterm.

(use-package vterm
  :custom
  (vterm-buffer-name-string "vterm %s")
  (vterm-kill-buffer-on-exit t)
  (vterm-max-scrollback 100000)
  :custom-face
  (vterm-color-default ((t :inherit term)))
;  :init
;  (add-hook 'vterm-exit-functions
;    (lambda (buffer event)
;      (kill-buffer buffer)))
)

Undo

Propose

Tree

SSH

Config mode

Tramp

Counsel-tramp

Docker-tramp

Vagrant-tramp

Kubernetes-tramp

Blah

Smartparens

Main

Evil

Snippets

Yasnippet

Org

Main

Setup

(use-package org
  :after (general counsel)
  :mode ("\\.org\\'" . org-mode)
  :commands
  (org-babel-do-load-languages)
  :init

Config

Visually indent sections. This looks better for smaller files. Also, disallow editing invisible areas.

(setq org-startup-indented t)
(setq org-catch-invisible-edits 'error)

This feature came to Org in version 8. It lets you type “normal quotes” in the org buffer, as opposed to “this latex stuff”, and will transform them on export so that your HTML/text output looks nice and your latex export looks nice!

(setq org-export-with-smart-quotes t)

Forces to mark all child tasks as DONE before you can mark the parent as DONE.

(setq org-enforce-todo-dependencies t)

Allows displaying UTF-8 chars like \alpha.

(setq org-pretty-entities t)

Insert an annotation in a task when it is marked as done including a timestamp of when exactly that happened.

(setq org-log-done 'time)

Insert annotations when you change the deadline of a task, which will note the previous deadline date and when it was changed.

(setq org-log-redeadline (quote time))

Same as above, but for the scheduled dates.

(setq org-log-reschedule (quote time))

Hide leading stars.

(setq org-hide-leading-stars t)

Use syntax highlighting in source blocks while editing.

(setq org-src-fontify-natively t)

Noticeable ellipsis. Others:

, , , , , , ,

(setq org-ellipsis "")

Keep org files in Dropbox. And all of those files should be in included agenda.

(setq
 org-directory "~/Dropbox/org"
 org-agenda-files '("~/Dropbox/org/"))

Refile targets should include files and down to 9 levels into them.

(setq
 org-refile-targets
 (quote ((nil :maxlevel . 9)
  (org-agenda-files :maxlevel . 9))))

And inside those code blocks indentation should be correct depending on the source language used and have code highlighting.

(setq org-src-tab-acts-natively t)
(setq org-src-preserve-indentation t)
(setq org-src-fontify-natively t)

State changes for todos and also notes should go into a Logbook drawer:

(setq org-log-into-drawer t)

Open URLs in Firefox.

(setq
 org-file-apps
 (quote
  ((auto-mode . emacs)
   ("\\.mm\\'" . default)
   ("\\.x?html?\\'" . "google-chrome %s")
   ("\\.pdf\\'" . default))))

Custom capture templates.

(setq
 org-capture-templates
 '(("t" "todo" entry (file "todo.org") "* TODO %^{task name}\n%u\n%a\n")
   ("n" "note" entry (file "notes.org") "* %^{heading} %t %^g\n  %?\n")
   ("j" "journal" entry (file "journal.org") "* %U - %^{heading}\n  %?")))

I keep my links in links.org, export them to HTML and access them via browser. This makes the HTML file automatically on every save.

(defun org-mode-export-links ()
  "Export links document to HTML automatically when 'links.org' is changed"
  (when (equal (buffer-file-name) "~/Dropbox/org/links.org")
    (progn
      (org-html-export-to-html)
      (alert "HTML exported" :severity 'trivial :title "ORG"))))

(add-hook 'after-save-hook 'org-mode-export-links)

Set TODO priorities.

(setq
 org-highest-priority ?A
 org-lowest-priority ?C
 org-default-priority ?B)

Set default task sequence/lifecycle, colors and triggers.

(setq
  org-todo-keywords
  '((sequence "TODO" "IN-PROGRESS" "WAITING" "HOLD" "|" "DONE" "CANCELLED"))
  org-todo-keyword-faces
  '(("TODO" :foreground "magenta2" :weight bold)
    ("IN-PROGRESS" :foreground "dodger blue" :weight bold)
    ("WAITING" :foreground "orange" :weight bold)
    ("DONE" :foreground "forest green" :weight bold)
    ("HOLD" :foreground "magenta" :weight bold)
    ("CANCELLED" :foreground "forest green" :weight bold)
    ("BUG" :foreground "red" :weight bold)
    ("UNTESTED" . "purple"))
  org-todo-state-tags-triggers
  '(("CANCELLED" ("CANCELLED" . t))
    ("WAITING" ("WAITING" . t))
    ("HOLD" ("WAITING") ("HOLD" . t))
    (done ("WAITING") ("HOLD"))
    ("TODO" ("WAITING") ("CANCELLED") ("HOLD"))
    ("IN-PROGRESS" ("WAITING") ("CANCELLED") ("HOLD"))
    ("DONE" ("WAITING") ("CANCELLED") ("HOLD"))))

Do not dim blocked tasks.

(setq org-agenda-dim-blocked-tasks nil)

Compact the block agenda view.

(setq org-agenda-compact-blocks t)

Hide DONE items.

(setq
 org-agenda-skip-scheduled-if-done t
 org-agenda-skip-deadline-if-done t)

Set a 30 day span, instead of a week view.

(setq
 org-agenda-start-day "-3d"
 org-agenda-span 30)

Omit empty days in the agenda.

(setq org-agenda-show-all-dates nil)

Disable pre-warnings.

(setq org-deadline-warning-days 0)

Hide the time grid by default.

(setq org-agenda-use-time-grid nil)

Make the agenda schedule prettier.

(setq
 org-agenda-prefix-format
 '((agenda . " %i %-12t% s %b\n")
   (timeline . "  % s")
   (todo . " %i %-12:c")
   (tags . " %i %-12:c")
   (search . " %i %-12:c")))

Next comes the :config section.

:config
(require 'org)

Makes inline latex previews bigger.

(setq
 org-format-latex-options
 (plist-put org-format-latex-options :scale 1.7))
(setcdr (assq t org-file-apps-gnu) 'browse-url-xdg-open)
:delight "org")

Evil

Bullets

org-superstar

Prettify headings and plain lists in Org mode. This package is a direct descendant of org-bullets, with most of the code base completely rewritten.

(use-package org-superstar
 :after (org)
 :config
 (org-superstar-configure-like-org-bullets)
 :hook
 (org-mode . org-superstar-mode))

org-bullets (disabled)

I use org-superstart instead, so it is currently disabled.

(use-package org-bullets
 :after org
 :hook
 (org-mode . org-bullets-mode))

Cliplink

Paste links from clipboard and automatically fetch title.

(use-package org-cliplink)

Pandoc exporter

(use-package ox-pandoc)

Blogging with hugo

Install ox-hugo and enable auto export.

(use-package ox-hugo
  :after (ox org-capture)
  :commands (org-hugo-slug)
  :custom
  (org-hugo-delete-trailing-ws nil)
  :config
  ;; Define variable to get rid of 'reference to free variable' warnings.
  (defun my/org-hugo/new-subtree-post ()
    "Returns `org-capture' template string for new blog post.
     See `org-capture-templates' for more information."
    (let*
        ;; Prompt to enter the post title
        ((title (read-from-minibuffer "Post Title: "))
         (lang (read-from-minibuffer "Lang code (e.g. ru-ru): "))
         (date (format-time-string (org-time-stamp-format :long :inactive) (org-current-time)))
         (fname (concat (org-hugo-slug title) "." lang)))
      (mapconcat
       #'identity
       `(
         ,(concat "* TODO " title)
         ":PROPERTIES:"
         ,(concat ":EXPORT_FILE_NAME: " fname)
         ,(concat ":EXPORT_DATE: " date) ;Enter current date and time
         ":END:"
         "%?\n") ; Place the cursor here finally
       "\n")))
  ;; org-capture template to quickly create posts and generate slugs.
  (add-to-list
   'org-capture-templates
   '("b"
     "blog post"
     entry
     (file "~/projects/personal/blog/content-org/posts.org")
     (function my/org-hugo/new-subtree-post))))

Slim HTML export (disabled)

slimhtml is an emacs org mode export backend. It is a set of transcoders for common org elements which outputs minimal HTML.

(use-package htmlize)
(use-package ox-slimhtml)

(defun org-html-export-as-slimhtml
(&optional async subtreep visible-only body-only ext-plist)
  (interactive)
  (org-export-to-buffer 'slimhtml "*slimhtml*"
    async subtreep visible-only body-only ext-plist (lambda () (html-mode))))

(eval-after-load 'org
  `(define-key org-mode-map
     (kbd "s-O")
     (lambda ()
       (interactive)
       (org-html-export-as-slimhtml nil nil nil t)
       (with-no-warnings (mark-whole-buffer))
       ;; TODO: I don't use simpleclip, so need to update this
       ;; (simplecmlip-copy (point-min) (point-max))
       (delete-window))))

Org Download (disabled)

Drag and drop images to org files.

(use-package org-download
  :config
  ;; Org-download creates links, but I need to change the path
  ;; for my blog. This simple hook runs on every save.
  (defun org-mode-blog-fix-org-downloaded-image-paths ()
    (when (equal (buffer-file-name) "~/projects/personal/blog/content-org/blog.org")
      (progn
        (while (re-search-forward "file:../static" nil t)
          (replace-match "file:"))
        (while (re-search-backward "file:../static" nil t)
          (replace-match "file:")))))

  (add-hook 'after-save-hook 'org-mode-blog-fix-org-downloaded-image-paths)
  :hook
  (dired-mode-hook . org-download-enable))

LSP

Mode

Setup lsp-mode.

(use-package lsp-mode
 :after (general projectile)
 :commands (lsp)
 :init
 ;; Uncomment to inspect communication between client and the server
 ;(setq lsp-log-io t)
 :config
 (lsp-enable-which-key-integration t)
 ; https://emacs-lsp.github.io/lsp-mode/page/file-watchers/
 (setq lsp-file-watch-threshold 3000)
 (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\venv\\'")
 (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.venv\\'")
 :delight "lsp"
 :bind-keymap
 ("M-]" . lsp-command-map)
 :bind
 ("<f1>" . lsp-find-references)
 ("<f2>" . lsp-find-definition))

LSP UI

(use-package lsp-ui
 :after (lsp-mode)
 :commands (lsp-ui-mode general)
 :init
 (setq-default
  lsp-ui-doc-frame-parameters
  '((left . -1)
    (top . -1)
    (no-accept-focus . t)
    (min-width . 0)
    (width . 0)
    (min-height . 0)
    (height . 0)
    (internal-border-width . 5)
    (vertical-scroll-bars)
    (horizontal-scroll-bars)
    (left-fringe . 0)
    (right-fringe . 0)
    (menu-bar-lines . 0)
    (tool-bar-lines . 0)
    (line-spacing . 0.1)
    (unsplittable . t)
    (undecorated . t)
    (minibuffer . nil)
    (visibility . nil)
    (mouse-wheel-frame . nil)
    (no-other-frame . t)
    (cursor-type)
    (no-special-glyphs . t)
    (visual-line-mode . -1)))
 :config
 (add-hook 'lsp-mode-hook 'lsp-ui-mode)
 (add-hook 'lsp-after-open-hook 'lsp-enable-imenu)
 (add-hook 'lsp-ui-doc-frame-hook
  (lambda (frame _w)
    (set-face-attribute 'default frame :font "Fira Code" :height 110)))
 (setq
  lsp-ui-sideline-enable nil
  lsp-enable-completion-at-point t
  lsp-ui-doc-position 'bottom
  ; lsp-ui-doc-position 'at-point
  lsp-ui-doc-header nil
  lsp-ui-doc-enable nil
  lsp-ui-doc-delay 0.5
  lsp-ui-doc-use-webkit nil
  ;; lsp-ui-doc-max-width 160
  ;; lsp-ui-doc-max-height 20
  ;; lsp-ui-doc-use-childframe t
  lsp-ui-doc-include-signature t
  lsp-ui-doc-border "#222"
  ;; lsp-ui-flycheck-enable t
  lsp-ui-peek-fontify nil
  lsp-ui-peek-expand-function (lambda (xs) (mapcar #'car xs))))

Company LSP

`company-lsp` is not supported anymore, using `company-capf` as the `lsp-completion-provider`.

(use-package company-lsp
 :after (lsp-mode company)
 ;; :quelpa
 ;; (company-lsp :fetcher github :repo "tigersoldier/company-lsp")
 :commands (company-lsp)
 :init
 (setq
  ;; Don't filter results on the client side
  company-transformers nil
  company-lsp-cache-candidates 'auto
  company-lsp-async t
  company-lsp-enable-snippet t)
 :config
 (push 'company-lsp company-backends))

Treemacs

(use-package lsp-treemacs
 :after (general)
 :commands lsp-treemacs-errors-list)

Languages

Lisp

Emacs Lisp

Mode

Refs

Macrostep

Highlight

Haskell

Hasklig (ligatures)

Mode

Hi2

Hindent

Ormolu

Company-cabal

Hasky-stack

Hasky-extensions

LSP

PureScript

Mode

PSC IDE

PSCI

Idris

ATS/ATS2

Nix

Helpers

Ocaml

Variables

Utop

Merlin

Tuareg

Indentation

Dune

Flycheck

Coq

Merlin eldoc

Reason

SML

Scheme

Racket

Clojure

Scala

Kotlin

Rust

Erlang

Elixir

Prolog

Dhall

Terraform

Mode

Company

SQL

Json

Yaml

Markdown

Emmet

Tex

Prolog

Python

Replace keywords with mathematical symbols. Currently disabled due to graphical issues.

(use-package python-mode
 :preface
 (defun my/python-mode/setup ()
   (mapc (lambda (pair) (push pair prettify-symbols-alist))
         '(("def" . "𝒇")
           ("class" . "𝑪")
           ("and" . "")
           ("or" . "")
           ("not" . "")
           ("in" . "")
           ("not in" . "")
           ("return" . "")
           ("yield" . "")
           ("for" . "")
           ("!=" . "")
           ("==" . "")
           (">=" . "")
           ("<=" . "")
           ("[]" . "")
           ("=" . ""))))
 :hook
 (python-mode . my/python-mode/setup))

Using https://github.com/Microsoft/python-language-server Currently disabled due to abandon of the project.

(use-package lsp-python-ms
  :ensure t
  :init (setq lsp-python-ms-auto-install-server t)
  :hook (python-mode . (lambda ()
                          (require 'lsp-python-ms)

                          (lsp))))  ; or lsp-deferred

Using https://github.com/microsoft/pyright

(use-package lsp-pyright
  :ensure t
  :hook (python-mode . (lambda ()
                          (require 'lsp-pyright)
                          (lsp))))  ; or lsp-deferred
;  :custom
;  (lsp-pyright-multi-root nil)

Ruby

PHP

Java

Kotlin

Groovy

Web

Mode

Company

Styling

CSS mode

LSP-CSS

SCSS mode

Go

TypeScript

Flow

JavaScript

tern

npm

js2

eslintd-fix

xref-js2

js2-refactor

rjxs-mode

LSP

prettier

GraphQL

company-tern

Vue

Elm

Nginx

D

C/C++

Objective C

Matlab

Octave

Latex

Toml

Bison

Pug

Jade

Lua

Haml

Slim

Robots.txt

Dotenv

CSV

Api blueprint

NASM

IASM

BNF

Ansible

Arduino

GLSL

GDB

DAP

Use the Debug Adapter Protocol for running tests and debugging.

(use-package dap-mode
  :config
  ;(require 'dap-cpptools)
  ;(dap-mode 1)
  ;(dap-ui-mode 1)
  ;(add-hook 'dap-stopped-hook
  ;  (lambda (arg) (call-interactively #'dap-hydra)))
  :bind
  ("<f5>" . dap-debug) ; Start or continue debugging
  ("<S-f5>" . dap-disconnect) ; Exit debugger
  ("<f10>" . dap-next) ; Step over
  ("<f11>" . dap-step-in) ; Step into
  ("<S-f11>" . dap-step-out) ; Step out
  ("<f9>" . dap-breakpoint-add) ; Set or remove breakpoint
  ("<C-f9>" . dap-breakpoint-toggle) ; Enable or disable breakpoint
  :hook
  (lsp-mode . dap-mode)
  (lsp-mode . dap-ui-mode))

HTTP

Docker

Kubernetes

Hydra

Install

Text scale

Window management

Help

Infrastructure

Net utils

IX

Calendar

Email

Reading

PDF

Djvu

Translation

Search

Engine mode

Google this

Stack exchange

Messaging

Prerequisites

Slack

Telega

telega.el is full featured unofficial client for Telegram platform for GNU Emacs.

(use-package telega
 :requires
 (tracking)
 :config
 ;(telega-notifications-mode 1)
 (telega-patrons-mode 0)
 (telega-mode-line-mode 1)
 (telega-appindicator-mode 1)
 (setq telega-chat-show-deleted-messages-for 'all)
 ;(setq telega-tdlib-min-version "1.5.0")
 (setq telega-translate-to-language-by-default "ru")
 (defun my-watch-in-mpv (url)
	 (async-shell-command (format "mpv -v %S" url)))
 :custom
 (telega-use-tracking-for 'all)
 ;(telega-chat-prompt-show-avatar-for 'nil)
 (telega-chat-prompt-format
		'((:eval
	   (telega-chatbuf-prompt-default-sender-avatar))
	  (:eval
	   (telega-chatbuf-prompt-body))
	  ;(:eval
	   ;(when
		;   (and telega-use-images
		 ;   (telega-chatbuf-match-p 'can-send-or-post))
		 ;(telega-chatbuf-prompt-chat-avatar)))
	  (:eval
	   (when
		   (and telega-auto-translate-mode telega-chatbuf-language-code telega-translate-to-language-by-default
			(not
			 (equal telega-chatbuf-language-code telega-translate-to-language-by-default)))
		 (propertize
		  (format "[%s%s]" telega-translate-to-language-by-default telega-chatbuf-language-code)
		  'face 'shadow)))
	  ">> "))
 ;(telega-chat-use-markdown-version 'nil)
 (telega-chat-input-markups '(nil "markdown2" "org"))
 (telega-chat-ret-always-sends-message 't)
 (telega-open-file-function 'org-open-file)
 (telega-online-status-function (lambda () 't))
 (telega-browse-url-alist
	   '(("https?://\\(www\\.\\)?youtube.com/watch" . my-watch-in-mpv)
	   ("https?://youtu.be/" . my-watch-in-mpv)))
 :custom-face
 (telega-entity-type-code ((t :family "Iosevka" :height 0.85)))
 (telega-entity-type-pre ((t :family "Iosevka" :height 0.85)))
 (telega-webpage-fixed ((t :family "Iosevka" :height 0.85)))
 :bind-keymap
 ("C-c t" . telega-prefix-map)
 :init
 (add-hook 'telega-chat-mode-hook
	 (lambda ()
	   (set
		 (make-local-variable 'company-backends)
		 (append '(telega-company-emoji
					 telega-company-username
					 telega-company-hashtag)
				 (when (and telega-chatbuf--chat (telega-chat-bot-p telega-chatbuf--chat))
					   '(telega-company-botcmd))))
	   (company-mode 1))))

Pomodoro

Statistics

Uptimes

Keyfreq

Wakatime

Delight

Diminish

About

Emacs config

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published