Skip to content

EgorDuplensky/emacs-init-org

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

common settings

Increase gc threshold

(setq gc-cons-threshold 100000000)

Increase amount data emacs read from process

(setq read-process-output-max (* 1024 1024))

Always ask before quit

(setq confirm-kill-emacs 'y-or-n-p)

Custom variables

;; Save to kill ring before kill
(setq save-interprogram-paste-before-kill t)
;; to put emacs's autogenerating lisp code into separate file
(setq custom-file "~/.emacs.d/.emacs-custom.el")
;; Treat all custom themes as safe
(setq custom-safe-themes t)
;; Suppress starting emacs message
(setq inhibit-startup-message 1)
;; Top frame: <filename with full path>
(setq frame-title-format "%b")
(defvar x-strech-cursor)
(setq x-strech-cursor 1)
;; Copy/paste from another system apps
(setq x-select-enable-clipboard t)

Enable/Disable some minor modes

;; Mode line config
(column-number-mode 1)
;; Hide default TOOLBAR
(hide-ifdef-mode 1)
;; Hightlight brackets
(show-paren-mode t)
;; Display the current function name in the mode line
(which-function-mode -1)
;; Disable toolbar
(tool-bar-mode 0)
;; Disable menubar
(menu-bar-mode 0)
;; Disable scrollbar
(scroll-bar-mode 0)

(defun my/disable-scroll-bars (frame)
  (modify-frame-parameters frame
                           '((vertical-scroll-bars . nil)
                             (horizontal-scroll-bars . nil))))
