From bffcee2c6cfae662a09cb930e8362ab464fa902a Mon Sep 17 00:00:00 2001 From: Ian Griffin Date: Sun, 9 Jun 2024 13:20:55 +0800 Subject: [PATCH] minor fixes --- init.org.d/10-misc.org | 2 +- init.org.d/30-org.org | 24 ++++++++-------- init.org.d/40-fonts.org | 24 ++++++++-------- init.org.d/50-ui.org | 56 ++++++++++++++++++-------------------- init.org.d/60-ide.org | 8 +++--- init.org.d/70-lang.org | 40 +++++++++++++++++++++------ init.org.d/80-misc-end.org | 32 +++++++++++++++++++--- 7 files changed, 114 insertions(+), 72 deletions(-) diff --git a/init.org.d/10-misc.org b/init.org.d/10-misc.org index 15e6994..8b01a40 100644 --- a/init.org.d/10-misc.org +++ b/init.org.d/10-misc.org @@ -27,7 +27,7 @@ This file stores variables containing personal information, and is not distribut A sample of this file though is included in this config to be used #+begin_src emacs-lisp (let ((personal-file-path (expand-file-name "personal.org" user-emacs-config-directory)) - (sample-personal-file-path (expand-file-name "/personal-sample.org" user-emacs-config-directory ))) + (sample-personal-file-path (expand-file-name "personal-sample.org" user-emacs-config-directory ))) ;; load main personal file if it exists (if (file-exists-p personal-file-path) diff --git a/init.org.d/30-org.org b/init.org.d/30-org.org index ad3e23a..ec01413 100644 --- a/init.org.d/30-org.org +++ b/init.org.d/30-org.org @@ -19,21 +19,21 @@ Set different types of fonts for differents elements of Org-mode files, like var (defun org-config-font-setup () "set org mode element fonts" (custom-set-faces - '(org-block ((t (:inherit fixed-pitch :height 0.91)))) + '(org-block ((t (:inherit fixed-pitch)))) ;; '(org-block-begin-line ((t (:inherit fixed-pitch)))) ;; '(org-block-end-line ((t (:inherit fixed-pitch)))) - '(org-checkbox ((t (:inherit fixed-pitch :height 0.91)))) - '(org-code ((t (:inherit (shadow fixed-pitch) :height 0.91)))) + '(org-checkbox ((t (:inherit fixed-pitch)))) + '(org-code ((t (:inherit (shadow fixed-pitch))))) '(org-document-info ((t (:foreground "dark orange")))) - '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch) :height 0.91)))) - '(org-indent ((t (:inherit (org-hide fixed-pitch) :height 0.91)))) + '(org-document-info-keyword ((t (:inherit (shadow fixed-pitch) )))) + '(org-indent ((t (:inherit (org-hide fixed-pitch) )))) '(org-link ((t (:foreground "royal blue" :underline t)))) - '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.91)))) - '(org-property-value ((t (:inherit fixed-pitch :height 0.91))) t) - '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.91)))) - '(org-table ((t (:inherit fixed-pitch :foreground "#83a598" :height 0.91)))) - '(org-tag ((t (:inherit (shadow fixed-pitch) :height 0.91 :weight bold :height 0.8)))) - '(org-verbatim ((t (:inherit (shadow fixed-pitch) :height 0.91)))))) + '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) )))) + '(org-property-value ((t (:inherit fixed-pitch ))) t) + '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch) )))) + '(org-table ((t (:inherit fixed-pitch :foreground "#83a598" )))) + '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) + '(org-verbatim ((t (:inherit (shadow fixed-pitch))))))) #+end_src ** Header Font Setup @@ -63,7 +63,7 @@ Make header and document title fonts bigger for better visibility. :custom (org-hide-emphasis-markers nil) (org-agenda-files - `(,(expand-file-name "shared/org" (safe-getenv "HOME" user-home-path)))) + `(,(expand-file-name "docs/notes" (safe-getenv "HOME" user-home-path)))) :config ;; font setup diff --git a/init.org.d/40-fonts.org b/init.org.d/40-fonts.org index 3d7ba25..5238dfe 100644 --- a/init.org.d/40-fonts.org +++ b/init.org.d/40-fonts.org @@ -1,21 +1,19 @@ #+TITLE: Font Configuration -This config uses Mozilla's Fira Set of fonts and the related Fira Code fonts with added Nerd fonts. -So for this to run, Fira Sans and FiraCode Nerd Font needs to be installed in the system. * Configuration ** default fonts #+begin_src emacs-lisp - (custom-set-faces - ;; set default font - '(default ((t (:inherit nil :extend nil :stipple nil - :inverse-video nil :box nil - :strike-through nil :overline nil :underline nil - :slant normal :weight normal - :height 100 :width normal - :foundry "CTDB" :family "FiraCode Nerd Font Mono")))) - '(fixed-pitch ((t (:family "FiraCode Nerd Font Mono")))) - '(fixed-pitch-serif ((t (:family "FiraCode Nerd Font Mono")))) - '(variable-pitch ((t (:inherit default :height 1.2 :weight medium :family "Cantarell"))))) + (custom-set-faces + ;; set default font + '(default ((t (:inherit nil :extend nil :stipple nil + :inverse-video nil :box nil + :strike-through nil :overline nil :underline nil + :slant normal :weight normal + :height 100 :width normal + :foundry "CTDB" :family "IBM Plex Mono")))) + '(fixed-pitch ((t (:family "IBM Plex Mono")))) + '(fixed-pitch-serif ((t (:family "IBM Plex Mono")))) + '(variable-pitch ((t (:inherit default :weight regular :family "IBM Plex Sans"))))) #+end_src ** Chinese Font diff --git a/init.org.d/50-ui.org b/init.org.d/50-ui.org index 8a7f7a7..77ad06f 100644 --- a/init.org.d/50-ui.org +++ b/init.org.d/50-ui.org @@ -52,7 +52,7 @@ run the function at startup of a frame #+end_src * Cursor Shape - The most visible type of cursor shape + The most visible type of cursor shape #+begin_src emacs-lisp (setq-default cursor-type 'box) @@ -118,39 +118,37 @@ sets the tab size 5 spaces * Ligatures #+begin_src emacs-lisp - (when (> emacs-major-version 28) - (use-package ligature - :config - ;; Enable the "www" ligature in every possible major mode - (ligature-set-ligatures 't '("www")) - ;; Enable traditional ligature support in eww-mode, if the - ;; `variable-pitch' face supports it - (ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi")) - ;; Enable all Cascadia Code ligatures in programming modes - (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "" "---" "-<<" - "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->" - "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "" "###" "#_(" "..<" - "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~=" - "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|" - "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:" - ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:" - "<$" "<=" "<>" "<-" "<<" "<+" "" "++" "?:" - "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" - "\\\\" "://")) - ;; Enables ligature checks globally in all buffers. You can also do it - ;; per mode with `ligature-mode'. - (global-ligature-mode t))) - - + ;; (when (> emacs-major-version 28) + ;; (use-package ligature + ;; :config + ;; ;; Enable the "www" ligature in every possible major mode + ;; (ligature-set-ligatures 't '("www")) + ;; ;; Enable traditional ligature support in eww-mode, if the + ;; ;; `variable-pitch' face supports it + ;; (ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi")) + ;; ;; Enable all ligatures in programming modes + ;; (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "" "---" "-<<" + ;; "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->" + ;; "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "" "###" "#_(" "..<" + ;; "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~=" + ;; "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|" + ;; "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:" + ;; ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:" + ;; "<$" "<=" "<>" "<-" "<<" "<+" "" "++" "?:" + ;; "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" + ;; "\\\\" "://")) + ;; ;; Enables ligature checks globally in all buffers. You can also do it + ;; ;; per mode with `ligature-mode'. + ;; (global-ligature-mode t))) #+end_src * Theme Load theme (that is built-in) #+begin_src emacs-lisp - (load-theme 'modus-vivendi t) + (load-theme 'modus-operandi t) ;; (use-package solarized-theme ;; :config ;; (load-theme 'solarized-selenized-black)) diff --git a/init.org.d/60-ide.org b/init.org.d/60-ide.org index 45c8ee7..2397d67 100644 --- a/init.org.d/60-ide.org +++ b/init.org.d/60-ide.org @@ -13,13 +13,13 @@ Tree sitter highlighting in emacs.[[https://tree-sitter.github.io/tree-sitter/sy Tree-sitter Syntax Highlighting website]] #+begin_src emacs-lisp + (use-package tree-sitter-langs) (use-package tree-sitter + :after tree-sitter-langs :diminish :config - (global-tree-sitter-mode)) - - (use-package tree-sitter-langs - :after tree-sitter) + (global-tree-sitter-mode) + :hook (prog-mode . tree-sitter-hl-mode)) #+end_src * Imenu-list diff --git a/init.org.d/70-lang.org b/init.org.d/70-lang.org index 10b672d..5b2e935 100644 --- a/init.org.d/70-lang.org +++ b/init.org.d/70-lang.org @@ -16,7 +16,7 @@ * Built-in Modes ** hook default settings to configured language modes #+begin_src emacs-lisp - (let ((langs '("sh" "c++" "mhtml" "java" "js" "json" "python" "latex"))) + (let ((langs '("sh" "c++" "mhtml" "java" "js" "json" "python" "latex" "typescript-ts" "tsx-ts"))) (dolist (lang langs) (add-hook (intern (concat lang "-mode-hook")) (lambda () (lang-default-settings))))) #+end_src @@ -46,17 +46,40 @@ #+end_src ** TypeScript +No longer using typescript-mode, as there's a builtin typescript-ts mode in Emacs 29 #+begin_src emacs-lisp - (use-package typescript-mode - :mode "\\.ts\\'" - :init - (add-to-list 'eglot-server-programs `(typescript-mode . ("typescript-language-server"))) - :hook - (typescript-mode . (lambda () (lang-default-settings)))) + (if (version< emacs-version "29") + (use-package typescript-ts + :mode (("\\.ts\\'" . typescript-ts-mode) + ("\\.tsx\\'" . tsx-ts-mode)) + :hook (lang-default-settings + (tsx-ts-mode . lang-default-settings)) + :config + (let ((server-programs '(("typescript-ts-mode" . ("typescript-language-server" "--stdio")) + ("tsx-ts-mode" . ("typescript-language-server""--stdio"))))) + (setq eglot-server-programs (append server-programs eglot-server-programs)))) + + (use-package typescript-mode + :mode ("\\.ts\\'" ("\\.tsx" . typescript-tsx-mode)) + :config + (define-derived-mode typescript-tsx-mode typescript-mode "TypeScriptReact") + (dolist (mode '(typescript-mode typescript-tsx-mode)) + (add-to-list 'eglot-server-programs `(,mode . ("typescript-language-server", "--stdio")))) + :hook + (typescript-mode . (lambda () (lang-default-settings) + (let ((custom-tab-size 2)) + (setq-default default-tab-width custom-tab-sizen + tab-width custom-tab-size + c-basic-offset custom-tab-size)))) + (typescript-tsx-mode . (lambda () + (lang-default-settings) + (let ((custom-tab-size 4)) + (setq-default default-tab-width custom-tab-size + tab-width custom-tab-size + c-basic-offset custom-tab-size)))))) #+end_src ** Markdown - #+begin_src emacs-lisp (use-package markdown-mode :commands (markdown-mode gfm-mode) @@ -76,7 +99,6 @@ ** Python *** Pyenv python venv manager - #+begin_src emacs-lisp (use-package pyvenv :commands (pyvenv-mode pyvenv-activate pyvenv-workon pyvenv-exec-shell pyvenv-virtual-env) diff --git a/init.org.d/80-misc-end.org b/init.org.d/80-misc-end.org index 41e539d..8acb877 100644 --- a/init.org.d/80-misc-end.org +++ b/init.org.d/80-misc-end.org @@ -5,7 +5,7 @@ * Ido Ido is a autocomplete package for emacs' commands - +n #+begin_src emacs-lisp (use-package ido :config @@ -60,11 +60,28 @@ do presentations in Org mode #+end_src * Emacs Shell -This sets the prompt to a lambda, for aesthetic reasons +** History #+begin_src emacs-lisp - (setq eshell-prompt-function (lambda nil - (if (= (user-uid) 0) " #λ " " λ "))) + (add-hook 'eshell-expand-input-functions 'eshell-expand-history-references) +#+end_src + +** Prompt +This sets the prompt to a lambda, for aesthetic reasons +#+begin_src emacs-lisp + (setq eshell-prompt-function + (lambda nil + (concat + (propertize (concat + "\n# " + (user-login-name) + "@" + (car (split-string system-name "\\.")) + ":" + (file-name-nondirectory (eshell/pwd)) + (if (= (user-uid) 0) " #λ" " λ")) + 'face `(:inherit 'eshell-prompt :weight bold)) + (propertize " " 'face `(:inherit default))))) (setq eshell-highlight-prompt nil) #+end_src @@ -85,6 +102,13 @@ a visualizer for Emacs' cool but confusing undo/history system ; (use-package pass) #+end_src +* Nov.el +Mode to read epub files +#+begin_src emacs-lisp + (use-package nov + :mode ("\\.epub\\'" . nov-mode)) +#+end_src + * Elgrep a built in grep command in emacs