(defvar bg-darker-color "#25262B")
(defvar accent-color "#FF7CCD")
Kill current buffer by overriding “C-x k” keybinding
(defun my/kill-curr-buffer ()
(interactive)
(kill-buffer (current-buffer)))
(global-set-key (kbd "C-x k") 'my/kill-curr-buffer)
(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)
(defun my/split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 2") 'my/split-and-follow-horizontally)
(defun my/split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1))
(global-set-key (kbd "C-x 3") 'my/split-and-follow-vertically)
(when (fboundp 'windmove-default-keybindings)
(global-set-key (kbd "S-<left>") 'windmove-left)
(global-set-key (kbd "S-<right>") 'windmove-right)
(global-set-key (kbd "S-<up>") 'windmove-up)
(global-set-key (kbd "S-<down>") 'windmove-down))
(setq org-src-window-setup 'current-window)
;; (setq show-week-agenda-p t)
(global-set-key (kbd "C-c l") 'org-store-link)
(global-set-key (kbd "C-c a") 'org-agenda)
(global-set-key (kbd "C-c c") 'org-capture)
(defun my/split-and-follow-org-details ()
(interactive)
(org-tree-to-indirect-buffer)
(other-window 1))
(global-set-key (kbd "C-t") 'my/split-and-follow-org-details)
(defun my/config-reload ()
(interactive)
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org")))
(global-set-key (kbd "C-c r") 'my/config-reload)
(defvar term-shell "/bin/bash")
(defadvice ansi-term (before force-bash)
(interactive (list term-shell)))
(ad-activate 'ansi-term)
For friendly suggestions in the mini-buffer
(use-package which-key
:ensure t
:init (which-key-mode))
Highlights the current buffer
(use-package dimmer
:ensure t
:config
(setq dimmer-fraction -0.1)
(setq dimmer-adjustment-mode :both)
:init (dimmer-mode t))
(use-package all-the-icons
:ensure t
:config
(when (not (member "all-the-icons" (font-family-list)))
(all-the-icons-install-fonts t)))
Beautiful startup buffer
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook)
(setq dashboard-banner-logo-title "Welcome master :D")
(setq dashboard-startup-banner "~/.emacs.d/img/logo.png")
(setq dashboard-set-file-icons t)
(setq dashboard-navigator-buttons
`(;; line1
((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
"GitHub" "Go to GitHub"
(lambda (&rest _) (browse-url "https://github.com")))
(,(all-the-icons-octicon "tools" :height 1.1 :v-adjust 0.0)
"Config" "Open Configuration"
(lambda (&rest _) (find-file "~/.emacs.d/config.org")))))))
(setq dashboard-set-navigator t)
Beautify org-mode with bullets
(use-package org-superstar
:ensure t
:init (add-hook 'org-mode-hook 'org-superstar-mode)
:config
(setq org-superstar-leading-bullet ?\s)
(setq org-superstar-headline-bullets-list '("✸" "○" "▷")))
(use-package awesome-tray
:quelpa (awesome-tray :fetcher github :repo "manateelazycat/awesome-tray"))
(use-package avy
:ensure t
:bind ("M-s" . avy-goto-char))
ISearch
with super powers
(use-package swiper
:ensure t
:config (global-set-key "\C-s" 'swiper))
Mark next same words, and can use multicursor :D
(use-package mark-multiple
:ensure t
:bind ("C-c m" . 'mark-next-like-this))
Set of useful counsel
replacements for some Emacs commands
(use-package counsel
:ensure t
:bind
("M-y" . counsel-yank-pop) ;; kill-ring
("M-x" . counsel-M-x) ;; cooler M-x
("C-x C-f" . counsel-find-file)) ;; find-file
(use-package treemacs
:ensure t
:bind ("C-x t" . 'treemacs)
:config
(when (file-readable-p "~/.emacs.d/custom/treemacs-theme.el")
(load-file (expand-file-name "~/.emacs.d/custom/treemacs-theme.el"))))
Make awesome html presentations!
(use-package ox-reveal
:ensure t
:config
(setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js@3.9.2/")
(setq org-reveal-mathjax t))
(use-package writeroom-mode
:ensure t
:init
(add-hook 'org-mode-hook
(lambda ()
(writeroom-mode)
(setq header-line-format "")))
:config
(setq writeroom-width 0.75))
Paints delimiters by nest level
(use-package rainbow-delimiters
:ensure t
:init (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))
(use-package company
:ensure t
:init (add-hook 'after-init-hook 'global-company-mode))
(use-package flycheck
:ensure t)
(use-package web-mode
:ensure t
:mode
("\\.ejs\\'" "\\.hbs\\'" "\\.html\\'" "\\.php\\'" "\\.[jt]sx?\\'")
:config
(setq web-mode-content-types-alist '(("jsx" . "\\.[jt]sx?\\'")))
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2)
(setq web-mode-script-padding 2)
(setq web-mode-block-padding 2)
(setq web-mode-style-padding 2))
(setq web-mode-enable-auto-pairing t)
(setq web-mode-enable-auto-closing t)
(setq web-mode-enable-current-element-highlight t)
(defun my/activate-tide-mode ()
"Use hl-identifier-mode only on js or ts buffers."
(when (and (stringp buffer-file-name)
(string-match "\\.[tj]sx?\\'" buffer-file-name))
(tide-setup)
(tide-hl-identifier-mode)))
(use-package tide
:ensure t
:hook (web-mode . my/activate-tide-mode))
(use-package rustic
:ensure t
:config
(setq rustic-lsp-server 'rls)
(setq rustic-format-on-save t)
(setq lsp-rust-analyzer-server-command '("~/.cargo/bin/rust-analyzer")))
(use-package lsp-mode
:defer t
:hook ((prog-mode . lsp)
(lsp-mode . lsp-enable-which-key-integration))
;; Remove the :config section if you don't love Rust
:config
(setq lsp-rust-server 'rust-analyzer)
:commands lsp)
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode
:config
(setq ;; lsp-ui-doc-position
lsp-ui-doc-position 'top
;; lsp-ui-sideline
lsp-ui-sideline-enable t
lsp-ui-sideline-ignore-duplicate t
lsp-ui-sideline-show-symbol t
lsp-ui-sideline-show-hover t
lsp-ui-sideline-show-diagnostics t
lsp-ui-sideline-show-code-actions t
lsp-ui-sideline-code-actions-prefix ""
lsp-ui-sideline-update-mode 'line
;; misc
lsp-ui-doc-border accent-color
lsp-ui-doc-max-height 15)
:bind
("C-c C-v s" . lsp-ui-sideline-toggle-symbols-info))
(use-package dracula-theme
:ensure t
:init (load-theme 'dracula t))
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
;; (setq display-line-numbers-type 'relative)
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
(add-hook 'org-mode-hook 'display-line-numbers-mode)
(global-hl-line-mode t)
(set-face-background 'hl-line bg-darker-color)
(defalias 'yes-or-no-p 'y-or-n-p)
Friendly suggestions for do things
(setq ido-enable-flex-matching nil)
(setq ido-create-new-buffer 'always)
(setq ido-everywhere t)
(ido-mode 1)
(setq make-backup-file nil)
(setq auto-save-default nil)
(setq scroll-conservatively 100)
(defun set-bigger-spacing ()
(setq-local default-text-properties '(line-spacing 0.16 line-height 1.16)))
(add-hook 'text-mode-hook 'set-bigger-spacing)
(add-hook 'prog-mode-hook 'set-bigger-spacing)
This mode lets you to cycle through sub-words
(global-subword-mode 1)
(electric-pair-mode t)
(line-number-mode 1)
(column-number-mode 1)