(add-hook 'after-make-frame-functions 'my/disable-scroll-bars)
(blink-cursor-mode 0)
;; Overwrite selected text
(delete-selection-mode 1)
;; left fringe for indicators, right fringe for long lines
;;(set-fringe-mode '(8 . 8))
(defun ide-mode ()
  (interactive)
  (menu-bar-mode 1)
  (tool-bar-mode 1)
  (centaur-tabs-mode 1)
  (treemacs)
  )

(defun ide-mode-exit ()
  (interactive)
  (menu-bar-mode -1)
  (tool-bar-mode -1)
  (centaur-tabs-mode -1)
  (treemacs)
  )

Scrolling without moving point

Useful feature but not sure about bindings yet

(setq scroll-preserve-screen-position t)
(defun gcm-scroll-down ()
  (interactive)
  (forward-paragraph)
  (recenter nil nil)
  )
(defun gcm-scroll-up ()
  (interactive)
  (backward-paragraph)
  (recenter nil nil)
  )
(global-set-key (kbd "M-p") 'gcm-scroll-up)
(global-set-key (kbd "M-n") 'gcm-scroll-down)

Disable alarm bell for “C-g”

(setq ring-bell-function 'ignore)
(setq visible-bell t)

y-or-n-p

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

Do not need backup and autosave files

(setq make-backup-files nil) ; stop creating backup~ files
(setq auto-save-default nil) ; stop creating #autosave# file

Keybindings

(global-set-key "\C-c\C-c" 'compile)
(global-set-key "\C-c\C-k" 'indent-for-comment)
(global-set-key "\C-c\C-l" 'indent-new-comment-line)
(global-set-key "\C-c\C-s" 'kill-compilation)
(global-set-key "\C-c\M-b" 'emu-backend-find)
(global-set-key (kbd "C-<f2>") 'previous-error)
(global-set-key (kbd "C-<f3>") 'next-error)
(define-key global-map [f4] 'revert-buffer)
(define-key global-map [f5] 'previous-buffer)
(define-key global-map [f6] 'next-buffer)
(define-key global-map [f7] 'pop-to-mark-command)
(define-key global-map [f8] 'goto-last-change-reverse)
(define-key global-map [f9] 'goto-last-change)
(define-key global-map [f11] 'kmacro-start-macro)
(define-key global-map [f12] 'kmacro-end-or-call-macro)
(global-unset-key (kbd "C-z"))
(global-unset-key (kbd "C-x C-z"))
(global-unset-key (kbd "C-x C-c")) ;; save-buffers-kill-terminal
(global-unset-key [home])
(global-unset-key [end])
(define-key function-key-map [home] 'beginning-of-buffer)
(define-key function-key-map [end] 'end-of-buffer)

line numbers configuration

(dolist (mode '(text-mode-hook
                prog-mode-hook
                conf-mode-hook))
  (add-hook mode (lambda () (display-line-numbers-mode 1))))

(dolist (mode '(org-mode-hook
                term-mode-hook
                shell-mode-hook
                treemacs-mode-hook
                eshell-mode-hook
                markdown-mode-hook
                rst-mode-hook
                ))
  (add-hook mode (lambda () (display-line-numbers-mode 0))))

comment / comment out

;; Comment/uncomment current line
(defun comment-or-uncomment-region-or-line ()
  "Comments or uncomments the region or the current line if there's no active region."
  (interactive)
  (let (beg end)
    (if (region-active-p)
        (setq beg (region-beginning) end (region-end))
      (setq beg (line-beginning-position) end (line-end-position)))
    (comment-or-uncomment-region beg end)
    (next-line)))
(global-set-key (kbd "C-c C-v") 'comment-or-uncomment-region-or-line)

;;(add-hook 'c++-mode-hook (lambda () (setq comment-start "/* " comment-end   " */")))

ansi-term

Some old settings related to running emacs in terminal mode. Most likely can be removed.

(defun fix-performance-bug ()
  (setq bidi-paragraph-direction 'left-to-right))
(add-hook 'term-mode-hook 'fix-performance-bug)

ediff

Make vertical split by default

(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(setq ediff-diff-options "-w")
(setq ediff-split-window-function 'split-window-horizontally)

auto-mode

(add-to-list 'auto-mode-alist '("Makefile\\..+" . makefile-mode))
(add-to-list 'auto-mode-alist '("Dockerfile.+" . dockerfile-mode))
(add-to-list 'auto-mode-alist '("\\.*bashrc" . shell-script-mode))
(add-to-list 'auto-mode-alist '("\\.profile" . shell-script-mode))
(add-to-list 'auto-mode-alist '("\\.xinitrc" . shell-script-mode))

browser

(defun browse-url-edge (url &optional new-window)
  (shell-command
   (concat "start microsoft-edge:" url)
   ;;(concat "start google-chrome:" " " url)
   ))

(if (eq system-type 'windows-nt)
    (setq browse-url-browser-function 'browse-url-edge)
  (setq browse-url-browser-function 'browse-url-generic
        browse-url-generic-program "microsoft-edge")
  )

autosave bookmarks

(setq bookmark-save-flag t)

file path to clipboard

Useful when you need to enter file’s location in terminal

(defun copy-file-name-to-clipboard ()
  "Copy the current buffer file name to the clipboard."
  (interactive)
  (let ((filename (if (equal major-mode 'dired-mode)
                      default-directory
                    (buffer-file-name))))
    (when filename
      (kill-new filename)
      (message "Copied buffer file name '%s' to the clipboard." filename))))

kill all buffers except current one

(defun kill-other-buffers ()
  "Kill all other buffers."
  (interactive)
  (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))

always truncate line by default

Otherwise it can slow down emacs by a lot

(set-default 'truncate-lines t)

set temp directory used by some packages

(setq-default temporary-file-directory "~/.cache/emacs")
(unless (file-exists-p temporary-file-directory)
  (make-directory temporary-file-directory))

buffer revert automatically

(global-auto-revert-mode 1)
(setq global-auto-revert-non-file-buffers t)

undo

(global-set-key "\M-u" 'undo)
(global-set-key "\M-r" 'undo-redo)

new-line-no-break

(defun open-line-without-break-of-line ()
  "Insert a newline above the current line and put point at beginning."
  (interactive)
  (unless (bolp)
    (beginning-of-line))
  (newline)
  (forward-line -1)
  (indent-according-to-mode))

;; newline-without-break-of-line
(defun newline-without-break-of-line ()
  "1. move to end of the line.
      2. insert newline with index"

  (interactive)
  (let ((oldpos (point)))
    (end-of-line)
    (newline-and-indent)))
(global-set-key (kbd "C-c o") 'open-line-without-break-of-line)
(global-set-key (kbd "C-M-m") 'newline-without-break-of-line)

server

(setq server-kill-new-buffers nil)

yank-and-indent

(defun yank-and-indent ()
  "1. yank
   2. indent-region"

  (interactive)
  (let ((beg (point)))
    (yank)
    (indent-region beg (point))))
(global-set-key "\C-\M-y" 'yank-and-indent)

theme

(use-package zenburn-theme
  :init
  (setq zenburn-scale-org-headlines t)
  (load-theme 'zenburn t)
  :config
  (set-face-background 'show-paren-mismatch "orange red")
  (set-face-foreground 'which-func "#93E0E3")
  ;; (set-face-background 'hl-line "#111111")
  ;; also highlight underlying entities in documentation
  (set-face-attribute 'button nil :foreground "#7F9F7F")

  (defvar my/font-name
    (if (eq system-type 'windows-nt)
        "Inconsolata Nerd Font Mono"
      "Inconsolata Nerd Font Mono"))

  (set-frame-font my/font-name)
  (add-to-list 'default-frame-alist `(font . ,my/font-name))
  (set-face-font 'fixed-pitch my/font-name)
  (set-face-attribute 'default nil
                      :font my/font-name
                      :weight 'normal
                      :height 140)

  ;; Set the fixed pitch face
  (set-face-attribute 'fixed-pitch nil
                      :font my/font-name
                      :weight 'light
                      :height 100)

  ;; Set the variable pitch face
  (set-face-attribute 'variable-pitch nil
                      :font "Inconsolata Nerd Font"
                      :weight 'normal
                      :height 100)
  ;; little bit transparency
  (set-frame-parameter (selected-frame) 'alpha-background 90)
  (add-to-list 'default-frame-alist '(alpha-background . 90))
  (set-frame-parameter (selected-frame) 'alpha '(100 . 100))
  (add-to-list 'default-frame-alist '(alpha . (100 . 100)))
  ;; fullscreen
  (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
  (add-to-list 'default-frame-alist '(fullscreen . maximized))
  :custom-face
  (vertico-current ((t :inherit region :foreground unspecified :underline nil)))
  )

(defvar ligatures-FiraCode
  '("--" "---" "==" "===" "!=" "!==" "=!=" "=:=" "=/=" "<=" ">=" "&&" "&&&" "&=" "++" "+++"
    "***" ";;" "!!" "??" "?:" "?." "?=" "<:" ":<" ":>" ">:" "<>" "<<<" ">>>" "<<" ">>" "||" "-|"
    "_|_" "|-" "||-" "|=" "||=" "##" "###" "####" "#{" "#[" "]#" "#(" "#?" "#_" "#_(" "#:"
    "#!" "#=" "^=" "<$>" "<$" "$>" "<+>" "<+ +>" "<*>" "<* *>" "</" "</>" "/>" "<!--"
    "<#--" "-->" "->" "->>" "<<-" "<-" "<=<" "=<<" "<<=" "<==" "<=>" "<==>" "==>" "=>"
    "=>>" ">=>" ">>=" ">>-" ">-" ">--" "-<" "-<<" ">->" "<-<" "<-|" "<=|" "|=>" "|->" "<-"
    "<~~" "<~" "<~>" "~~" "~~>" "~>" "~-" "-~" "~@" "[||]" "|]" "[|" "|}" "{|" "[<" ">]"
    "|>" "<|" "||>" "<||" "|||>" "|||>" "<|>" "..." ".." ".=" ".-" "..<" ".?" "::" ":::"
    ":=" "::=" ":?" ":?>" "//" "///" "/*" "*/" "/=" "//=" "/==" "@_" "__"))

(use-package ligature
  :straight (:host github :repo "mickeynp/ligature.el")
  :config
  (ligature-set-ligatures 'prog-mode ligatures-FiraCode)
  (global-ligature-mode t))

(use-package gruvbox-theme)

editing stuff

undo-tree

(use-package undo-tree
  :disabled t ;; to heavy, consider to drop completely
  :config
  (global-undo-tree-mode)
  (setq undo-tree-auto-save-history nil)
  :bind
  ("M-u" . undo)
  )

hungry-delete

(use-package hungry-delete
  :disabled t
  :config (global-hungry-delete-mode))

aggressive-indent

(use-package aggressive-indent)

expand-region

(use-package expand-region
  :after (org)
  :init
  ;; disable M-q fill paragraph"
  (defun my-expand-region-bind-hook()
    (local-unset-key (kbd "M-q"))
    )
  (add-hook 'c-mode-hook 'my-expand-region-bind-hook)
  (add-hook 'c++-mode-hook 'my-expand-region-bind-hook)
  :config
  ;; expand region seems to be not working properly with this mode enabled
  (setq shift-select-mode nil)
  :bind
  ("M-q" . er/expand-region)
  ("M-Q" . er/contract-region)
  )

smartparens

(use-package smartparens
  ;; disable for now
  :disabled t
  :config (smartparens-global-mode t)
  :custom (sp-escape-quotes-after-insert nil)
  :hook (minibuffer-setup . smartparens-mode)
  :bind
  ("C-c i u" . sp-unwrap-sexp)
  ("C-c i k" . sp-kill-sexp)
  ("C-c i r" . sp-rewrap-sexp)
  ("C-c i {" . sp-wrap-curly)
  ("C-c i [" . sp-wrap-square)
  ("C-c i (" . sp-wrap-round)
  )

expreg

(use-package expreg)

iedit

(defun iedit-current-func-mode()
  (interactive)
  (if (bound-and-true-p iedit-mode)
      (iedit-mode)
    (iedit-mode-toggle-on-function)
    )
  )

(use-package iedit
  :bind
  (("C-;" . iedit-current-func-mode)
   ("C-:" . iedit-mode)
   :map iedit-mode-keymap
   ("<tab>" . iedit-next-occurrence)
   ("<backtab>" . iedit-prev-occurrence)))

visual-regexp

(use-package visual-regexp
  :bind
  (("C-c r" . vr/replace)
   ("C-c q" . vr/query-replace)
   )
  )

ialign

(use-package ialign)

wgrep

(use-package wgrep
  :config
  (setq wgrep-enable-key "r"))

move-text

(use-package move-text
  :init
  (move-text-default-bindings)
  )

tree-sitter

(use-package tree-sitter-langs
  :config
  (tree-sitter-langs-install-latest-grammar t)
  (setq c-ts-mode-indent-offset 4)
  (global-tree-sitter-mode)
  ;; (add-to-list 'tree-sitter-major-mode-language-alist '(c++-ts-mode . cpp))
  ;; (add-to-list 'tree-sitter-major-mode-language-alist '(c-ts-mode . c))
  :hook
  ((c++-mode c++-ts-mode) . tree-sitter-hl-mode)
  (c-mode . tree-sitter-hl-mode)
  ;; markdown crashes with tree-sitter-hl-mode
  (markdown-mode . tree-sitter-hl-mode)
  (python-mode . tree-sitter-hl-mode)
  (json-mode . tree-sitter-hl-mode)
  (cmake-mode . tree-sitter-hl-mode)
  (plantuml-mode . tree-sitter-hl-mode)
  (yaml-mode . tree-sitter-hl-mode)
  )

(use-package treesit-auto
  :disabled t
  :custom
  (treesit-auto-install 'nil)
  :config

  (treesit-auto-add-to-auto-mode-alist 'all)
  (global-treesit-auto-mode))

tramp

(use-package tramp
  :ensure nil;; native emacs package
  :straight (:type built-in) ;; native emacs package
  :custom
  (tramp-default-method "sshx")
)

dired

Hide extra information by default

(use-package dired-single)
(use-package dired
  :ensure nil;; native emacs package
  :straight (:type built-in) ;; native emacs package
  :commands (dired dired-jump)
  :hook (dired-mode-hook . (lambda () (interactive)
                             (dired-omit-mode 1)
                             (dired-hide-details-mode 1)
                             ))
  :config
  (setq dired-listing-switches "-agho --group-directories-first")
  (setq dired-dwim-target t)
  )
(use-package dired-hide-dotfiles
  :hook (dired-mode . dired-hide-dotfiles-mode)
  :bind (:map dired-mode-map
              ("H" . dired-hide-dotfiles-mode))
  )
(use-package dired-gitignore
  :hook (dired-mode . dired-gitignore-mode)
  :bind (:map dired-mode-map
              ("h" . dired-gitignore-mode))
  )

dirvish

(use-package dirvish
  :config
  (setq dirvish-attributes
        '(all-the-icons
          file-time
          file-size
          subtree-state
          vc-state
          git-msg)))
(use-package dirvish-icons
  :straight nil)

peep-dired

Show file at point in other window

(use-package peep-dired)

all-the-icons-dired

(use-package all-the-icons-dired
  :hook (dired-mode . all-the-icons-dired-mode)
  )

multiple-cursors

(use-package multiple-cursors
  :bind
  ("C->" . mc/mark-next-like-this)
  ("C-<" . mc/mark-previous-like-this)
  ("C-c > d" . mc/mark-all-like-this-dwim)
  ("C-c > l" . mc/edit-lines)
  ("C-c > e" . mc/edit-ends-of-lines)
  ("C-c > a" . mc/edit-beginnings-of-lines)
  ("C-c > n" . mc/insert-numbers)
  ("C-c > v" . mc/vertical-align-with-space)
  :custom-face
  (mc/cursor-face ((t :inherit cursor)))
  )

inner-mode

(use-package change-inner)

emmo

(use-package emmo
  :after expand-region
  :straight (:local-repo "/home/eduplens/git/emmo")
  :config
  (emmo-init)
  )

navigation

posframe

(use-package posframe)

custom

(defun smarter-move-beginning-of-line (arg)
  "Move point back to indentation of beginning of line.

Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.

If ARG is not nil or 1, move forward ARG - 1 lines first.  If
point reaches the beginning or end of the buffer, stop there."
  (interactive "^p")
  (setq arg (or arg 1))

  ;; Move lines first
  (when (/= arg 1)
    (let ((line-move-visual nil))
      (forward-line (1- arg))))

  (let ((orig-point (point)))
    (back-to-indentation)
    (when (= orig-point (point))
      (move-beginning-of-line 1))))

;; remap C-a to `smarter-move-beginning-of-line'
(global-set-key (kbd "C-a") 'smarter-move-beginning-of-line)

ag

(use-package ag)

ibuffer

ibuffer-vc

(use-package ibuffer-vc)
(defalias 'list-buffers 'ibuffer)	;
(global-set-key (kbd "C-x C-b") 'ibuffer)
(setq ibuffer-saved-filter-groups
      (quote (("default"
               ("dired" (mode . dired-mode))
               ("org" (mode . org-mode))
               ("magit" (name . "^magit.*$"))
               ("shell" (or (mode . eshell-mode) (mode . shell-mode) (mode . shell-script-mode)))
               ("c/c++" (or
                         (mode . c++-mode)
                         (mode . c-mode)))
               ("tcl" (or
                       (mode . tcl-mode)
                       ))
               ("log-files" (name . "^\\.log$|messages[.]?[1-9]*$"))
               ;; ("log-files" (name . "^\\.log$"))
               ("cnf-files" (name . "^\\.cnf$"))
               ("xml-files" (name . "^\\.xml$"))
               ("other-languages" (or
                                   (mode . java-mode)
                                   (mode . python-mode)
                                   (mode . groovy-mode)
                                   ))
               ("emacs" (or
                         (name . "^\\*scratch\\*$")
                         (name . "^\\*Messages\\*$")))
               ("gdb" (or (mode . gdb-threads-mode) (mode . gud-mode) (mode . gdb-locals-mode) (mode . gdb-inferior-io-mode)))
               ))))
(add-hook 'ibuffer-mode-hook
          (lambda ()
            (ibuffer-auto-mode 1)
            (ibuffer-switch-to-saved-filter-groups "default")))

;; Use human readable Size column instead of original one
(define-ibuffer-column size-h
  (:name "Size" :inline t)
  (cond
   ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
   ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
   (t (format "%8d" (buffer-size)))))

;; Explicitly require ibuffer-vc to get its column definitions, which
;; can't be autoloaded
(require 'ibuffer-vc)

;; Modify the default ibuffer-formats (toggle with `)
(setq ibuffer-formats
      '((mark modified read-only vc-status-mini " "
              (name 18 18 :left :elide)
              " "
              (size-h 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " "
              filename-and-process)
        (mark modified read-only vc-status-mini " "
              (name 18 18 :left :elide)
              " "
              (size-h 9 -1 :right)
              " "
              (mode 16 16 :left :elide)
              " "
              (vc-status 16 16 :left)
              " "
              filename-and-process)))

;; don't show these
;;(add-to-list 'ibuffer-never-show-predicates "zowie")

;; Don't show filter groups if there are no buffers in that group
(setq ibuffer-show-empty-filter-groups nil)
;; Use more human readable 'ls' options
(setq dired-listing-switches "-lahF --group-directories-first")

ibuffer-tramp

(use-package ibuffer-tramp)

bufferlo

(use-package bufferlo
  :ensure t
  :config
  (defvar my-consult--source-buffer
    `(:name "All Buffers"
            :narrow   ?a
            :hidden   t
            :category buffer
            :face     consult-buffer
            :history  buffer-name-history
            :state    ,#'consult--buffer-state
            :items ,(lambda () (consult--buffer-query
                                :sort 'visibility
                                :as #'buffer-name)))
    "All buffer candidate source for `consult-buffer'.")

  (defvar my-consult--source-local-buffer
    `(:name nil
            :narrow   ?b
            :category buffer
            :face     consult-buffer
            :history  buffer-name-history
            :state    ,#'consult--buffer-state
            :default  t
            :items ,(lambda () (consult--buffer-query
                                :predicate #'bufferlo-local-buffer-p
                                :sort 'visibility
                                :as #'buffer-name)))
    "Local buffer candidate source for `consult-buffer'.")

  (setq consult-buffer-sources '(consult--source-hidden-buffer
                                 my-consult--source-buffer
                                 my-consult--source-local-buffer
                                 consult--source-hidden-buffer
                                 consult--source-modified-buffer
                                 consult--source-buffer
                                 consult--source-recent-file
                                 consult--source-file-register
                                 consult--source-bookmark
                                 consult--source-project-buffer-hidden
                                 consult--source-project-recent-file-hidden
                                 ;; ... other sources ...
                                 ))
  (bufferlo-mode 1))

midnight

Automatically close the buffers that have not been visited in 3 days.

(use-package midnight
  :ensure nil   ;; native emacs package
  :straight (:type built-in) ;; native emacs package
  :config
  (midnight-delay-set 'midnight-delay "4:30am"))

smooth-scrolling

(use-package smooth-scrolling
  :config
  (setq smooth-scroll-margin 15)
  (smooth-scrolling-mode 1)
  )

avy

    (use-package avy
      :config
      (defun avy-goto-line-smart()
        (interactive)
        (avy-goto-line)
        (smarter-move-beginning-of-line 1)
        )
      (defun avy-goto-word-2 (char1 char2 &optional arg beg end symbol)
        "Jump to the currently visible CHAR1 followed by CHAR2 at a word start.
         The window scope is determined by `avy-all-windows'.
         When ARG is non-nil, do the opposite of `avy-all-windows'.
         BEG and END narrow the scope where candidates are searched.
         When SYMBOL is non-nil, jump to symbol start instead of word start."
        (interactive (list (let ((c1 (read-char "char 1: " t)))
                             (if (memq c1 '(?ďż˝ ?\b))
                                 (keyboard-quit)
                               c1))
                           (let ((c2 (read-char "char 2: " t)))
                             (cond ((eq c2 ?ďż˝)
                                    (keyboard-quit))
                                   ((memq c2 avy-del-last-char-by)
                                    (keyboard-escape-quit)
                                    (call-interactively 'avy-goto-char-2))
                                   (t
                                    c2)))
                           current-prefix-arg
                           nil nil))
        (avy-with avy-goto-word-2
          (let* ((str (string char1 char2))
                 (regex (cond ((string= str ".")
                               "\\.")
                              ((and avy-word-punc-regexp
                                    (string-match avy-word-punc-regexp str))
                               (regexp-quote str))
                              ((and (<= char1 26) (<= char2 26))
                               str)
                              (t
                               (concat
                                (if symbol "\\_<" "\\b")
                                str)))))
            (avy-jump regex
                      :window-flip arg
                      :beg beg
                      :end end))))
      :config
      (setq avy-keys '(?a ?s ?d ?f ?g ?j ?l ?o
                       ?v ?b ?n ?, ?/ ?u ?p ?e
                       ?c ?q ?\;))
      ;;(setq avy-keys '(?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?0)))
      ;;(setq avy-keys '(?\! ?@ ?\# ?$ ?% ?^ ?& ?\* ?\( ?\)))
      (setq avy-single-candidate-jump nil)
      (setq avy-dispatch-alist '(
                                 ;; marking
                                 (?m . avy-action-mark)
                                 (?M . avy-action-mark-to-char)
                                 ;; copying
                                 (?w . avy-action-copy)
                                 (23 . avy-action-copy-wrapped);; Ctrl-w
                                 (?W . avy-action-copy-whole-line)
                                 ;; killing
                                 (?k . avy-action-kill-stay)
                                 (11 . avy-action-kill-line);; Ctrl-k
                                 (?K . avy-action-kill-whole-line)
                                 ;; yanking
                                 (?y . my-avy-action-yank)
                                 (25 . avy-action-yank-line);; Ctrl-y
                                 (?Y . avy-action-yank-whole-line)
                                 ;; teleporting
                                 (?t . avy-action-teleport)
                                 (?T . avy-action-teleport-whole-line)
                                 ;; misc
                                 (?i . avy-action-ispell)
                                 (?z . avy-action-zap-to-char)
                                 (?. . avy-action-embark)
                                 (?= . avy-action-define)
                                 (?h . avy-action-helpful)
                                 (?x . avy-action-exchange)
                                 )
            )
      (setq avy-background nil)

      (defun avy-action-copy-wrapped (pt)
        (save-excursion
          (let (str)
            (goto-char pt)
            (backward-char 1)
            (sp-forward-sexp)
            (backward-char 1)
            (setq str (buffer-substring pt (point)))
            (kill-new str)
            (message "Copied: %s" str)))
        (let ((dat (ring-ref avy-ring 0)))
          (select-frame-set-input-focus
           (window-frame (cdr dat)))
          (select-window (cdr dat))
          (goto-char (car dat))))

      (defun avy-action-easy-copy (pt)
        (unless (require 'easy-kill nil t)
          (user-error "Easy Kill not found, please install."))
        (goto-char pt)
        (cl-letf (((symbol-function 'easy-kill-activate-keymap)
                   (lambda ()
                     (let ((map (easy-kill-map)))
                       (set-transient-map
                        map
                        (lambda ()
                          ;; Prevent any error from activating the keymap forever.
                          (condition-case err
                              (or (and (not (easy-kill-exit-p this-command))
                                       (or (eq this-command
                                               (lookup-key map (this-single-command-keys)))
                                           (let ((cmd (key-binding
                                                       (this-single-command-keys) nil t)))
                                             (command-remapping cmd nil (list map)))))
                                  (ignore
                                   (easy-kill-destroy-candidate)
                                   (unless (or (easy-kill-get mark) (easy-kill-exit-p this-command))
                                     (easy-kill-save-candidate))))
                            (error (message "%s:%s" this-command (error-message-string err))
                                   nil)))
                        (lambda ()
                          (let ((dat (ring-ref avy-ring 0)))
                            (select-frame-set-input-focus
                             (window-frame (cdr dat)))
                            (select-window (cdr dat))
                            (goto-char (car dat)))))))))
          (easy-kill)))

      (defun avy-action-exchange (pt)
        "Exchange sexp at PT with the one at point."
        (set-mark pt)
        (transpose-sexps 0))

      (defun avy-action-helpful (pt)
        (save-excursion
          (goto-char pt)
          ;; (helpful-at-point)
          (my/describe-symbol-at-point)
          )
        (select-window
         (cdr (ring-ref avy-ring 0)))
        t)

      (defun avy-action-define (pt)
        (cl-letf (((symbol-function 'keyboard-quit)
                   #'abort-recursive-edit))
          (save-excursion
            (goto-char pt)
            (dictionary-search-dwim))
          (select-window
           (cdr (ring-ref avy-ring 0))))
        t)

      (defun avy-action-embark (pt)
        (unwind-protect
            (save-excursion
              (goto-char pt)
              (embark-act))
          (select-window
           (cdr (ring-ref avy-ring 0))))
        t)

      (defun avy-action-kill-line (pt)
        (save-excursion
          (goto-char pt)
          (kill-line))
        (select-window
         (cdr (ring-ref avy-ring 0)))
        t)


(defun my/flash-region (start end)
  "Temporarily highlight region from START to END."
  (let ((overlay (make-overlay start end)))
    (overlay-put overlay 'face 'secondary-selection)
    (overlay-put overlay 'priority 100)
    (run-with-timer 0.2 nil 'delete-overlay overlay)))

      (defun avy-action-copy-whole-line (pt)
        (save-excursion
          (goto-char pt)
          (cl-destructuring-bind (start . end)
              (bounds-of-thing-at-point 'line)
            (copy-region-as-kill start end)
            (my/flash-region start end)
            ))
        (select-window
         (cdr
          (ring-ref avy-ring 0)))
        t)

      (defun avy-action-kill-whole-line (pt)
        (save-excursion
          (goto-char pt)
          (kill-whole-line))
        (select-window
         (cdr
          (ring-ref avy-ring 0)))
        t)

      (defun avy-action-yank-whole-line (pt)
        (avy-action-copy-whole-line pt)
        (save-excursion (yank))
        t)

      (defun avy-action-teleport-whole-line (pt)
        (avy-action-kill-whole-line pt)
        (save-excursion (yank)) t)

      (defun avy-action-mark-to-char (pt)
        (activate-mark)
        (goto-char pt))

      (defun my-avy-action-copy (pt)
        (avy-action-copy pt)
        (if vterm-copy-mode
            (progn (vterm-copy-mode -1)
                   (let ((current-prefix-arg 4))
                     (vterm-yank))
                   )
          )
        )

      (defun my-avy-action-yank (pt)
        (if (eq major-mode 'vterm-mode)
            (progn
              (vterm-copy-mode +1)
              (avy-action-copy pt)
              (vterm-copy-mode -1)
              (let ((current-prefix-arg 4))
                (vterm-yank))
              )
          (avy-action-yank pt)
          )
        )
      :bind
      ("M-o" . avy-pop-mark)
      ("M-j" . avy-goto-word-2)
      ("C-j" . avy-goto-word-2)
      ("M-l" . avy-goto-line-smart)
      (:map isearch-mode-map ("M-j" . avy-isearch))
      :custom-face
      (avy-lead-face ((t (:foreground "white" :background "#e52b50"))))
      (avy-lead-face ((t (:foreground "white" :background "#e52b50"))))
      (avy-lead-face-0 ((t (:foreground "white" :background "#e52b50"))))
      (avy-background-face ((t (:foreground unspecified :background unspecified  :inherit default))))
      :commands (avy-goto-word-1 avy-goto-word-2 avy-goto-char-2 avy-goto-char-timer)
      )

ace-window

(use-package ace-window
  :after posframe
  :config
  (global-set-key [remap other-window] 'ace-window)
  (setq aw-background nil)
  (ace-window-posframe-mode)
  :custom
  (aw-scope 'frame)
  (aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
  :custom-face
  ;;(aw-leading-char-face ((t :inherit ace-jump-face-foreground :height 3.0)))
  (aw-leading-char-face ((t :foreground "#FFFFFF" :background nil :height 4.0)))
  )

browse-kill-ring

An alternative of counsel-yank-pop

(use-package browse-kill-ring
  :init
  (defface browse-kill-ring-separator-face
    '((t :foreground "#276E9E"
         :weight bold
         ))
    "Face for browse-kill-ring-separator."
    )
  :config
  (setq browse-kill-ring-highlight-current-entry t)
  (setq browse-kill-ring-separator "-------------------------------------------")
  (setq browse-kill-ring-separator-face 'my-browse-kill-ring-separator-face)
  :bind ("M-y" . browse-kill-ring))

isearch

Enable possibility to exit isearch with leaving cursor at the beginning of the word (C-Ret)

(use-package isearch
  :straight (:type built-in)
  :config
  (defun isearch-exit-other-end ()
    "Exit isearch, at the opposite end of the string."
    (interactive)
    (isearch-exit)
    (goto-char isearch-other-end))
  :bind
  (:map isearch-mode-map
        ("C-m" . #'isearch-exit-other-end)
        ("C-f" . isearch-yank-char)
        ("C-b" . isearch-del-char)
        ("C-z" . isearch-yank-until-char)
        )
  ;; (define-key isearch-mode-map (kbd "C-m")
  ;;             #'isearch-exit-other-end)
  )

Isearch other window

(defun isearch-forward-other-window (prefix)
  "Function to isearch-forward in other-window."
  (interactive "P")
  (unless (one-window-p)
    (save-excursion
      (let ((next (if prefix -1 1)))
        (other-window next)
        (isearch-forward)
        (other-window (- next))))))

(defun isearch-backward-other-window (prefix)
  "Function to isearch-backward in other-window."
  (interactive "P")
  (unless (one-window-p)
    (save-excursion
      (let ((next (if prefix 1 -1)))
        (other-window next)
        (isearch-backward)
        (other-window (- next))))))

(define-key global-map (kbd "C-M-s") 'isearch-forward-other-window)
(define-key global-map (kbd "C-M-r") 'isearch-backward-other-window)

ace-isearch

(use-package ace-isearch)

centaur-tabs

(use-package centaur-tabs
  :init
  (setq centaur-tabs-set-icons t
        centaur-tabs-set-close-button nil
        centaur-tabs-set-modified-marker t
        centaur-tabs-modified-marker "â—Ź"
        centaur-tabs-gray-out-icons 'buffer
        centaur-tabs-set-bar 'over
        centaur-tabs-style "alternate")
  :config
  (centaur-tabs-mode t)
  (centaur-tabs-change-fonts "DejaVu Sans" 100)
  :custom-face
  (tab-line ((t (:background "#2B2B2B"))))
  :bind
  ("C-<prior>" . centaur-tabs-backward)
  ("C-<next>" . centaur-tabs-forward))

rg

(use-package rg)

transpose-frame

(use-package transpose-frame)

beacon

(use-package beacon
  :config
  (setq beacon-color 0.5)
  (setq beacon-blink-duration 0.3)
  (setq beacon-blink-delay 0)
  (beacon-mode 0)
  :bind ("M-]" . beacon-blink)
  )

vertico

(use-package vertico
  :init (vertico-mode)
  :bind
  (:map vertico-map
        ("M-j" .  vertico-quick-exit)
        ("DEL" . vertico-directory-delete-char)
        ("M-DEL" . vertico-directory-delete-word)
        )
  :config
  (setq read-file-name-completion-ignore-case t
        read-buffer-completion-ignore-case t
        completion-ignore-case t)
  (auto-save-mode)
  (savehist-mode 1)
  (recentf-mode)
  ;;(vertico-multiform-mode)
  (setq vertico-multiform-commands
        '((consult-imenu indexed)
          (consult-outline buffer indexed)))
  (setq vertico-preselect 'directory)
  (setq vertico-resize nil) ;; consistent minibuffer size
  )

(use-package vertico-multiform
  :straight nil)

(use-package vertico-quick
  :custom
  (vertico-quick1 "asdfjkl;gh")
  :straight nil)

(use-package vertico-directory
  :straight nil)

(use-package vertico-posframe
  ;; :if android
  :after posframe
  :config
  (vertico-posframe-mode)
  (setq vertico-posframe-max-width 9999)
  (setq vertico-posframe-default-width 150)
  (defun vertico-posframe-cycle-width ()
    (interactive)
    (if (eq vertico-posframe-width vertico-posframe-max-width)
        (setq vertico-posframe-width vertico-posframe-default-width)
      (setq vertico-posframe-width vertico-posframe-max-width)
      )
    )
  :custom
  (vertico-posframe-height 11)
  (vertico-posframe-width 140)
  (vertico-posframe-parameters
       '(
         (internal-border-width . 10)
         (left-fringe . 5)
         (right-fringe . 5)
         )
       )
  (vertico-posframe-border-width 2)
  (vertico-posframe-show-minibuffer-rules '(".*"))
  :custom-face
  (vertico-posframe-border ((t (:inherit minibuffer-prompt :background "#F0DFAF"))))
  :bind
  (:map vertico-multiform-map
        ("C-'" . vertico-multiform-posframe)
        ("M-p" . nil))
  (:map vertico-map
        ("M-'" . vertico-posframe-cycle-width))
  )

marginalia

(use-package all-the-icons-completion)

(use-package marginalia
  :after vertico
  :init (marginalia-mode)
  :config
  (defun marginalia-annotate-buffer-simple (cand)
    "Annotate buffer CAND with modification status, file name and major mode."
    (when-let ((buffer (get-buffer cand)))
      (if (buffer-live-p buffer)
          (marginalia--fields
           ((marginalia--buffer-file buffer)
            :truncate -0.5 :face 'marginalia-file-name))
        (marginalia--fields ("(dead buffer)" :face 'error)))))

  (setq marginalia-align 'center)
  ;; (all-the-icons-completion-mode 1)
  (add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup)
  :custom-face
  (marginalia-documentation ((t :inherit font-lock-comment-face)))
  :bind (:map minibuffer-local-map
              ("M-A" . marginalia-cycle))
  )

orderless

(use-package orderless
  :custom
  (completion-styles '(orderless basic))
  (completion-category-overrides '((file (styles . (partial-completion))))))

consult

(use-package consult
  ;;:requires em-hist
  :custom
  (consult-find-args "find . -not ( -wholename */.* -prune )")
  :config
  (setq consult-preview-key "M-.")
  ;;(consult-customize consult-theme :preview-key '(:debounce 2 any))
  :bind
  ("M-i" . consult-imenu)
  ;; ("C-c k" . consult-kmacro)
  ;; C-x bindings in `ctl-x-map'
  ("C-x C-b" . consult-buffer)
  ("C-x b" . consult-buffer)
  ;; M-s bindings in `search-map'
  ("M-s f" . consult-fd)
  ("M-s l" . consult-line)
  ("M-s b" . consult-bookmark)
  ("M-s y" . consult-yasnippet)
  ("M-s e" . consult-isearch-history)
  ;; M-g bindings in `goto-map'
  ("M-g g" . consult-goto-line)
  ("M-g M-g" . consult-goto-line)
  ("M-g o" . consult-outline)
  ("M-g s" . consult-register-store)
  ("M-g l" . consult-register-load)
  ("M-g r" . consult-register)
  ("M-g m" . consult-mark)
  ("M-g M" . consult-global-mark)
  ("<f1>" .  consult-ripgrep)
  (:map minibuffer-local-map
        ("M-r" . consult-history))
  ;;(:map eshell-hist-mode-map
  ;;      ("M-r" . consult-history))
  )
(use-package consult-flycheck)

(use-package consult-dir
  :commands (consult-dir)
  :bind (("C-x C-d" . consult-dir)
         :map minibuffer-local-completion-map
         ("C-x C-d" . consult-dir)
         ("C-x C-j" . consult-dir-jump-file)))

(use-package consult-yasnippet)

(use-package consult-lsp
  :config
  (defun consult-lsp-file-symbols-with-prefix-arg ()
    (interactive)
    (setq current-prefix-arg '(4)) ; C-u
    (call-interactively 'consult-lsp-file-symbols))
  :bind
  (:map lsp-mode-map ("M-i" . consult-lsp-file-symbols-with-prefix-arg))
  (:map lsp-mode-map ("M-i" . consult-lsp-file-symbols-with-prefix-arg))
  :custom
  (consult-lsp-symbols-narrow
   '(
     ;; Lowercase classes
     (?C . "Class")
     (?F . "Field")
     (?e . "Enum")
     (?i . "Interface")
     (?M . "Module")
     (?n . "Namespace")
     (?p . "Package")
     (?s . "Struct")
     (?t . "Type Parameter")
     (?v . "Variable")
     ;; Uppercase classes
     (?A . "Array")
     (?B . "Boolean")
     (?c . "Constructor")
     (?E . "Enum Member")
     (?f . "Function")
     (?m . "Method")
     (?N . "Number")
     (?O . "Object")
     (?P . "Property")
     (?S . "String")
     (?o . "Operator")
     ;; Example types included in "Other" (i.e. the ignored)
     ;; (?n . "Null")
     ;; (?c . "Constant")
     ;; (?e . "Event")
     ;; (?k . "Key")
     ;; (?o . "Operator")
     ))
  )

embark

(use-package embark
  :bind
  ("M-." . embark-dwim)
  ("C-." . embark-act)
  ("C-h B" . embark-bindings)
  :init
  (setq prefix-help-command #'embark-prefix-help-command)
  (setq embark-indicators '(embark-mixed-indicator embark-highlight-indicator embark-isearch-highlight-indicator))
  (setq embark-mixed-indicator-delay 2)
  )
(use-package embark-consult
  :after (embark consult))

affe

(use-package affe
  :config
  ;; Manual preview key for `affe-grep'
  (consult-customize affe-grep :preview-key "M-."))

meow

(use-package meow
  :disabled t
  :init
  (defun meow-setup ()
    (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
    (meow-motion-overwrite-define-key
     '("j" . meow-next)
     '("k" . meow-prev)
     '("<escape>" . ignore))
    (meow-leader-define-key
     ;; SPC j/k will run the original command in MOTION state.
     '("j" . "H-j")
     '("k" . "H-k")
     ;; Use SPC (0-9) for digit arguments.
     '("1" . meow-digit-argument)
     '("2" . meow-digit-argument)
     '("3" . meow-digit-argument)
     '("4" . meow-digit-argument)
     '("5" . meow-digit-argument)
     '("6" . meow-digit-argument)
     '("7" . meow-digit-argument)
     '("8" . meow-digit-argument)
     '("9" . meow-digit-argument)
     '("0" . meow-digit-argument)
     '("/" . meow-keypad-describe-key)
     '("?" . meow-cheatsheet))
    (meow-normal-define-key
     '("0" . meow-expand-0)
     '("9" . meow-expand-9)
     '("8" . meow-expand-8)
     '("7" . meow-expand-7)
     '("6" . meow-expand-6)
     '("5" . meow-expand-5)
     '("4" . meow-expand-4)
     '("3" . meow-expand-3)
     '("2" . meow-expand-2)
     '("1" . meow-expand-1)
     '("-" . negative-argument)
     '(";" . meow-reverse)
     '("," . meow-inner-of-thing)
     '("." . meow-bounds-of-thing)
     '("[" . meow-beginning-of-thing)
     '("]" . meow-end-of-thing)
     '("a" . meow-append)
     '("A" . meow-open-below)
     '("b" . meow-back-word)
     '("B" . meow-back-symbol)
     '("c" . meow-change)
     '("d" . meow-delete)
     '("D" . meow-backward-delete)
     '("e" . meow-next-word)
     '("E" . meow-next-symbol)
     '("f" . meow-find)
     '("g" . meow-cancel-selection)
     '("G" . meow-grab)
     '("h" . meow-left)
     '("H" . meow-left-expand)
     '("i" . meow-insert)
     '("I" . meow-open-above)
     '("j" . meow-next)
     '("J" . meow-next-expand)
     '("k" . meow-prev)
     '("K" . meow-prev-expand)
     '("l" . meow-right)
     '("L" . meow-right-expand)
     '("m" . meow-join)
     '("n" . meow-search)
     '("o" . meow-block)
     '("O" . meow-to-block)
     '("p" . meow-yank)
     '("q" . meow-quit)
     '("Q" . meow-goto-line)
     '("r" . meow-replace)
     '("R" . meow-swap-grab)
     '("s" . meow-kill)
     '("t" . meow-till)
     '("u" . meow-undo)
     '("U" . meow-undo-in-selection)
     '("v" . meow-visit)
     '("w" . meow-mark-word)
     '("W" . meow-mark-symbol)
     '("x" . meow-line)
     '("X" . meow-goto-line)
     '("y" . meow-save)
     '("Y" . meow-sync-grab)
     '("z" . meow-pop-selection)
     '("'" . repeat)
     '("<escape>" . ignore)))
  :config
  (meow-setup)
  (meow-global-mode 1)
  )

god-mode

(use-package god-mode
  ;;:disabled t
  :init
  (defun my-god-mode-update-cursor-type ()
    (setq cursor-type (if (or god-local-mode buffer-read-only) 'box 'bar)))
  :requires god-mode-isearch
  :bind
  ("<escape>" . god-mode-all)
  ("C-z" . god-mode-all)
  ;; remap some keys to make them easier for god mode
  ("C-x C-b" . switch-to-buffer) ;; "C-x b" initially
  ("C-x C-o" . ace-window)       ;; "C-x o" initially
  ("C-x C-0" . delete-window)    ;; "C-x 0" initially
  ("C-x C-1" . delete-other-windows)
  ("C-x C-2" . split-window-below)
  ("C-x C-3" . split-windows-right)
  ("C-c C-g" . magit-status)     ;; "C-x g" initially
  ("C-x C-r" . revert-buffer)    ;; 'find-file-readonly' initially
  (:map god-local-mode-map
        ("z" . repeat)
        ("i" . god-local-mode)
        ("[" . backward-paragraph)
        ("]" . forward-paragraph)
        )
  (:map isearch-mode-map ("<escape>" . god-mode-isearch-activate))
  (:map god-mode-isearch-map
        ("<escape>" . god-mode-isearch-disable)
        ("m" . #'isearch-exit-other-end)
        ("f" . isearch-yank-char)
        ("z" . isearch-yank-until-char)
        )
  :config
  (dolist (exempt-modes '(vterm-mode magit-blame-mode magit-blame-read-only-mode))
    (add-to-list 'god-exempt-major-modes exempt-modes))
  (add-hook 'post-command-hook #'my-god-mode-update-cursor-type)
  ;; (defun my-god-mode-update-mode-line ()
  ;;   (cond
  ;;    (god-local-mode
  ;;     (set-face-attribute 'mode-line nil
  ;;                         :foreground "#8fb28f"
  ;;                         :background "#2b2b2b"
  ;;                         :strike-through nil)
  ;;     (set-face-attribute 'mode-line-inactive nil
  ;;                         :foreground "#5F7F5F"
  ;;                         :background "#383838"
  ;;                         :strike-through nil))

  ;;    (t
  ;;     (set-face-attribute 'mode-line nil
  ;;                         :foreground "#8fb28f"
  ;;                         :background "#2b2b2b"
  ;;                         :strike-through nil)
  ;;     (set-face-attribute 'mode-line-inactive nil
  ;;                         :foreground "#5F7F5F"
  ;;                         :background "#383838"
  ;;                         :strike-through nil)))
  ;;   )

  ;; (add-hook 'post-command-hook #'my-god-mode-update-mode-line)
  )

goto-last-change

(use-package goto-last-change
  :straight nil
  :ensure nil
  :load-path "extra/"
  :bind
  ("M-g c" . goto-last-change)
  )

centered-cursor-mode

Try out to be always centered

(use-package centered-cursor-mode
  :config
  ;; Optional, enables centered-cursor-mode in all buffers.
  (global-centered-cursor-mode)
  (dolist (mode '(vterm-mode-hook
                  eshell-mode-hook
                  chatgpt-shell-mode-hook
                  multiple-cursors-mode-hook
                  minibuffer-mode))
    (add-hook mode (lambda () (centered-cursor-mode 0))))
)

bicycle

(use-package bicycle
  :after outline
  :bind (:map outline-minor-mode-map
              ([C-tab] . bicycle-cycle)
              ([backtab] . bicycle-cycle-global)))

(use-package prog-mode
  :straight (:type built-in)
  :hook
  (prog-mode . hs-minor-mode)
  (prog-mode . outline-minor-mode)
  )

code navigation

lsp-mode

;; must be define before lsp mode for some reason
(use-package lsp-mode
  :after (which-key orderless)
  :commands (lsp lsp-deffered)
  :init
  (defun my/lsp-mode-setup-completion ()
    (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
          '(orderless))) ;; Configure flex
  (define-key lsp-mode-map (kbd "C-c l") lsp-command-map)
  (setq lsp-keymap-prefix "C-c l")
  (setq lsp-clients-clangd-executable "clangd-17")
  (setq lsp-clients-clangd-args '(
                                  "--clang-tidy"
                                  "--completion-style=detailed"
                                  "--background-index"
                                  "--enable-config"
                                  ))
  (setq clang-format-executable "clang-format-17")
  (setq lsp-auto-guess-root t)
  (setq lsp-signature-render-documentation t)
  (setq lsp-signature-auto-activate nil)
  (setq lsp-eldoc-enable-hover nil)
  (setq lsp-enable-on-type-formatting nil)
  (setq lsp-headerline-breadcrumb-segments '(symbols))
  (setq lsp-headerline-breadcrumb-icons-enable t)
  (setq lsp-headerline-breadcrumb-enable-diagnostics nil)
  (setq lsp-symbol-highlighting-skip-current t)
  (setq lsp-imenu-sort-methods '(position))
  (setq lsp-completion-provider :none)
  (setq lsp-idle-delay 0.01)
  :config
  (lsp-enable-which-key-integration t)
  (eldoc-mode nil)
  :hook
  ((c++-mode c-mode c++-ts-mode c-ts-mode bash-ts-mode python-ts-mode) . lsp)
  (lsp-completion-mode . my/lsp-mode-setup-completion)
  :bind
  (:map lsp-command-map ("r e" . lsp-iedit-highlights))
  (:map lsp-command-map ("e" . consult-lsp-diagnostics))
  (:map lsp-command-map ("f" . lsp-format-buffer))
  (:map lsp-command-map ("o" . lsp-clangd-find-other-file))
  ("M-." . xref-find-definitions)
  ("M-?" . xref-find-references)
  ("M-," . xref-pop-marker-stack)
  :custom-face
  (lsp-face-semhl-default-library ((t (:inherit unspecified ))))
  (lsp-face-semhl-interface ((t (:inherit unspecified ))))
  (lsp-face-semhl-keyword ((t (:weight normal ))))
  (lsp-face-semhl-static ((t (:weight normal ))))
  (lsp-face-semhl-namespace ((t (:weight normal ))))
  (lsp-face-semhl-variable ((t (:inherit unspecified ))))
  )
(use-package lsp-ui
  ;;:disabled t
  :hook (lsp-mode . lsp-ui-mode)
  :custom-face
  (lsp-ui-doc-background ((t (:background unspecified :inherit org-block))))
  (lsp-face-highlight-textual ((t :background "#7F9F7F" :foreground "#FFFFFD" :weight normal)))
  (lsp-face-highlight-read ((t :background "#7F9F7F" :foreground "#FFFFFD" :weight normal)))
  (lsp-ui-peek-peek ((t (:background unspecified :inherit org-block))))
  (lsp-ui-peek-list ((t (:background unspecified :inherit org-block))))
  (lsp-ui-peek-selection ((t (:inherit hl-line :background "#111111" :foreground unspecified))))
  (lsp-ui-peek-highlight ((t (:background unspecified :foreground unspecified :box unspecified :inherit xref-match))))
  (lsp-ui-peek-line-number ((t (:foreground unspecified :inherit xref-line-number))))
  (lsp-ui-peek-filename ((t (:foreground unspecified :inherit xref-file-header ))))
  (lsp-ui-peek-header ((t (:background "#2B2B2B" :foreground unspecified :inherit doom-modeline-buffer-file ))))
  (lsp-ui-peek-footer ((t (:background "#2B2B2B" ))))
  :config
  (setq lsp-ui-doc-enable nil)
  (setq lsp-ui-doc-header nil)
  (setq lsp-ui-doc-show-with-mouse nil)
  (setq lsp-ui-doc-show-with-cursor t)
  (setq lsp-ui-doc-position 'top)
  (setq lsp-ui-doc-position 'at-point)
  (setq lsp-ui-doc-use-childframe t)
  (setq lsp-ui-doc-use-webkit nil)
  (setq lsp-ui-imenu-auto-refresh nil)
  (setq lsp-ui-peek-list-width 80)
  (define-key lsp-mode-map [remap xref-find-apropos] #'consult-lsp-symbols)
  )
(use-package lsp-treemacs
  :disabled t
  :after lsp
  :commands (lsp-treemacs-errors-list lsp-treemacs-symbols)
  :after (treemacs)
  :config
  (setq lsp-treemacs-symbols-position-params '((side . left)
                                               (slot . 2)
                                               (window-width . 60)))
  (setq lsp-treemacs-theme "Default")
  (lsp-treemacs-sync-mode 1)
  )
(use-package dap-mode
  :config
  (require 'dap-lldb)
  (require 'dap-gdb-lldb)
  (require 'dap-cpptools)
  (setq dap-lldb-debug-program "/usr/bin/lldb-vscode")
  (setq dap-lldb-debugged-program-function (lambda () (read-file-name "Select file to debug.")))
  (defun my/debug ()
    (interactive)
    (dap-debug
       (list :type "lldb-vscode"
           :request "launch"
           :name "lldb-dap-generic"
           :program (read-file-name "Enter the binary to debug...")
           :cwd "${workspaceFolder}")))
  )

flycheck

(use-package flycheck
  :custom
  (flycheck-check-syntax-automatically '(save))  
  :init
  (add-hook 'after-init-hook #'global-flycheck-mode)
  :bind
  ("<f3>" . flycheck-next-error)
  ("<f2>" . flycheck-previous-error)
  ("M-g e" . flycheck-next-error)
  ("M-g E" . flycheck-first-error)
  )

flycheck-posframe

(use-package flycheck-pos-tip
  :after flycheck
  :hook (flycheck-mode . flycheck-pos-tip-mode)
  )

corfu

(use-package corfu
  :custom
  (corfu-cycle t)
  (corfu-auto t)
  (corfu-auto-delay 0.0)
  (corfu-auto-prefix 1)
  :init
  :custom-face
  (corfu-default ((t (:background "#4F4F4F" ;; :foreground
                                  ))))
  (completions-common-part ((t (:foreground "#93E0E3"))))
  (corfu-annotations ((t (:inherit font-lock-comment-face))))
  (corfu-current ((t (:background "#2B2B2B"))))
  :config
  (setq completion-ignore-case t)
  (dolist (mode '(chatgpt-shell-mode-hook
                  multiple-cursors-mode-hook
                  gud-mode-hook))
    (add-hook mode (lambda () (corfu-mode 0))))
  (global-corfu-mode)
  )
(use-package corfu-quick
  :after (corfu)
  :straight nil
  :bind (:map corfu-map
              ("M-j" . corfu-quick-complete)
              ("C-q" . corfu-quick-insert)))
(use-package corfu-popupinfo
  :after (corfu)
  :straight nil
  :config (setq corfu-popupinfo-delay '(1.0 . 0.2))
  )
(use-package kind-icon
  :after corfu
  :custom
  (kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly
  :config
  (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
(use-package corfu-terminal
  :after corfu
  :config
  (unless (display-graphic-p)
    (corfu-terminal-mode +1)))

yasnippet

(use-package yasnippet-snippets
  :requires yasnippet)
(use-package yasnippet
  :init
  (yas-global-mode 1)
  )

cpp-auto-include

(use-package cpp-auto-include)

hide-if-def

(add-hook 'c-mode-hook 'hide-ifdef-mode)

ts-fold

(use-package ts-fold
  :straight (ts-fold :type git :host github :repo "emacs-tree-sitter/ts-fold")
  :bind
  ("C-t" . ts-fold-toggle))

tabs and indentations

;;(customize-variable (quote tab-stop-list))
(setq c-default-style "bsd"
      c-basic-offset 4)
(custom-set-variables
 '(tab-stop-list (number-sequence 4 120 4)))
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(defvaralias 'c-basic-offset 'tab-width)
(defvaralias 'cperl-indent-level 'tab-width)
;; don't indent "case" branch in "switch" according to coding style
(add-hook 'c-mode-common-hook
          (lambda ()
            (c-set-offset 'case-label '0)))

diff-hl

(use-package diff-hl
  :config
  (global-diff-hl-mode 1))

quickrun

(use-package quickrun)

git-messenger

(use-package git-messenger
  :config
  (setq git-messenger:use-magit-popup t))

git-timemachine

(use-package git-timemachine)

clang-format

(use-package clang-format)

gdb

(setq gdb-show-changed-values t)
(setq gdb-restore-window-configuration-after-quit t)
(add-hook 'kill-buffer-hook 'comint-write-input-ring)

ws-butler

(use-package ws-butler
  :hook (prog-mode . ws-butler-mode))

c++-mode

Disable namespace indentation with TAB

(defun my-c-setup ()
  (c-set-offset 'innamespace [0]))
(add-hook 'c++-mode-hook 'my-c-setup)

project/git stuff

projectile

(use-package projectile
  :config
  (projectile-mode 1)
  (setq projectile-completion-system 'auto)
  (setq projectile-enable-caching t)
  (setq compilation-scroll-output t)
  :bind
  (:map projectile-mode-map
        ("C-c p" . projectile-command-map))
  (:map projectile-command-map
        ("s r" . consult-ripgrep))
  )

treemacs

(use-package treemacs
  :defer t
  :config
  (setq treemacs-follow-after-init          t
        treemacs-width                      60
        treemacs-indentation                2
        treemacs-git-integration            t
        treemacs-collapse-dirs              3
        treemacs-silent-refresh             nil
        treemacs-change-root-without-asking nil
        treemacs-sorting                    'alphabetic-desc
        treemacs-show-hidden-files          t
        treemacs-never-persist              nil
        treemacs-is-never-other-window      nil
        treemacs-goto-tag-strategy          'refetch-index
        treemacs-position                   'left)

  (treemacs-follow-mode t)
  (treemacs-filewatch-mode nil)
  (setq treemacs-no-png-images nil)
  :bind
  (:map global-map
        ([f8]         . treemacs)
        ("M-0"        . treemacs-select-window)
        ("C-c 1"      . treemacs-delete-other-windows)
        )
  :custom-face
  (treemacs-root-face ((t
                        :Weight 'bold
                        :height 1.4
                        )))
  )
(use-package treemacs-all-the-icons
  :config
  (treemacs-load-theme "all-the-icons")
  )

(use-package treemacs-magit
  :after magit)

(use-package treemacs-projectile
  :config
  (setq treemacs-header-function #'treemacs-projectile-create-header))

magit

(use-package sqlite3
  :if (not (eq system-type 'windows-nt)))
(use-package magit
  :bind
  (("C-x g" . magit-status)
   ("C-c g f" . magit-find-file)
   ("C-c g F" . magit-find-file-other-window)
   ("C-c g t" . git-timemachine)
   :map magit-file-section-map
   ("RET" . magit-diff-visit-file-other-window)
   :map magit-hunk-section-map
   ("RET" . magit-diff-visit-file-other-window))
  :custom-face
  ;; revert diff faces which was changed to more bright version
  (magit-diff-added ((t (:background "#2F4F2F"))))
  (magit-diff-added-highlight ((t (:background "#3F5F3F"))))
  (magit-diff-removed ((t (:backgorund "#6C3333"))))
  (magit-diff-removed-highlight ((t (:background "#7C4343"))))
  ;; use yellow for magit 'in progress' command at mode-line
  (magit-mode-line-process ((t :inherit 'mode-line-buffer-id )))

  :config
  (setq magit-diff-refine-hunk t)
  (setq transient-display-buffer-action '(display-buffer-below-selected))
  (setq magit-ediff-dwim-show-on-hunks t)
  (transient-define-suffix magit-submodule-update-all ()
    "Update all submodules"
    :description "Update All (git submodule update --init --recursive)"
    (interactive)
    (magit-with-toplevel
      (magit-run-git-async "submodule" "update" "--init" "--recursive")))

  (transient-append-suffix 'magit-submodule "u"
    '("U" magit-submodule-update-all))

  (setq ediff-make-buffers-readonly-at-startup t)
  (defun ediff-mode-face-config-hook ()
    (set-face-attribute 'ediff-even-diff-A nil :inherit 'magit-diff-removed)
    (set-face-attribute 'ediff-even-diff-B nil :inherit 'magit-diff-added)
    (set-face-attribute 'ediff-odd-diff-A nil :inherit 'magit-diff-removed)
    (set-face-attribute 'ediff-odd-diff-B nil :inherit 'magit-diff-added))
  (add-hook 'ediff-mode 'ediff-mode-face-config-hook)
  :hook
  (ediff-mode . ediff-mode-face-config-hook)
  )

(use-package with-editor)

(with-eval-after-load 'info
  (info-initialize)
  (add-to-list 'Info-directory-list
               "~/.emacs.d/plugins/magit/Documentation/"))

forge

(use-package forge
  :after (magit tree-sitter-langs)
  :config
  ;; forge-post-mode inherits from markdown mode
  (push '(forge-post-mode . markdown) tree-sitter-major-mode-language-alist)
  )

code-review

(use-package code-review
  :disabled t
  :after magit
  )

smerge

(use-package smerge-mode
  :bind (:map smerge-mode-map
              ("M-p" . smerge-prev)
              ("M-n" . smerge-next)))

git-modes

(use-package git-modes)

fasd

(use-package fasd
  :config
  (setenv "_FASD_DATA" (concat (getenv "HOME") "/.cache/fasd/.fasd"))
  (global-fasd-mode 1)
  (setq fasd-enable-initial-prompt nil)
  :bind ("M-z" . fasd-find-file)
  )

eshell

(use-package eshell-prompt-extras)
(use-package eshell
  :straight (:type built-in)
  ;; to use some magit faces
  :after magit
  :init
  (defun eshell-find-in-history (prefix &optional query)
    "Use fasd to open a file, or a directory with dired.
     If PREFIX is positive consider only directories.
     If PREFIX is -1 consider only files.
     If PREFIX is nil consider files and directories.
     QUERY can be passed optionally to avoid the prompt."
    (interactive "P")
    (unless query (setq query (if fasd-enable-initial-prompt
                                  (read-from-minibuffer "Fasd query: ")
                                "")))
    (let* ((prompt "Fasd query: ")
           (results
            (split-string
             ;;(insert-file-contents "/home/eduplens/.emacs.d/eshell/history" nil 0 500)
             (f-read-text "/home/eduplens/.emacs.d/eshell/history")
             "\n" t))
           (command (when results
                      ;; set `this-command' to `fasd-find-file' is required because
                      ;; `read-from-minibuffer' modifies its value, while `ivy-completing-read'
                      (completing-read prompt results nil t)))
           (insert command)
           )
      ))
  (defun corfu-send-shell (&rest _)
    "Send completion candidate when inside comint/eshell."
    (cond
     ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
      (eshell-send-input))
     ((and (derived-mode-p 'comint-mode)  (fboundp 'comint-send-input))
      (comint-send-input))))
  :config
  (advice-add #'corfu-insert :after #'corfu-send-shell)
  ;; disable corfu-auto for eshell
  (add-hook 'eshell-mode-hook
            (lambda ()
              (setq-local corfu-auto nil)
              (corfu-mode)))
  (with-eval-after-load "esh-opt"
    (require 'virtualenvwrapper)
    (venv-initialize-eshell)
    (autoload 'epe-theme-lambda "eshell-prompt-extras")
    (setq eshell-highlight-prompt nil
          eshell-prompt-function 'epe-theme-lambda))
  )
(use-package eshell-vterm
  :demand t
  :after eshell
  :config
  (eshell-vterm-mode))
(use-package capf-autosuggest
  :hook
  ((comint-mode eshell-mode) . capf-autosuggest-mode))
(use-package pcmpl-args)

virualenvwrapper

(use-package virtualenvwrapper
  :config
  (venv-initialize-eshell))

vterm

(use-package vterm
  :if (not (eq system-type 'windows-nt))
  :config
  (defun vterm-avy ()
    (interactive)
    (vterm-copy-mode +1)
    (call-interactively 'avy-goto-word-2)
    )
  (defun vterm-yank-current-command ()
    "Yank the current command from vterm to the kill ring."
    (interactive)
    (vterm-copy-mode 1)
    (let ((start (point)))
      (vterm-beginning-of-line)
      (when (eq (current-column) 0)
        (vterm-beginning-of-line))
      (let ((beg (point)))
        (vterm-end-of-line)
        (kill-ring-save beg (point))
        (goto-char start)
        (vterm-copy-mode -1))
      (message "Command yanked to kill ring!")))
  (add-hook 'vterm-mode-hook  'with-editor-export-editor)
  :bind
  (:map vterm-mode-map
        ;;("M-j" . vterm-avy)
        ("M-j" . avy-goto-word-2)
        ("C-q" . vterm-send-next-key)
        ("C-c w" . vterm-yank-current-command)
        ("<f5>" . previous-buffer)
        ("<f6>" . next-buffer)
        )
  :custom
  (vterm-buffer-name-string "vterm %s")
  (vterm-max-scrollback 50000)
  )

popper

(use-package popper
  :ensure t ; or :straight t
  :bind (("C-`"   . popper-toggle-latest)
         ("M-`"   . popper-cycle)
         ("C-M-`" . popper-toggle-type))
  :bind
  (:map prog-mode-map
        ("C-'" . popper-toggle-latest))
  (:map popper-mode-map
        ("C-'" . popper-toggle-latest))
  :custom
  (popper-group-function #'popper-group-by-directory)
  :init
  (setq popper-reference-buffers
        '("\\*Messages\\*"
          "Output\\*$"
          "\\*Async Shell Command\\*"
          help-mode
          compilation-mode))
  (popper-mode +1)
  (popper-echo-mode +1))

email

org-mode

org

(use-package org
  :straight (:type built-in)
  :init
  (add-hook 'org-mode-hook
            (lambda ()
              (define-key yas/keymap [tab] 'yas/next-field-or-maybe-expand)))
  :custom (org-ellipsis " â–Ľ")
  :config
  (setq org-confirm-babel-evaluate nil)
  (setq org-adapt-identation nil) ;; conflicts with org-modern
  (setq org-pretty-entities nil)
  (require 'org-tempo)
  (add-to-list 'org-structure-template-alist '("el". "src emacs-lisp"))
  :custom-face
  (org-table ((t :foreground "#FFFFFF" )))
  (org-ellipsis ((t :underline nil )))
  :bind
  (:map org-mode-map
        ("C-j" . nil) ;; using it for avy + god mode
        )
  )

org-ref

(use-package org-ref)

org-bullets

(use-package org-bullets
  :disabled t ;; org-modern
  :config
  (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))

org-gcal

(use-package org-gcal)

ox-reveal

org-re-reveal

(use-package org-re-reveal
  :config (setq org-re-reveal-root "file:///home/egor/git/org-reveal")
  )

org-present

(use-package org-present)

org-tree-slide

(use-package org-tree-slide)

ox-pandoc

(use-package ox-pandoc)

org-capture

org-capture-templates

(setq org-capture-templates
      '(
        ("i" "Ideas" entry (file+olp "~/org/notes.org" "Ideas")
         "* %?\nCreated on %U")
        ("n" "Information" entry (file+olp "~/org/notes.org" "Info")
         "* %?\nCreated on %U")
        ("j" "Journal" entry (file+olp+datetree "~/org/journal.org")
         "* %?\nEntered on %U\n  %i\n  %a")
        ("w" "Work to be done" entry (file+olp "~/org/work.org" "To be done")
         "* %?\nCreated on %U")
        )
      )

org-roam

(use-package org-roam
  :custom
  (org-roam-directory "~/org/roam-notes")
  :bind
  ("C-c n l" . org-roam-buffer-toggle)
  ("C-c n f" . org-roam-node-find)
  ("C-c n i" . org-roam-node-insert)
  :config
  (org-roam-db-autosync-mode)
  )

(use-package consult-org-roam
   :ensure t
   :after org-roam
   :init
   (require 'consult-org-roam)
   ;; Activate the minor mode
   (consult-org-roam-mode 1)
   :custom
   ;; Use `ripgrep' for searching with `consult-org-roam-search'
   (consult-org-roam-grep-func #'consult-ripgrep)
   ;; Configure a custom narrow key for `consult-buffer'
   (consult-org-roam-buffer-narrow-key ?r)
   ;; Display org-roam buffers right after non-org-roam buffers
   ;; in consult-buffer (and not down at the bottom)
   (consult-org-roam-buffer-after-buffers t)
   :config
   ;; Eventually suppress previewing for certain functions
   (consult-customize
    consult-org-roam-forward-links
    :preview-key "M-.")
   :bind
   ;; Define some convenient keybindings as an addition
   ("C-c n e" . consult-org-roam-file-find)
   ("C-c n b" . consult-org-roam-backlinks)
   ("C-c n B" . consult-org-roam-backlinks-recursive)
   ("C-c n l" . consult-org-roam-forward-links)
   ("C-c n r" . consult-org-roam-search)
   )

org-mime

(use-package org-mime)

org-modern

(use-package org-modern
  :config
  (setq org-modern-block-name t)
  :custom
  (org-modern-star 'replace)
  :hook
  (org-mode . org-modern-mode)
  :custom-face
  (org-modern-label ((t :height 1.0 :box (:line-width (1 . 1)) )))
  )

org-plantuml

(org-babel-do-load-languages
 'org-babel-load-languages
 '(;; other Babel languages
   (plantuml . t)
   (gnuplot . t)
   ))
(setq org-plantuml-jar-path
      (expand-file-name "/usr/share/plantuml/plantuml.jar"))

other minor stuff

gnuplot

(use-package gnuplot)

gnuplot-mode

(use-package gnuplot-mode)

wsd-mode

(use-package wsd-mode)

pandoc

(use-package pandoc-mode)

diminish

(use-package diminish)

dashboard

(use-package dashboard
  :config
  (use-package page-break-lines)
  (setq dashboard-items '((recents  . 5)
                          (bookmarks . 5)
                          (projects . 5)
                          (agenda . 5)
                          (registers . 5)))
  (dashboard-setup-startup-hook))

languages modes

python

(use-package jedi)
(use-package lsp-jedi
  :config
  (with-eval-after-load "lsp-mode"
    (setq lsp-disabled-clients '(jedi))
    (setq lsp-enabled-clients '(pylsp pyls jedi clangd))
    )
  (setq python-interpreter "python3")
  :hook
  (python-mode . lsp)
  )
(use-package cython-mode)

groovy

(use-package groovy-mode
  )

markdown

(use-package markdown-mode
  :commands (markdown-mode gfm-mode)
  :mode (("README\\.md\\'" . gfm-mode)
         ("\\.md\\'" . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown")
  :config
  (setq browse-url-browser-function 'browse-url-chrome)
  )

flymd

(use-package flymd)

yaml

(use-package yaml-mode)
(use-package yaml-imenu)

dockerfile

(use-package dockerfile-mode)

ansible

(use-package ansible)

asciidoc

(use-package adoc-mode)

go-mode

(use-package go-mode
  :mode "\\.tpl$"
  )

plantuml

(use-package plantuml-mode
  :config ;;(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode))
  (setq plantuml-jar-path (expand-file-name "/usr/share/plantuml/plantuml.jar")
        plantuml-default-exec-mode 'jar
        plantuml-exec-mode 'jar
        plantuml-server-url '"http://www.plantuml.com")
  )

modelines

doom-mode-line

(use-package all-the-icons
  :config
  ;; Make sure the icon fonts are good to go
  ;;(set-face-font t 'unicode (font-spec :family "all-the-icons") nil 'append)
  ;;(set-face-font t 'unicode (font-spec :family "file-icons") nil 'append)
  )
(use-package doom-modeline
  :config
  (doom-modeline-mode)
  (setq doom-modeline-icon t)
  (setq doom-modeline-height 35)
  (setq doom-modeline-major-mode-color-icon nil))

which-key

(use-package which-key
  :custom
  (which-key-idle-delay 2.0)
  :config
  (which-key-enable-god-mode-support 1)
  (which-key-mode 1)
  )

htmlize

(use-package htmlize)

disaster

(use-package disaster)

rmsbolt

(use-package rmsbolt
  :custom-face
  (rmsbolt-current-line-face ((t
                               :inherit hl-line
                               )))
  )

dired-rainbow

(use-package dired-rainbow
  :hook (help-mode . rainbow-mode))

rainbow-mode

(use-package rainbow-mode)

command-log-mode

(use-package command-log-mode
  :init
  (setq command-log-mode-auto-show t)
  ; command log mode binds to "C-c o" by default
  :config
  (unbind-key "C-c o")
  )

flyspell-correct

(use-package flyspell-correct
  :after flyspell)

google-translate

(use-package google-translate
  :config
  :custom
  (google-translate-default-target-language "ru")
  (google-translate-default-source-language "en")
  (google-translate-backend-method 'curl)
  :bind ("C-c t" . google-translate-at-point)
  )
(defun google-translate--search-tkk () "Search TKK." (list 430675 2721866130))

key-frequency

Shows frequency of emacs commands

(use-package keyfreq
  :disabled t
  :init
  (keyfreq-mode 1)
  (keyfreq-autosave-mode 1)
  )

dimmer

Dimming the face of non-active buffers

(use-package dimmer
  :disabled t
  :config
  (setq dimmer-exclusion-regexp "magit-popup-mode")
  )

docker

(use-package docker)

markdown-preview-mode

(use-package markdown-preview-mode)

restart-emacs

(use-package restart-emacs)

language-detection

(use-package language-detection)

restclient

(use-package restclient)

disable-mouse

(use-package disable-mouse
  :config (global-disable-mouse-mode)
  )

guru-mode

(use-package guru-mode
  )

cmake-mode

(use-package cmake-mode
  :if (not (eq system-type 'windows-nt))
  :config (setq cmake-tab-width 4)
  ;;:bind
  ;;(:map cmake-ts-mode-map
  ;;      ("TAB" . cmake-indent)
  ;;      )
  )

systemd

(use-package systemd)

sudo-edit

(use-package sudo-edit)

oauth2

(use-package oauth2)

csv

(use-package csv-mode
  :config
  (setq csv-separators '(";"))
  )

helpful

(use-package helpful
  :bind
  ([remap describe-function] . helpful-callable)
  ([remap describe-command] . helpful-command)
  ([remap descrive-variable] . helpful-variable)
  ([remap describe-key] . helpful-key)
  ("C-h F" . helpful-function)
  )

selectric-mode

(use-package selectric-mode)

visual-fill-column

(use-package visual-fill-column
  :custom
  (visual-fill-column-center-text t)
  (visual-fill-column-width 110)
  (setq visual-fill-column-fringes-outside-margins nil)
  :hook
  ((org-mode markdown-mode) . visual-fill-column-mode)
  ((org-mode markdown-mode) . visual-line-mode)
  )

stripe-buffer

(use-package stripe-buffer
  :custom-face
  (stripe-highlight ((t
                      :background "#333333"
                      )))
  )

bash-completion

(use-package bash-completion
  :config
  (bash-completion-setup)
  )

latex-preview-pane

(use-package latex-preview-pane)

pdf-tools

(use-package pdf-tools)

keykast

(use-package keycast
  :config
  (defun +toggle-keycast()
    (interactive)
    (if (member '("" keycast-mode-line " ") global-mode-string)
        (progn (setq global-mode-string (delete '("" keycast-mode-line " ") global-mode-string))
               (remove-hook 'pre-command-hook 'keycast--update)
               (message "Keycast OFF"))
      (add-to-list 'global-mode-string '("" keycast-mode-line " "))
      (add-hook 'pre-command-hook 'keycast--update t)
      (message "Keycast ON"))))

chatgpt-shell

(use-package chatgpt-shell
  :custom
  (chatgpt-shell-openai-key (auth-source-pick-first-password :host "api.openai.com"))
  :hook
  (chatgpt-shell-mode . flyspell-mode)
  )

non-elpa

evil

evil-mode

(use-package evil
  :custom
  (evil-undo-system 'undo-redo)
  :bind
  ("C-j" . avy-goto-word-2)
  ("C-k" . kill-line))

(use-package evil-collection
  :after evil
  :config
  (evil-collection-init))

(use-package evil-org
  :after org
  :hook (org-mode . (lambda () evil-org-mode))
  :config
  (require 'evil-org-agenda)
  (evil-org-agenda-set-keys))

(use-package evil-surround
  :config
  (global-evil-surround-mode 1))

(use-package evil-args
  :config
  (define-key evil-inner-text-objects-map "a" 'evil-inner-arg)
  (define-key evil-outer-text-objects-map "a" 'evil-outer-arg)
  )

tmp

(setenv "_FASD_DATA" (concat (getenv "HOME") "/.cache/fasd/.fasd"))

About

My emacs configuration in form of .org file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published