Skip to content

Saul-BT/emacs-dots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Saul-bt’s Emacs

./img/screenshot.jpg

Variables

(defvar bg-darker-color "#25262B")
(defvar accent-color "#FF7CCD")

Keybindings and Functions

Buffers

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)

Windows

Resize windows

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

Follow windows when split

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

Move through the windows (windmove)

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

Org

Src editting

(setq org-src-window-setup 'current-window)

Agenda

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

Org editing

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

Config reload

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

Other

Terminal

Making bash as default shell for ansi-term

(defvar term-shell "/bin/bash") 
(defadvice ansi-term (before force-bash)
   (interactive (list term-shell)))
(ad-activate 'ansi-term)

Packages

Didactic

which-key

For friendly suggestions in the mini-buffer

(use-package which-key
  :ensure t
  :init (which-key-mode))

Styling

dimmer

Highlights the current buffer

(use-package dimmer
  :ensure t
  :config
  (setq dimmer-fraction -0.1)
  (setq dimmer-adjustment-mode :both)
  :init (dimmer-mode t))

Icons

(use-package all-the-icons
  :ensure t
  :config
  (when (not (member "all-the-icons" (font-family-list)))
    (all-the-icons-install-fonts t)))

dashboard

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)

org-superstar-mode

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 '("" "" "")))

awesome-tray

(use-package awesome-tray
  :quelpa (awesome-tray :fetcher github :repo "manateelazycat/awesome-tray"))

Useful

avy

(use-package avy
  :ensure t
  :bind ("M-s" . avy-goto-char))

swiper

ISearch with super powers

(use-package swiper
  :ensure t
  :config (global-set-key "\C-s" 'swiper))

mark-multiple

Mark next same words, and can use multicursor :D

(use-package mark-multiple
  :ensure t
  :bind ("C-c m" . 'mark-next-like-this))

counsel

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

treemacs

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

Org-mode

Reveal.js

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

Writeroom

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

Programming

rainbow-delimiters

Paints delimiters by nest level

(use-package rainbow-delimiters
  :ensure t
  :init (add-hook 'prog-mode-hook 'rainbow-delimiters-mode))

company auto-completion

(use-package company
  :ensure t
  :init (add-hook 'after-init-hook 'global-company-mode))

flycheck on the fly syntax checking

(use-package flycheck
  :ensure t)

web-mode with some tweaks

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

tide for (type|java)script development

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

rustic for rust development

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

LSP

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

LSP UI

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

Theme

dracula-theme

(use-package dracula-theme
  :ensure t
  :init (load-theme 'dracula t))

Misc

GUI sucks

(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)

Line numbers

;;  (setq display-line-numbers-type 'relative)
  (add-hook 'prog-mode-hook 'display-line-numbers-mode)
  (add-hook 'org-mode-hook 'display-line-numbers-mode)

Highlight current line

(global-hl-line-mode t)
(set-face-background 'hl-line bg-darker-color)

Aliases

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

IDO

Friendly suggestions for do things

(setq ido-enable-flex-matching nil)
(setq ido-create-new-buffer 'always)
(setq ido-everywhere t)
(ido-mode 1)

Prevent file backups

(setq make-backup-file nil)
(setq auto-save-default nil)

Normal scroll behavior

(setq scroll-conservatively 100)

Bigger line spacing

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

Subwords

This mode lets you to cycle through sub-words

(global-subword-mode 1)

Auto-closing

(electric-pair-mode t)

Show Line and Column number on the modeline

(line-number-mode 1)
(column-number-mode 1)

About

My Emacs configuration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published