This is my customized emacs configurations. I love to upgrade my tools every year. This is the exact same configurations that I am using for my development. Feel free to use or reference. Cheers ! 🍺
(set-face-attribute 'default nil :height 130)
Installation of use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; dependencies page-break-links
(use-package page-break-lines
:defer t
:ensure t
:config
)
;; projectile (Optional)
(use-package projectile
:defer t
:ensure t
:config
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-global-mode)
;; (setq projectile-completion-system 'helm)
)
;; all-the-icons (Optional)
(use-package all-the-icons
:ensure t
:defer t
)
(use-package all-the-icons-dired
:ensure t
:defer t
:config
(add-hook 'dired-mode-hook 'all-the-icons-dired-mode)
)
(use-package emojify
:ensure t
:config
(global-emojify-mode)
)
;; Try is useful when i need to test many things
(use-package try
:defer t
:ensure t
)
(use-package centaur-tabs
:ensure t
:demand
:bind
("C-<prior>" . centaur-tabs-backward)
("C-<next>" . centaur-tabs-forward)
("C-c t s" . centaur-tabs-counsel-switch-group)
("C-c t p" . centaur-tabs-group-by-projectile-project)
:config
(setq centaur-tabs-set-icons t)
(centaur-tabs-mode t)
(setq centaur-tabs-set-bar 'under)
(setq centaur-tabs-style "bar")
)
(add-hook 'term-mode-hook 'centaur-tabs-local-mode)
(add-hook 'eshell-mode-hook 'centaur-tabs-local-mode)
Requirements sudo apt install elpa-ivy-hydra sudo apt install elpa-counsel Swiper must be installed from git master since the melpa package is broken in emacs 28
(use-package hydra
:defer t
:ensure t
)
(use-package ivy
:defer t
:ensure t
:config
(ivy-mode 1)
)
(use-package swiper
:defer t
:ensure t
:load-path "~/.emacs.d/vendor/swiper/"
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t))
(global-set-key "\C-s" 'swiper)
(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key (kbd "<f6>") 'ivy-resume)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "<f1> f") 'counsel-describe-function)
(global-set-key (kbd "<f1> v") 'counsel-describe-variable)
(global-set-key (kbd "<f1> l") 'counsel-find-library)
(global-set-key (kbd "<f2> i") 'counsel-info-lookup-symbol)
(global-set-key (kbd "<f2> u") 'counsel-unicode-char)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(global-set-key (kbd "C-x l") 'counsel-locate)
(global-set-key (kbd "C-S-o") 'counsel-rhythmbox)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
(use-package ag
:defer t
:ensure t
)
(use-package undo-tree
:defer t
:ensure t
:bind
("C-x u" . undo-tree-visualizer-diff)
:config
(global-undo-tree-mode)
)
(use-package which-key
:ensure t
:config
(which-key-mode)
)
(use-package focus
:defer t
:ensure t)
(use-package rg
:defer t
:ensure t)
(use-package ripgrep
:demand
:ensure t)
(use-package magit
:defer t
:ensure t
)
(use-package sublimity
:defer t
:ensure t
:config
(sublimity-mode 1)
)
(use-package switch-window
:defer t
:ensure t
:config
(global-set-key (kbd "C-x o") 'switch-window)
(global-set-key (kbd "C-x 1") 'switch-window-then-maximize)
(global-set-key (kbd "C-x 2") 'switch-window-then-split-below)
(global-set-key (kbd "C-x 3") 'switch-window-then-split-right)
(global-set-key (kbd "C-x 0") 'switch-window-then-delete)
(global-set-key (kbd "C-x 4 d") 'switch-window-then-dired)
(global-set-key (kbd "C-x 4 f") 'switch-window-then-find-file)
(global-set-key (kbd "C-x 4 m") 'switch-window-then-compose-mail)
(global-set-key (kbd "C-x 4 r") 'switch-window-then-find-file-read-only)
(global-set-key (kbd "C-x 4 C-f") 'switch-window-then-find-file)
(global-set-key (kbd "C-x 4 C-o") 'switch-window-then-display-buffer)
(global-set-key (kbd "C-x 4 0") 'switch-window-then-kill-buffer)
)
(use-package visual-regexp
:ensure t
:config
(define-key global-map (kbd "C-c i") 'vr/replace)
(define-key global-map (kbd "C-c q") 'vr/query-replace)
(define-key global-map (kbd "C-c m") 'vr/mc-mark)
)
(use-package goto-line-preview
:ensure t
:defer t
:config
)
(global-set-key (kbd "M-g M-g") 'goto-line-preview)
(use-package docker
:ensure t
:defer t
:bind ("C-c d" . docker))
(use-package highlight-indent-guides
:ensure t
:defer t
:init
(add-hook 'prog-mode-hook 'highlight-indent-guides-mode)
:config
(setq highlight-indent-guides-method 'character)
)
(use-package multi-term
:ensure t
:defer t
:config
(setq multi-term-program "/home/linuxbrew/.linuxbrew/bin/zsh")
:bind
("C-c u j" . multi-term-next)
("C-c u k" . multi-term-prev)
)
(defalias 'ff 'find-file)
(defalias 'ffo 'find-file-other-window)
;; New Eshell
(global-set-key (kbd "C-c u $")
(defun eshell-new()
"Open a new instance of eshell."
(interactive)
(eshell 'N))
)
(use-package ibuffer-vc
:defer t
:ensure t)
(use-package avy
:defer t
:ensure t
:config
(global-set-key (kbd "C-;") 'avy-goto-char))
(use-package elscreen
:ensure t
:defer t
:config
(elscreen-start)
(elscreen-toggle-display-tab)
)
(use-package lsp-mode
;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
:defer t
:init
(setq read-process-output-max (* 1024 1024)) ;; 1mb
(setq gc-cons-threshold 100000000)
(setq lsp-idle-delay 0.500)
(setq lsp-keymap-prefix "C-c l")
;; :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
;; (prog-mode . lsp)
;; if you want which-key integration
;; (lsp-mode . lsp-enable-which-key-integration))
:commands lsp)
;; optionally
(use-package lsp-ui
:defer t
:ensure t
:commands lsp-ui-mode)
(use-package company-lsp
:defer t
:ensure t
:commands company-lsp)
;; if you are ivy user
(use-package treemacs
:defer t
:ensure t)
(use-package lsp-ivy
:defer t
:ensure t
:commands lsp-ivy-workspace-symbol)
(use-package lsp-treemacs
:defer t
:ensure t
:commands lsp-treemacs-errors-list)
;; optionally if you want to use debugger
;;(use-package dap-mode)
;; (use-package dap-LANGUAGE) to load the dap adapter for your language
;; optional if you want which-key integration
(use-package eshell-up
:defer t
:ensure t
)
(defalias 'up 'eshell-up)
(defalias 'pk 'eshell-up-peek)
(require 'cl)
(use-package telephone-line
:ensure t
:config
(telephone-line-mode 1)
(setq telephone-line-primary-left-separator 'telephone-line-cubed-left
telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left
telephone-line-primary-right-separator 'telephone-line-cubed-right
telephone-line-secondary-right-separator 'telephone-line-cubed-hollow-right)
(setq telephone-line-height 12
telephone-line-evil-use-short-tag t)
)
(use-package perspective
:defer t
:ensure t
:config
(persp-mode)
)
(use-package counsel-projectile
:defer t
:ensure t
:config
(counsel-projectile-mode)
)
(use-package persp-projectile
:after (perspective)
:ensure t
:bind
)
(global-set-key (kbd "C-x b") 'persp-ivy-switch-buffer)
;;(use-package zoom
;;:ensure t
;;:config
;;(zoom-mode t)
;;(defun size-callback ()
;; (cond ((> (frame-pixel-width) 1280) '(0.8 . 0.75))
;; (t '(0.8 . 0.5))))
;;(custom-set-variables
;; '(zoom-size 'size-callback))
;;(global-set-key (kbd "C-x +") 'zoom)
;;)
(use-package multiple-cursors
:defer t
:ensure t
)
(global-set-key (kbd "C-c u m") 'mc/edit-lines)
(use-package hydra
:defer t
:ensure t
:config
;;(defhydra hydra-zoom (global-map "<f2>")
;; "zoom"
;; ("g" text-scale-increase "in")
;; ("l" text-scale-decrease "out"))
(defhydra hydra-flycheck (global-map "<f2>")
"flycheck"
("n" flycheck-next-error)
("p" flycheck-previous-error))
)
(use-package corral
:defer t
:ensure t
:config
(defhydra hydra-corral (:columns 4)
"Corral"
("(" corral-parentheses-backward "Back")
(")" corral-parentheses-forward "Forward")
("[" corral-brackets-backward "Back")
("]" corral-brackets-forward "Forward")
("{" corral-braces-backward "Back")
("}" corral-braces-forward "Forward")
("." hydra-repeat "Repeat"))
(global-set-key (kbd "C-c n") #'hydra-corral/body))
(use-package company-box
:defer t
:ensure t
:hook (company-mode . company-box-mode))
(use-package mini-frame
:defer t
:ensure t
:config (custom-set-variables
'(mini-frame-show-parameters
'((top . 130)
(width . 0.5)
(left . 0.5)))))
;;(mini-frame-mode)