diff --git a/uno/bootstrap.org b/uno/bootstrap.org index d0f78a1..aa3f6e0 100644 --- a/uno/bootstrap.org +++ b/uno/bootstrap.org @@ -40,15 +40,16 @@ Run bootstrap code for =straight= and have =use-package= ready. (setq straight-use-package-by-default t) (let ((bootstrap-file - (uno-emacs-path "straight/repos/straight.el/bootstrap.el")) - (bootstrap-version 5)) + (uno-emacs-path "straight/repos/straight.el/bootstrap.el")) + (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil)) + (url-retrieve-synchronously + "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" + 'silent 'inhibit-cookies) + (goto-char (point-max)) + (eval-print-last-sexp))) + (load bootstrap-file nil 'nomessage)) (straight-use-package 'use-package) @@ -74,13 +75,13 @@ Set up general and leader key binds that are used throughout. "Mode leader key.") :config (general-create-definer uno-define - :states '(motion normal visual)) + :states 'motion) (general-create-definer uno-leader-define :prefix uno-leader-key - :states '(motion normal visual)) + :states 'motion) (general-create-definer uno-mode-leader-define :prefix uno-mode-leader-key - :states '(motion normal visual)) + :states 'motion) (uno-leader-define "" nil) (uno-mode-leader-define "" nil)) #+END_SRC diff --git a/uno/modules/buffer.org b/uno/modules/buffer.org index f2af5ec..f17b394 100644 --- a/uno/modules/buffer.org +++ b/uno/modules/buffer.org @@ -74,5 +74,5 @@ Define useful and useless buffers. Borrowed from Spacemacs. (interactive) (with-current-buffer (messages-buffer) (goto-char (point-max)) - (switch-to-buffer (current-buffer))))) + (pop-to-buffer (current-buffer))))) #+END_SRC diff --git a/uno/modules/dev/lsp.org b/uno/modules/dev/lsp.org index 249e9c9..1d85687 100644 --- a/uno/modules/dev/lsp.org +++ b/uno/modules/dev/lsp.org @@ -25,8 +25,8 @@ Define LSP dev package. :general (uno-mode-leader-define :keymaps 'lsp-mode-map + "a" '(lsp-execute-code-action :which-key "Execute action") "h" '(:ignore t :which-key "Help") - "ha" '(lsp-execute-code-action :which-key "Execute action") "hh" '(lsp-describe-thing-at-point :which-key "Describe") "r" '(:ignore t :which-key "Refactor") "rr" '(lsp-rename :which-key "Rename")) diff --git a/uno/modules/dev/project.org b/uno/modules/dev/project.org index 8fbdac3..6edc688 100644 --- a/uno/modules/dev/project.org +++ b/uno/modules/dev/project.org @@ -26,6 +26,7 @@ Define project dev package. (uno-leader-define "p" '(:ignore t :which-key "Project") "pb" '(projectile-switch-to-buffer :which-key "Switch project buffer") + "pd" '(projectile-remove-known-project :which-key "Remove project") "pf" '(projectile-find-file :which-key "Open project file") "pk" '(projectile-kill-buffers :which-key "Kill project buffers") "pp" '(projectile-switch-project :which-key "Switch project") diff --git a/uno/modules/dev/shell.org b/uno/modules/dev/shell.org index be0c8a6..ff0b1da 100644 --- a/uno/modules/dev/shell.org +++ b/uno/modules/dev/shell.org @@ -21,6 +21,8 @@ Configure eshell package. :after uno-dev-shell :custom (eshell-banner-message "") + :hook + (eshell-mode . uno/dev/shell/eshell-alias) :general (uno-leader-define "se" '(eshell :which-key "Eshell")) @@ -28,9 +30,11 @@ Configure eshell package. (defun eshell/clear () (let ((inhibit-read-only t)) (erase-buffer))) - (eshell/alias "e" "find-file $*") - (eshell/alias "hgrep" "history | grep $*") - (eshell/alias "la" "ls -lAh $*")) + (defun uno/dev/shell/eshell-alias () + "Set up aliases for commands." + (eshell/alias "e" "find-file $1") + (eshell/alias "hgrep" "history | grep $*") + (eshell/alias "la" "ls -lAh $*"))) (use-package eshell :after (uno-dev-shell projectile) diff --git a/uno/modules/doc/org.org b/uno/modules/doc/org.org index 7b9c0e5..2f1e9fc 100644 --- a/uno/modules/doc/org.org +++ b/uno/modules/doc/org.org @@ -48,7 +48,9 @@ Define Org document package. '(org-level-3 ((t (:inherit outline-3 :height 1.4)))) '(org-level-4 ((t (:inherit outline-4 :height 1.3)))) '(org-level-4 ((t (:inherit outline-5 :height 1.2)))) - '(org-level-5 ((t (:inherit outline-6 :height 1.1)))))))) + '(org-level-5 ((t (:inherit outline-6 :height 1.1))))))) + :config + (require 'ox-beamer)) (use-package org-superstar :if (display-graphic-p) @@ -67,14 +69,12 @@ Define Org document package. (use-package org-present :after uno-doc-org :hook - (org-present-mode . evil-motion-state) (org-present-mode . org-display-inline-images) (org-present-mode . org-present-big) (org-present-mode . org-present-hide-cursor) (org-present-mode . org-present-read-only) (org-present-mode . uno/doc/org/present) (org-present-mode-quit . blink-cursor-mode) - (org-present-mode-quit . evil-normal-state) (org-present-mode-quit . fringe-mode) (org-present-mode-quit . org-present-read-write) (org-present-mode-quit . org-present-show-cursor) @@ -102,6 +102,12 @@ Define Org document package. (unless org-startup-with-inline-images (org-remove-inline-images)))) + (use-package org-present + :after (uno-doc-org evil) + :hook + (org-present-mode . evil-motion-state) + (org-present-mode-quit . evil-normal-state)) + (use-package hide-mode-line :after (uno-doc-org org-present) :hook diff --git a/uno/modules/key/vim.org b/uno/modules/key/vim.org index 63d638c..09b7281 100644 --- a/uno/modules/key/vim.org +++ b/uno/modules/key/vim.org @@ -21,6 +21,8 @@ Define Vim key package. (evil-split-window-before t) (evil-vsplit-window-right t) (evil-want-integration t) + :hook + (uno-special-mode . evil-motion-state) :general (uno-define ";" 'evil-ex) :init diff --git a/uno/modules/lang/+index.org b/uno/modules/lang/+index.org index a780db4..1727a55 100644 --- a/uno/modules/lang/+index.org +++ b/uno/modules/lang/+index.org @@ -11,3 +11,10 @@ Define language package. :config (provide 'uno-lang)) #+END_SRC + +* JSON + +#+BEGIN_SRC emacs-lisp + (use-package json-mode + :after uno-lang) +#+END_SRC diff --git a/uno/modules/lang/js/+index.org b/uno/modules/lang/js/+index.org index d8bc834..f991083 100644 --- a/uno/modules/lang/js/+index.org +++ b/uno/modules/lang/js/+index.org @@ -11,3 +11,31 @@ Define JavaScript language package. :config (provide 'uno-lang-js)) #+END_SRC + +#+BEGIN_SRC emacs-lisp + (use-package emacs + :after uno-lang-js + :init + (defvar uno-lang-js-ligatures '("==" + "===" + "!==" + "!=" + "=>" + "<>" + "" + "" + "__" + "/*" + "*/" + "**" + "??" + "?." + "//" + ">=" + "<=" + "..." + "||" + "&&") + "Ligature symbols for JS.")) +#+END_SRC diff --git a/uno/modules/lang/js/ts.org b/uno/modules/lang/js/ts.org index 116bcb4..344ff58 100644 --- a/uno/modules/lang/js/ts.org +++ b/uno/modules/lang/js/ts.org @@ -23,13 +23,19 @@ Define TypeScript JavaScript language package. :init (define-derived-mode typescript-tsx-mode web-mode "typescript-tsx") (push '("\\.tsx\\'" . typescript-tsx-mode) auto-mode-alist)) + + (use-package emacs + :after (uno-lang-js-ts ligature typescript-mode) + :config + (ligature-set-ligatures 'typescript-mode uno-lang-js-ligatures) + (ligature-set-ligatures 'typescript-tsx-mode uno-lang-js-ligatures)) #+END_SRC * LSP Integration #+BEGIN_SRC emacs-lisp - (use-package typescript-mode - :after (uno-lang-js-ts uno-lang-js-yarn) + (use-package emacs + :after (uno-lang-js-ts uno-lang-js-yarn typescript-mode) :hook (uno-lang-js-yarn . uno/lang/js/ts/yarn) ((typescript-mode typescript-tsx-mode) . uno/lang/js/yarn/check) diff --git a/uno/modules/mode.org b/uno/modules/mode.org index 36281c8..3c8be9a 100644 --- a/uno/modules/mode.org +++ b/uno/modules/mode.org @@ -12,28 +12,60 @@ Define core mode package. (provide 'uno-mode)) #+END_SRC -* Program/Text Mode +* Program Mode -Define custom =prog-mode= and =text-mode= as there are some libraries that do not abide. +Define custom =prog-mode= as there are some libraries that do not abide. #+BEGIN_SRC emacs-lisp (use-package emacs :after uno-mode :hook ((conf-mode prog-mode) . uno/run-prog-mode-hook) - (text-mode . uno/run-text-mode-hook) :init - (defvar uno--prog-based-modes '(nxml-mode) + (defvar uno-prog-based-modes '(nxml-mode) "List of prog based modes.") (defun uno/add-prog-mode (mode) "Consider MODE prog based." - (push mode uno--prog-based-modes)) + (push mode uno-prog-based-modes)) (defun uno/run-prog-mode-hook () "Configure program mode." - (run-hooks 'uno-prog-mode-hook)) + (run-hooks 'uno-prog-mode-hook))) +#+END_SRC + +* Text Mode + +Define custom =text-mode= as there are some libraries that do not abide. + +#+BEGIN_SRC emacs-lisp + (use-package emacs + :after uno-mode + :hook + (text-mode . uno/run-text-mode-hook) + :init (defun uno/run-text-mode-hook () "Configure text mode, checking for prog mode." - (if (member major-mode uno--prog-based-modes) + (if (member major-mode uno-prog-based-modes) (uno/run-prog-mode-hook) (run-hooks 'uno-text-mode-hook)))) #+END_SRC + +* Special Mode + +Define custom =special-mode= as there are some libraries that do not abide. + +#+BEGIN_SRC emacs-lisp + (use-package emacs + :after uno-mode + :hook + (special-mode . uno/run-special-mode-hook) + :init + (defvar uno-non-special-based-modes nil + "List of special based modes to exclude.") + (defun uno/exclude-special-mode (mode) + "Exclude MODE as special based." + (push mode uno-non-special-based-modes)) + (defun uno/run-special-mode-hook () + "Configure program mode." + (unless (member major-mode uno-non-special-based-modes) + (run-hooks 'uno-special-mode-hook)))) +#+END_SRC diff --git a/uno/modules/ui/+index.org b/uno/modules/ui/+index.org index 41ba8d5..b91c8c8 100644 --- a/uno/modules/ui/+index.org +++ b/uno/modules/ui/+index.org @@ -21,6 +21,16 @@ Add support for icons via =all-the-icons=. :after uno-ui) #+END_SRC +* Ligatures + +#+BEGIN_SRC emacs-lisp + (use-package ligature + :after uno-ui + :straight (:type git :host github :repo "mickeynp/ligature.el") + :config + (global-ligature-mode 1)) +#+END_SRC + * Which Key #+BEGIN_SRC emacs-lisp @@ -29,3 +39,23 @@ Add support for icons via =all-the-icons=. :config (which-key-mode 1)) #+END_SRC + +* Olivetti + +#+BEGIN_SRC emacs-lisp + (use-package olivetti + :after uno-ui + :hook + (uno-prog-mode . uno/ui/olivetti-prog) + (uno-text-mode . uno/ui/olivetti-text) + :general + (uno-leader-define + "tw" '(olivetti-mode :which-key "Toggle writing mode")) + :init + (defun uno/ui/olivetti-prog () + "Configure Olivetti for prog mode." + (setq-local olivetti-body-width 85)) + (defun uno/ui/olivetti-text () + "Configure Olivetti for text mode." + (setq-local olivetti-body-width 0.6))) +#+END_SRC diff --git a/uno/modules/ui/dashboard.org b/uno/modules/ui/dashboard.org index e61b4ba..c99fcc1 100644 --- a/uno/modules/ui/dashboard.org +++ b/uno/modules/ui/dashboard.org @@ -42,7 +42,7 @@ Define UI dashboard package. (dashboard-setup-startup-hook) :config (uno/add-useless-buffer "\\*dashboard\\*") - (uno/ui/exclude-center-cursor 'dashboard-mode)) + (uno/exclude-special-mode 'dashboard-mode)) (use-package dashboard :after (uno-ui-dashboard projectile) diff --git a/uno/modules/ui/emacs.org b/uno/modules/ui/emacs.org index 2571886..2639c25 100644 --- a/uno/modules/ui/emacs.org +++ b/uno/modules/ui/emacs.org @@ -44,26 +44,3 @@ Define UI Emacs package. (menu-bar-mode -1) (tool-bar-mode -1)) #+END_SRC - -* Centered Cursor - -Hide UI items, set up relative line numbers, and highlight current line. - -#+BEGIN_SRC emacs-lisp - (use-package emacs - :after uno-ui-emacs - :init - (defvar uno--ui-center-cursor-blacklist nil - "Major modes to exclude center cursor mode.") - (defun uno/ui/exclude-center-cursor (mode) - "Exclude major MODE from center cursor." - (push mode uno--ui-center-cursor-blacklist)) - (defun uno/ui/center-cursor () - "Set up center cursor unless excluded." - (unless (member major-mode uno--ui-center-cursor-blacklist) - (setq-local - scroll-preserve-screen-position t - scroll-conservatively 0 - maximum-scroll-margin 0.5 - scroll-margin 99999)))) -#+END_SRC diff --git a/uno/modules/ui/theme.org b/uno/modules/ui/theme.org index 9b08bba..73bfd71 100644 --- a/uno/modules/ui/theme.org +++ b/uno/modules/ui/theme.org @@ -12,7 +12,7 @@ Define UI theme package. (provide 'uno-ui-theme)) #+END_SRC -* Theme +* Doom Theme #+BEGIN_SRC emacs-lisp (use-package doom-themes @@ -26,3 +26,22 @@ Define UI theme package. (when (display-graphic-p) (doom-themes-treemacs-config))) #+END_SRC + +* Font + +#+BEGIN_SRC emacs-lisp + (use-package emacs + :after uno-ui-theme + :if (display-graphic-p) + :config + (let ((-fixed-font "Victor Mono") + (-variable-font "PT Sans")) + (when (x-list-fonts -fixed-font) + (set-face-attribute 'default nil + :family -fixed-font + :height 100 + :weight 'medium) + (set-face-attribute 'fixed-pitch nil :family -fixed-font)) + (when (x-list-fonts -variable-font) + (set-face-attribute 'variable-pitch nil :family -variable-font)))) +#+END_SRC diff --git a/uno/modules/ui/window.org b/uno/modules/ui/window.org index ece5686..d3e9ba7 100644 --- a/uno/modules/ui/window.org +++ b/uno/modules/ui/window.org @@ -45,3 +45,16 @@ Define UI window package. :config (winum-mode 1)) #+END_SRC + +* Centered Cursor + +Hide UI items, set up relative line numbers, and highlight current line. + +#+BEGIN_SRC emacs-lisp + (use-package centered-cursor-mode + :after uno-ui-window + :custom + (ccm-recenter-at-end-of-file t) + :hook + ((uno-special-mode uno-prog-mode uno-text-mode) . centered-cursor-mode)) +#+END_SRC diff --git a/uno/modules/window.org b/uno/modules/window.org index 5bef499..6e8e802 100644 --- a/uno/modules/window.org +++ b/uno/modules/window.org @@ -27,8 +27,8 @@ Define where certain buffers go where in the window. (let* ((-side (if (member side '(top left right)) side 'bottom)) (-slot (if (integerp slot) slot 0)) (-size (if (member -side '(left right)) - 'window-height - 'window-width))) + 'window-width + 'window-height))) (push `(,buffer (display-buffer-in-side-window) (,-size . 0.25)