Massive emacs refactor

Emacs theme now based on nano emacs

Completely refactored visual implementation
Joe Bellus 10 months ago
parent 0125b15aaf
commit b23b9ed183

@ -1,7 +1,9 @@
#TITLE: Emacs Configuration
#+PROPERTY: header-args+ :tangle ~/.emacs.d/init.el :mkdirp yes
#TITLE: /macs Configuration
#+PROPERTY: header-args+ :tangle ~/.emacs.d/init.el :mkdirp yes :comments org
* Dependencies
* Personal Info & Variables
To customize the configuration a config.el file is expected to exist which can override certain variables such as org file locations.
#+begin_src emacs-lisp
(load-file ".emacs.d/config.el")
#+end_src
@ -18,12 +20,11 @@ Startup the emacs server and convert this session to emacsclient
;; (server-start)
#+end_src
*** Backups path
Change the backups bath in order to keep folders clean
Change the backups bath in order to keep folders clean. Also, disable all the random littering emacs does with its backup files and lockfiles.
#+begin_src emacs-lisp
(setq backup-directory-alist `(("." . "~/.saves")))
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq auto-save-file-name-transforms `((".", "~/.saves" t)))
(setq create-lockfiles nil)
(setq backup-by-copying t)
#+end_src
@ -55,6 +56,10 @@ Force splits to happen vertically
(setq dired-listing-switches "-alh")
#+end_src
*** No littering
#+begin_src emacs-lisp
(use-package no-littering)
#+end_src
** Package Setup
Setup environment for packages
#+begin_src emacs-lisp
@ -126,7 +131,7 @@ Tune GC to happen more frequently (and faster).
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
#+end_src
* Apperance
* Appearance
** Fonts
#+begin_src emacs-lisp
(set-face-attribute 'default nil
@ -147,32 +152,47 @@ Tune GC to happen more frequently (and faster).
#+end_src
** Theme
*** All The Icons
#+begin_src emacs-lisp
(use-package all-the-icons)
(use-package doom-themes
:ensure t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-one t)
;; Enable flashing mode-line on errors
;;(doom-themes-visual-bell-config)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
#+end_src
*** Nano
#+begin_src emacs-lisp
(straight-use-package
'(nano-emacs :type git :host github :repo "rougier/nano-emacs"))
(setq nano-font-family-monospaced "PragmataPro Mono Liga")
(setq nano-font-size 12)
;; (require 'nano-layout)
(require 'nano-faces)
(nano-faces)
(require 'nano-theme)
(require 'nano-theme-dark)
(require 'nano-theme-light)
(nano-theme-set-dark)
(nano-refresh-theme)
(require 'nano-modeline)
(require 'nano-counsel)
(require 'nano-colors)
(require 'nano-minibuffer)
(use-package smex)
(use-package mini-frame)
(let ((inhibit-message t))
(message "5Sigma Emacs Configuration")
(message (format "Initialization time: %s" (emacs-init-time))))
(require 'nano-splash)
#+end_src
** Line numbering
Set line numbering for programming modes
#+begin_src emacs-lisp
(column-number-mode)
(setq global-display-line-numbers-mode nil)
(add-hook 'prog-mode-hook 'linum-mode)
;; (column-number-mode)
;; (setq global-display-line-numbers-mode nil)
;; (add-hook 'prog-mode-hook 'linum-mode)
#+end_src
** Translucency
@ -207,6 +227,33 @@ Set line numbering for programming modes
;; Enables ligature checks globally in all buffers. You can also do it
;; per mode with `ligature-mode'.
(global-ligature-mode t))
#+end_src
Spelling
Turn on spell checking with hunspell and enable it for specific modes
#+begin_src emacs-lisp
(setq-default ispell-program-name "hunspell"
ispell-really-hunspell t
ispell-check-comments t
ispell-extra-args '("-i" "utf-8") ;; produce a lot of noise, disable?
ispell-dictionary "en_US")
(defun fs-turn-on-spell-check ()
(flyspell-mode 1))
(add-hook 'markdown-mode-hook 'fs-turn-on-spell-check)
(add-hook 'text-mode-hook 'fs-turn-on-spell-check)
(add-hook 'org-mode-hook 'fs-turn-on-spell-check)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
(setq ispell-choices-win-default-height 4)
(use-package flyspell-correct
:after flyspell)
(use-package flyspell-correct-ivy
:after flyspell-correct)
#+end_src
* Packages
@ -218,7 +265,6 @@ Set line numbering for programming modes
#+end_src
** Counsel
#+begin_src emacs-lisp
(use-package counsel
:init
:bind (("M-x" . counsel-M-x)
@ -251,6 +297,10 @@ Set line numbering for programming modes
:map ivy-reverse-i-search-map
("C-k" . ivy-previous-line)
("C-d" . ivy-reverse-i-search-kill))
:init
(setq enable-recursive-minibuffers t)
:custom
(ivy-height 4)
:config
(ivy-mode 1))
@ -259,23 +309,15 @@ Set line numbering for programming modes
;;(setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)
(ivy-rich-mode 1))
(use-package ivy-posframe
:config
(setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
(setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-center)))
(setq ivy-posframe-width 150)
(ivy-posframe-mode 1))
;; (use-package ivy-posframe
;; :config
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
;; (setq ivy-posframe-display-functions-alist '((t . ivy-posframe-display-at-frame-center)))
;; (setq ivy-posframe-width 150)
;; (ivy-posframe-mode 1))
#+end_src
** Doom Mode Line
#+begin_src emacs-lisp
(use-package doom-modeline
:ensure t
:init (doom-modeline-mode 1)
:custom ((doom-modeline-height 15)))
#+end_src
** Rainbow Delimiters
#+begin_src emacs-lisp
(use-package rainbow-delimiters
@ -382,7 +424,20 @@ Set line numbering for programming modes
(defun fs/org-mode-setup ()
(org-indent-mode)
(variable-pitch-mode 1)
(visual-line-mode 1))
(visual-line-mode 1)
(fs/leader
:keymaps 'org-mode-map
:states 'normal
"m" '(:ignore t :which-key "org")
"mi" '(:ignore t :which-key "insert")
"mil" '(org-insert-link :which-key "insert link")
"mt" '(org-babel-tangle :which-key "tangle")
"mn" '(org-toggle-narrow-to-subtree :which-key "toggle narrow")
"md" '(org-deadline :which-key "todo deadline")
"ms" '(flyspell-correct-wrapper :which-key "Spell check")
"mf" '(counsel-org-goto :which-key "Find Section")
"me" '(org-export-dispatch t :which-key "export"))
)
(setq org-directory 5s-org-dir)
(setq org-journal-dir 5s-org-journal)
(with-eval-after-load 'evil-maps
@ -392,6 +447,13 @@ Set line numbering for programming modes
(setq org-return-follows-link t)
(setq org-tags-column 0)
#+end_src
*** Images
Show images on startup and limit width to 800 pixels
#+begin_src emacs-lisp
(setq org-startup-with-inline-images t)
(setq org-image-actual-width '(800))
(add-hook 'org-babel-after-execute-hook 'org-redisplay-inline-images)
#+end_src
*** Font Setup
#+begin_src emacs-lisp
@ -439,16 +501,6 @@ Set line numbering for programming modes
(use-package org
:hook (org-mode . fs/org-mode-setup)
:config
(fs/leader
:keymaps 'org-mode-map
:states 'normal
"m" '(:ignore t :which-key "org")
"mi" '(:ignore t :which-key "insert")
"mil" '(org-insert-link :which-key "insert link")
"mt" '(org-babel-tangle :which-key "tangle")
"mn" '(org-toggle-narrow-to-subtree :which-key "toggle narrow")
"md" '(org-deadline :which-key "todo deadline")
"me" '(org-export-dispatch t :which-key "export"))
(setq org-hide-emphasis-markers t)
(setq org-src-preserve-indentation t)
(fs/org-font-setup))
@ -464,36 +516,57 @@ Set line numbering for programming modes
(use-package visual-fill-column :hook
(org-mode . fs/org-mode-visual-fill))
#+end_src
*** Code Blocks & Babel
**** Setup shortcuts for code blocks
#+begin_src emacs-lisp
(require 'org-tempo)
(add-to-list 'org-structure-template-alist '("s" . "src"))
(add-to-list 'org-structure-template-alist '("rust" . "src rust"))
(add-to-list 'org-structure-template-alist '("sh" . "src sh"))
(add-to-list 'org-structure-template-alist '("rest" . "src restclient"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(add-to-list 'org-structure-template-alist '("py" . "src python"))
;; (setq-default prettify-symbols-alist '(("#+BEGIN_SRC" . "†")
;; ("#+END_SRC" . "†")
;; ("#+begin_src" . "†")
;; ("#+end_src" . "†")
;; (">=" . "≥")
;; ("=>" . "⇨")))
;; (setq prettify-symbols-unprettify-at-point 'right-edge)
;; (add-hook 'org-mode-hook 'prettify-symbols-mode)
#+end_src
**** Repalce begin and end source strings with nice symbols
#+begin_src emacs-lisp
(setq-default prettify-symbols-alist '(("#+BEGIN_SRC" . "†")
("#+END_SRC" . "†")
("#+begin_src" . "⇨")
("#+end_src" . "†")
(">=" . "≥")
("=>" . "⇨")))
(setq prettify-symbols-unprettify-at-point 'right-edge)
(add-hook 'org-mode-hook 'prettify-symbols-mode)
#+end_src
**** Setup babel languages for evaluating source blocks
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t) ;; Other languages
(shell . t)
(plantuml . t)
(haskell . t)
(restclient . t)
(python . t)))
#+end_src
**** Setup Org plantuml
#+begin_src emacs-lisp
(setq org-plantuml-jar-path
(expand-file-name "/opt/plantuml/plantuml.jar"))
#+end_src
**** Darken the background color of source blocks
#+begin_src emacs-lisp
(require 'color)
(set-face-attribute 'org-block nil :background
(color-darken-name
(face-attribute 'default :background) 3))
#+end_src
*** Org Download
Allows dragging and dropping files into emacs
#+begin_src emacs-lisp
(use-package org-download
:hook (dired-mode . org-download-enable))
#+end_src
*** Latex & Exporting
#+begin_src emacs-lisp
(setq org-export-with-author t)
@ -613,24 +686,6 @@ Set line numbering for programming modes
(org-present-read-write))))
#+end_src
** Company Mode
#+begin_src emacs-lisp
;; (use-package company
;; :after lsp-mode
;; :hook (lsp-mode . company-mode)
;; :bind
;; (:map company-active-map ("<tab>" . company-complete-selection))
;; (:map lsp-mode-map ("<tab>" . company-indent-or-complete-common))
;; :custom
;; (company-minimum-prefix-length 0)
;; (company-idle-delay 0.5))
;; ;; (setq company-backends '((company-capf company-yasnippet)))
;; (setq company-backends '((company-capf)))
;; (use-package company-box :hook (company-mode . company-box-mode))
#+end_src
** CorFu
#+begin_src emacs-lisp
(use-package corfu
@ -738,23 +793,15 @@ I
(lsp-treemacs-sync-mode 1)
#+end_src
** Dashboard
#+begin_src emacs-lisp
;; (use-package dashboard
;; :ensure t
;; :config
;; (setq dashboard-center-content t)
;; (setq dashboard-items '((recents . 5)
;; (bookmarks . 5)
;; (projects . 5)
;; (agenda . 5)
;; (registers . 5)))
;; (dashboard-setup-startup-hook))
#+end_src
** DIRED
#+begin_src emacs-lisp
(setq dired-kill-when-opening-new-dired-buffer t)
(use-package dired-subtree
:bind (:package dired
:map dired-mode-map
("<tab>" . dired-subtree-toggle)
("TAB" . dired-subtree-toggle)
("<backtab>" . dired-subtree-cycle)))
#+end_src
* Functions
@ -838,7 +885,7 @@ Insert a UUID via uuidgen at the cursor
#+begin_src emacs-lisp
(fs/leader
"o" '(:ignore t :which-key "ORG")
"oo" '(lambda () (interactive) (counsel-find-file "/mnt/data-drive/NextCloud/Life") :which-key "ORG")
"oo" '((lambda () (interactive) (counsel-find-file 5s-org-dir)) :which-key "ORG")
"oa" '(org-agenda :which-key "agenda")
"oc" '(org-capture t :which-key "capture"))
#+end_src
@ -873,7 +920,7 @@ Insert a UUID via uuidgen at the cursor
(fs/leader
"n" '(:ignore t :which-key "notes")
"nn" '(org-roam-node-find :which-key "Find note")
"nr" '((lambda () (interactive) (find-file "~/NextCloud/Life/compendium/index.org"))
"nr" '((lambda () (interactive) (find-file 5s-org-index))
:which-key "Note Index")
"ni" '(org-roam-node-insert :which-key "Insert note")
"nj" '(:ignore t :which-key "journal")
@ -947,6 +994,7 @@ Insert a UUID via uuidgen at the cursor
(lsp-rust-analyzer-display-parameter-hints nil)
(lsp-rust-analyzer-display-reborrow-hints nil)
(lsp-keep-workspace-alive nil)
(lsp-headerline-breadcrumb-enable nil)
:config
(lsp-enable-which-key-integration t)
(add-hook 'lsp-mode-hook 'lsp-ui-mode)
@ -955,10 +1003,11 @@ Insert a UUID via uuidgen at the cursor
:keymaps 'lsp-mode-map
"c" '(:ignore t :which-key "code")
"cl" '(:ignore t :which-key "LSP")
"cr" '(lsp-ui-peek-find-references :which-key "lookup reference")
"cd" '(lsp-find-definition :which-key "lookup definition")
"cs" '(lsp-ivy-workspace-symbol :which-key "find symbol")
"clx" '(lsp-workspace-restart :which-key "restart")
"cr" '(lsp-ui-peek-find-references :which-key "lookup reference")
"cd" '(lsp-find-definition :which-key "lookup definition")
"cs" '(lsp-ivy-workspace-symbol :which-key "find symbol")
"clx" '(lsp-workspace-restart :which-key "restart")
"cld" '(lsp-ui-doc-show :which-key "show docs")
"ca" '(lsp-execute-code-action :which-key "code actions"))
)
@ -973,11 +1022,11 @@ Insert a UUID via uuidgen at the cursor
(lsp-ui-sideline-enabled nil)
(lsp-ui-peek-always-show t)
(lsp-ui-sideline-show-hover t)
(lsp-ui-doc-use-webkit t)
(lsp-ui-sideline-enable nil)
(lsp-ui-doc-use-webkit nil)
(lsp-ui-sideline-enable nil)
(lsp-ui-doc-enable t))
(use-package lsp-ivy)
(use-package lsp-ivy :commands lsp-ivy-workspace-symbol)
#+end_src
** Rust
@ -1003,8 +1052,6 @@ Insert a UUID via uuidgen at the cursor
(setq rustic-format-on-save t)
(add-hook 'rustic-mode-hook 'fs/rustic-mode-hook))
(defun fs/rustic-mode-hook ()
(when buffer-file-name
(setq-local buffer-save-without-query t)))
@ -1106,16 +1153,40 @@ Insert a UUID via uuidgen at the cursor
(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
#+end_src
* Rest Client
Setup rest client for testing API endpoints
#+begin_src emacs-lisp
(use-package restclient
:ensure t
:defer t)
(use-package ob-restclient)
#+end_src
* Tangle Setup Dot Files
#+begin_src emacs-lisp
(defun fs/org-babel-tangle-config ()
(when (string-equal (file-name-directory buffer-file-name)
(expand-file-name "~/dotfiles/"))
;; Dynamic scoping to the rescue
5s-dotfiles-dir)
(let ((org-confirm-babel-evaluate nil))
(org-babel-tangle))))
(add-hook 'org-mode-hook (lambda () (add-hook 'after-save-hook #'fs/org-babel-tangle-config)))
#+end_src
* Local config file
The local config should be including at ~/.emacs/config.el
- user-full-name - The name of the user
- user-mail-address - The email address of the user
- 5s-font-size - The general font scale (120)
- 5s-org-dir - The root of the org path
- 5s-org-index - The path to a index org file that can be quickly opened
- 5s-org-journal - The path journal entries should be saved
- 5s-org-agenda - The path containing agenda files that should be indexed for TODOS
- 5s-agenda-daily - The path for the daily agenda journal
- 5s-org-roam - The path to the org-roam notes
- 5s-org-agenda - files A list of paths to index TODOS from
- 5s-dotfiles-dir - The path to dot files that are automatically tangled on save

@ -0,0 +1,8 @@
#!/bin/sh
for file in ./*
do
emacs --batch --eval "(require 'org)" --eval "(org-babel-tangle-file \"$file\")"
done

@ -25,6 +25,11 @@ alias v=nvim
alias mkdir="mkdir -pv"
#+end_src
** Kitty
#+begin_src sh
alias kssh="kitty +kitten ssh"
#+end_src
** Utilities
*** Check for large files
#+begin_src sh

@ -20,7 +20,17 @@ bindkey '^R' history-incremental-search-backward
#+end_src
* General Path Setup
#+begin_src sh
export PATH="$PATH:$HOME/.local/bin"
#+end_src
* History
#+begin_src sh
export HISTFILE=~/.zsh_history
export HISTFILESIZE=1000000000
export HISTSIZE=1000000000
setopt INC_APPEND_HISTORY
export HISTTIMEFORMAT="[%F %T] "
setopt EXTENDED_HISTORY
setopt HIST_FIND_NO_DUPS
#+end_src

Loading…
Cancel
Save