diff --git a/.config/doom/config.org b/.config/doom/config.org index 09494ff..da940ad 100644 --- a/.config/doom/config.org +++ b/.config/doom/config.org @@ -17,8 +17,8 @@ Seriously? I just want to quit. Damn. Why confirm lol (setq confirm-kill-emacs nil) #+end_src -Scroll margin like =scrolloff= in vim -#+begin_src elisp +Scroll margin like =scrolloff= in vim (not tangled) +#+begin_src elisp :tangle no (setq scroll-margin 6) #+end_src @@ -55,6 +55,11 @@ This is particularly useful under Mac OS X and macOS, where GUI apps are not sta (set-exec-path-from-shell-PATH) #+end_src +** UI +#+begin_src elisp +(setq doom-modeline-height 40) +#+end_src + ** Window management #+begin_src elisp @@ -248,6 +253,50 @@ Enable with =C-x C-o= or something, check with =C-x C-h= in insert mode. #+begin_src elisp (after! company (setq company-idle-delay nil)) +(after! company-quickhelp + (setq company-quickhelp-mode t)) +#+end_src + +#+begin_src elisp +(use-package! company + :config + (setq company-tooltip-align-annotations nil) + (setq company-icon-size '(auto-scale . 64)) + (setq company-box-icons-all-the-icons + (let ((all-the-icons-scale-factor 10.0)) + `((Unknown . ,(all-the-icons-material "find_in_page" :face 'all-the-icons-purple)) + (Text . ,(all-the-icons-material "text_fields" :face 'all-the-icons-green)) + (Method . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) + (Function . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) + (Constructor . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) + (Field . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) + (Variable . ,(all-the-icons-material "adjust" :face 'all-the-icons-blue)) + (Class . ,(all-the-icons-material "class" :face 'all-the-icons-red)) + (Interface . ,(all-the-icons-material "settings_input_component" :face 'all-the-icons-red)) + (Module . ,(all-the-icons-material "view_module" :face 'all-the-icons-red)) + (Property . ,(all-the-icons-material "settings" :face 'all-the-icons-red)) + (Unit . ,(all-the-icons-material "straighten" :face 'all-the-icons-red)) + (Value . ,(all-the-icons-material "filter_1" :face 'all-the-icons-red)) + (Enum . ,(all-the-icons-material "plus_one" :face 'all-the-icons-red)) + (Keyword . ,(all-the-icons-material "filter_center_focus" :face 'all-the-icons-red)) + (Snippet . ,(all-the-icons-material "short_text" :face 'all-the-icons-red)) + (Color . ,(all-the-icons-material "color_lens" :face 'all-the-icons-red)) + (File . ,(all-the-icons-material "insert_drive_file" :face 'all-the-icons-red)) + (Reference . ,(all-the-icons-material "collections_bookmark" :face 'all-the-icons-red)) + (Folder . ,(all-the-icons-material "folder" :face 'all-the-icons-red)) + (EnumMember . ,(all-the-icons-material "people" :face 'all-the-icons-red)) + (Constant . ,(all-the-icons-material "pause_circle_filled" :face 'all-the-icons-red)) + (Struct . ,(all-the-icons-material "streetview" :face 'all-the-icons-red)) + (Event . ,(all-the-icons-material "event" :face 'all-the-icons-red)) + (Operator . ,(all-the-icons-material "control_point" :face 'all-the-icons-red)) + (TypeParameter . ,(all-the-icons-material "class" :face 'all-the-icons-red)) + (Template . ,(all-the-icons-material "short_text" :face 'all-the-icons-green)) + (ElispFunction . ,(all-the-icons-material "functions" :face 'all-the-icons-red)) + (ElispVariable . ,(all-the-icons-material "check_circle" :face 'all-the-icons-blue)) + (ElispFeature . ,(all-the-icons-material "stars" :face 'all-the-icons-orange)) + (ElispFace . ,(all-the-icons-material "format_paint" :face 'all-the-icons-pink))))) +) + #+end_src *** Inline math symbols with latex @@ -811,3 +860,27 @@ See `eshell-display-modifier-help' for details on that." ;; Me neither, so this makes it act a bit more shell-like: eshell-prefer-lisp-functions nil)) #+end_src + +*** EAT +#+begin_src elisp +(use-package eat + :after eshell + :bind + (map! :map eat-mode-map "C-c C-d" #'eat-self-input) + :hook (eshell-load . #'eat-eshell-mode)) +#+end_src + +** LSP +Don't show errors & warnings at the side. Show them when my point is on it. + +#+begin_src elisp +(use-package! lsp + :config + (setq lsp-ui-sideline-enable nil) + (setq lsp-headerline-breadcrumb-enable t) + (setq lsp-lens-enable t)) + + +#+end_src + +**NOTE**: Flycheck mode can be toggled in doom with =SPC t f= diff --git a/.config/doom/packages.el b/.config/doom/packages.el index ea73447..c42f9f2 100644 --- a/.config/doom/packages.el +++ b/.config/doom/packages.el @@ -52,3 +52,7 @@ (package! org-anki) (package! wrap-region) +(package! eat) +(package! pos-tip + :recipe (:source melpa)) +(package! company-quickhelp) diff --git a/.config/emacs/init.org b/.config/emacs/init.org new file mode 100644 index 0000000..9aac020 --- /dev/null +++ b/.config/emacs/init.org @@ -0,0 +1,253 @@ +#+title: Init.El Literate +:PROPERTIES: +:tangle: ~/.config/emacsd/init.el +:END: +#+auto_tangle: t + +* Basics +#+BEGIN_SRC emacs-lisp :tangle yes +(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) +(defun display-startup-echo-area-message () + (message (format "Emacs %s loaded from %s" + emacs-version user-emacs-directory))) + +(global-set-key (kbd "C-c C-r") 'eval-region) +(setq initial-scratch-message (concat ";; *SCRATCH*\n" + ";; C-c C-b (eval-buffer) C-c C-r (eval-region)\n" + ";; C-x C-s will let you choose where to save\n\n; ")) + +;; Display +;; Setting this in early-init doesn't seem to work +(set-frame-position (selected-frame) 100 10) +(set-face-attribute 'default nil :height 160) +(add-to-list 'bdf-directory-list "~/Library/Fonts") + +(custom-theme-set-faces + 'user + '(variable-pitch ((t (:foundry "apple" :family "IBM Plex Sans" :weight normal :height 170)))) + '(fixed-pitch ((t (:foundry "apple" :family "Fira Code" :height 160))))) +(set-face-attribute 'default nil :foundry "apple" :family "Fira Code" :height 160) +(set-face-attribute 'variable-pitch nil :foundry "apple" :family "IBM Plex Sans" :height 170) + +;;(global-display-line-numbers-mode 1) +(add-hook 'prog-mode-hook (lambda () (display-line-numbers-mode 1))) +(add-hook 'text-mode-hook (lambda () (display-line-numbers-mode 1))) + +;; I think this saves the last cursor pos or something +(require 'saveplace) +(setq-default save-place t) +(setq save-place-file (expand-file-name ".places" user-emacs-directory)) + +;; Some better defaults? +(setq make-backup-files nil) +(setq auto-save-default nil) +(setq-default major-mode 'text-mode) +(setq sentence-end-double-space nil) + +;; Always tabs except for *.go? +;; TODO: set up language mode packages +(setq-default c-basic-offset 4 + tab-width 4 + indent-tabs-mode nil) +;; Some modes +(recentf-mode 1) +(show-paren-mode 1) +(setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit) +(electric-pair-mode 1) +(winner-mode 1) + +;; IDK +(add-hook 'prog-mode-hook #'subword-mode) +(add-hook 'minibuffer-setup-hook #'subword-mode) + +;; elisp +(add-hook 'emacs-lisp-mode-hook + (lambda () + (local-set-key (kbd "C-c C-x") #'ielm) + (local-set-key (kbd "C-c C-c") #'eval-defun) + (local-set-key (kbd "C-c C-b") #'eval-buffer))) +#+END_SRC + +* Helper functions +Hopefully I'll be consistent with the convention of using =./= for all self-defined functions. + +To search for these in completion systems, use =\./= (\o/ :D). =./= stands for DOTSLASH + +The function below is adapted from a blog post (link lost, sorry) which describes how you can define a function to quickly insert a src code block. + +I've adapted it to automatically use =emacs-lisp :tangle yes= if the file currently being edited is in the =user-emacs-directory=, since I use a literate emacs configuration and the only time I'll use this function when I'm in the user emacs directory is when I'm editing my literate org configuration. + +Otherwise (editing any other files) it will read input from the minibuffer for text to insert after the =#+BEGIN_SRC=. The original function used ido completing read with a list of known code types and I've nuked it and just let the user append what ever they want after =#+BEGIN_SRC=: this could be useful for adding =:stuff like this= after the code-type. + +#+begin_src emacs-lisp :tangle yes +(defun ./org-insert-src () + "Insert SRC Block with prompted code type. + +Uses 'emacs-lisp :tangle yes' if currently in user-emacs-directory." + (interactive) + (let ((code-type (if (string= + (file-truename user-emacs-directory) + (file-name-directory (buffer-file-name))) + "emacs-lisp :tangle yes" + (read-from-minibuffer "#+BEGIN_SRC ")))) + (progn + (newline) + (insert (format "#+BEGIN_SRC %s\n" code-type)) + (newline) + (insert "#+END_SRC\n") + (previous-line 2) + (org-edit-src-code)))) +#+END_SRC + +This is also another helper function for editing my literate configuration. It uses the =#+BEGIN_SRC= content from the current code block (that the cursor is in) and splits the block into two by inserting =#+END_SRC= and copying whatever =#+BEGIN_SRC <...>= that was used in the current code block. + +- ~save-excursion~ allows execution of some expressions then move the point back to where it was (before the save-excursion call). +- Note that the ~re-search-backward~ seems to be case-insensitive, surprisingly, so both =BEGIN_SRC= and =begin_src= could be matched. + +#+begin_src emacs-lisp :tangle yes +(defun ./org-split-src () + "Split current src block into two blocks at point. + +Retains src properties." + (interactive) + (insert "#+END_SRC\n\n") + (save-excursion + (re-search-backward "^\\s-*#\\+begin_src") + (defvar beginsrc (buffer-substring-no-properties (line-beginning-position) (line-end-position)))) + (insert beginsrc) + (previous-line)) +#+end_src + +** Load file and directory + +https://www.emacswiki.org/emacs/LoadingLispFiles#h5o-2 -- Thanks! + +This is used for loading my =modules/= dir in =packages.el=. + +#+BEGIN_SRC emacs-lisp :tangle yes +(defun ./load-directory (dir) + "Load *.el files in a given directory" + (let ((load-it (lambda (f) + (load-file (concat (file-name-as-directory dir) f))))) + (mapc load-it (directory-files dir nil "\\.el$")))) +#+END_SRC + +TBH this is such a small function but like, does save some parens y'know. + +#+BEGIN_SRC emacs-lisp :tangle yes +(defun ./load-file-if-exists (file) + "Same as load-file but NOP if file does not exist" + (if (file-exists-p file) + (load-file file))) +#+END_SRC + +** Toggle window split + +https://www.emacswiki.org/emacs/ToggleWindowSplit + +#+BEGIN_SRC emacs-lisp :tangle yes +(defun toggle-window-split () + (interactive) + (if (= (count-windows) 2) + (let* ((this-win-buffer (window-buffer)) + (next-win-buffer (window-buffer (next-window))) + (this-win-edges (window-edges (selected-window))) + (next-win-edges (window-edges (next-window))) + (this-win-2nd (not (and (<= (car this-win-edges) + (car next-win-edges)) + (<= (cadr this-win-edges) + (cadr next-win-edges))))) + (splitter + (if (= (car this-win-edges) + (car (window-edges (next-window)))) + 'split-window-horizontally + 'split-window-vertically))) + (delete-other-windows) + (let ((first-win (selected-window))) + (funcall splitter) + (if this-win-2nd (other-window 1)) + (set-window-buffer (selected-window) this-win-buffer) + (set-window-buffer (next-window) next-win-buffer) + (select-window first-win) + (if this-win-2nd (other-window 1)))))) +#+END_SRC + + + +* Packages - Elpaca + +Bootstrap installation of Elpaca +#+BEGIN_SRC emacs-lisp :tangle yes +(defvar elpaca-installer-version 0.5) +(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory)) +(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory)) +(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory)) +(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git" + :ref nil + :files (:defaults (:exclude "extensions")) + :build (:not elpaca--activate-package))) +(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory)) + (build (expand-file-name "elpaca/" elpaca-builds-directory)) + (order (cdr elpaca-order)) + (default-directory repo)) + (add-to-list 'load-path (if (file-exists-p build) build repo)) + (unless (file-exists-p repo) + (make-directory repo t) + (when (< emacs-major-version 28) (require 'subr-x)) + (condition-case-unless-debug err + (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*")) + ((zerop (call-process "git" nil buffer t "clone" + (plist-get order :repo) repo))) + ((zerop (call-process "git" nil buffer t "checkout" + (or (plist-get order :ref) "--")))) + (emacs (concat invocation-directory invocation-name)) + ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch" + "--eval" "(byte-recompile-directory \".\" 0 'force)"))) + ((require 'elpaca)) + ((elpaca-generate-autoloads "elpaca" repo))) + (progn (message "%s" (buffer-string)) (kill-buffer buffer)) + (error "%s" (with-current-buffer buffer (buffer-string)))) + ((error) (warn "%s" err) (delete-directory repo 'recursive)))) + (unless (require 'elpaca-autoloads nil t) + (require 'elpaca) + (elpaca-generate-autoloads "elpaca" repo) + (load "./elpaca-autoloads"))) +(add-hook 'after-init-hook #'elpaca-process-queues) +(elpaca `(,@elpaca-order)) +#+END_SRC + +Note that disabling the built-in =package.el= is in =early-init.el=, which also includes setting of frame size and others. + +Enable =use-package= for elpaca and load my package definitions in packages.org +#+BEGIN_SRC emacs-lisp :tangle yes +;; Install use-package support +(elpaca elpaca-use-package + ;; Enable :elpaca use-package keyword. + (elpaca-use-package-mode) + ;; Assume :elpaca t unless otherwise specified. + (setq elpaca-use-package-by-default t)) + +;; Block until current queue processed. +(elpaca-wait) + +;;When installing a package which modifies a form used at the top-level +;;(e.g. a package which adds a use-package key word), +;;use `elpaca-wait' to block until that package has been installed/configured. +;;For example: +;;(use-package general :demand t) +;;(elpaca-wait) + +(load (expand-file-name "packages.el" user-emacs-directory)) +#+END_SRC + +Below is useful when elpaca installs a package for the first time, and I passed my org literate config files from calling emacs, which would have already been opened, this prevents the right hooks from packages to be loaded; hence I should source my packages config again. + +TODO: doesn't seem to work if called interactively, but if I'm here and use =C-x C-e= on the =( load ...)= call it works -- doesn't trigger elpaca? + +#+BEGIN_SRC emacs-lisp :tangle yes +(defun ./reload-packages.el () + "Source packages.el again" + (interactive) + (load (expand-file-name "packages.el" user-emacs-directory))) +#+END_SRC + diff --git a/.config/emacs/packages.org b/.config/emacs/packages.org new file mode 100644 index 0000000..4399707 --- /dev/null +++ b/.config/emacs/packages.org @@ -0,0 +1,647 @@ +#+title: Packages.El Literate +:PROPERTIES: +:tangle: ~/.config/emacsd/packages.el +:END: +#+auto_tangle: t + +Helper variables adopted from Doom Emacs I'm not sure if I'll ever use. + +#+BEGIN_SRC emacs-lisp :tangle yes +(defconst IS-MAC (eq system-type 'darwin)) +(defconst IS-LINUX (memq system-type '(gnu gnu/linux gnu/kfreebsd berkeley-unix))) +(defconst IS-WINDOWS (memq system-type '(cygwin windows-nt ms-dos))) +(defconst IS-BSD (memq system-type '(darwin berkeley-unix gnu/kfreebsd))) +(defconst HAS-EMACS28+ (> emacs-major-version 27)) +(defconst HAS-EMACS29+ (> emacs-major-version 28)) +(defconst HAS-DYNMODULES (featurep 'dynamic-modules)) +(defconst HAS-NATIVECOMP (featurep 'native-compile)) +#+END_SRC + +TODO: autoload emoji + +#+BEGIN_SRC emacs-lisp :tangle yes +;; FIXME: Doesn't work +(use-package diminish + :demand t + :init + (diminish 'buffer-face-mode) + (diminish 'org-auto-tangle-mode) + (diminish 'eldoc-mode) + (diminish 'auto-revert-mode) + (diminish 'visual-line-mode) + (diminish 'org-indent-mode) + (diminish 'subword-mode) +) +#+END_SRC + +* Theme + +The chosen theme has partial zenburn vibes (orange) but less brown. + +NGL it's so cute. Primary accent is like light brownish orange yet user-interaction accents use pink. :p + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package timu-spacegrey-theme + :after (org corfu vertico) + :config + ;;(load-theme 'modus-vivendi t) + (load-theme 'timu-spacegrey t) + + (defface ./theme-completion-popup + '((t :inherit 'fixed-pitch)) + "Face for completion popup.") + (defface ./theme-completion-selected + '((t :background "gray25" :weight normal)) + "Face for selected completion item.") + (set-face-attribute 'corfu-default nil :inherit './theme-completion-popup) + (set-face-attribute 'corfu-current nil :inherit './theme-completion-selected :weight 'normal) + (set-face-attribute 'corfu-bar nil :background "gray40") + (setq corfu-bar-width 0.8) + (set-face-attribute 'vertico-current nil :inherit './theme-completion-selected) + (set-face-attribute 'completions-first-difference nil :weight 'normal) + ;;(set-face-attribute 'line-number nil :background "bg") + ;; Color from modulus vivendi + (set-face-attribute 'show-paren-match nil :background "#6f3355") + (set-face-attribute 'cursor nil :background "textcolor") + + :init + (setq timu-spacegrey-mode-line-border t) + (setq timu-spacegrey-org-intense-colors t + timu-spacegrey-scale-org-document-title 1.7 + timu-spacegrey-scale-org-document-info 1.4 + timu-spacegrey-scale-org-level-1 1.6 + timu-spacegrey-scale-org-level-2 1.3 + timu-spacegrey-scale-org-level-3 1.2) +) +#+END_SRC + +XXX: Somehow putting the org scale settings in =:init= works? And putting it in =:config= doesn't work?! + +* Tab bar + +https://www.gnu.org/software/emacs/manual/html_node/emacs/Tab-Bars.html + +This makes the tabs in the tab bar fill the entire frame width, similar to qutebrowser. + +#+BEGIN_SRC emacs-lisp :tangle yes +(setq tab-bar-auto-width-max nil) +#+END_SRC + +Go to =*scratch*= buffer when opening new tabs, like browsers. I guess! + +#+BEGIN_SRC emacs-lisp :tangle yes +(setq tab-bar-new-tab-choice "*scratch*") +#+END_SRC + +Slightly more contrast + +#+BEGIN_SRC emacs-lisp :tangle yes +;; FIXME: Doesn't work +(set-face-attribute 'tab-bar-tab-inactive nil :background "textBackgroundColor") +#+END_SRC + +Tabs in emacs appears to be similar to Vim, where each tab can hold window split layouts. + +** Default key-binds +Tab bar keys have prefix =C-x t=, use which-key to explore the options from there. + +Switching tabs can be done with =C-TAB= and =S-C-TAB= + +* Evil +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package evil + :demand t + :init + (setq evil-search-module 'evil-search) + :config + (setq evil-ex-search-vim-style-regexp t + evil-ex-visual-char-range t ; column range for ex commands + evil-mode-line-format 'nil + ;; more vim-like behavior + evil-symbol-word-search t + ;; if the current state is obvious from the cursor's color/shape, then + ;; we won't need superfluous indicators to do it instead. + evil-default-cursor 'box + evil-normal-state-cursor 'box + ;;evil-emacs-state-cursor '(box +evil-emacs-cursor-fn) + evil-insert-state-cursor 'bar + evil-visual-state-cursor 'hollow + ;; Only do highlighting in selected window so that Emacs has less work + ;; to do highlighting them all. + evil-ex-interactive-search-highlight 'selected-window + ;; It's infuriating that innocuous "beginning of line" or "end of line" + ;; errors will abort macros, so suppress them: + evil-kbd-macro-suppress-motion-error t + ;; Adopt vim's C-u and C-d scrolling + evil-want-C-u-scroll t + evil-visual-update-x-selection-p nil + ;; Set < and > to shifting 2 spaces, this allows adding up shifts to do 4 spaces. + evil-shift-width 2 + ) + ;; REVIEW: Is this needed if evil-redo-function is set? + (setq evil-undo-system 'undo-redo) ;; 'undo-redo from Emacs 28 + (setq evil-undo-function 'undo) + (setq evil-redo-function 'undo-redo) + + ;; Don't put vim yanks into system clipboard + ;; But use shift C-v / C-c to paste/copy from system clipboard instead + (setq select-enable-clipboard nil) + (global-set-key (kbd "S-C-c") #'clipboard-kill-ring-save) + (global-set-key (kbd "S-C-v") #'clipboard-yank) + + (global-set-key (kbd "") 'keyboard-escape-quit) + + (evil-mode 1) + (defun ./evil-off () + "Call `turn-off-evil-mode' and show a message" + (interactive) + (turn-off-evil-mode) + (message "Evil mode is turned off")) + + :hook + (elpaca-ui-mode . (lambda () (evil-insert-state 1))) + ) +#+END_SRC + +Turning off evil mode doesn't seem to work so for elpaca hook I decided to just enter insert instead. + +* Misc + +Other plugins (or apps) with not that much configuration. + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package elpher) +;; Seems to be having problems with eww for elpaca +;;(use-package eww) +(use-package imenu-list + :config + (setq imenu-list-auto-resize t) + ;; Auto-update Ilist buffer + :hook (imenu-list-major-mode . (lambda () + (imenu-list-minor-mode 1) + (visual-line-mode 1) ;; REVIEW + (display-line-numbers-mode -1) + (evil-insert-state 1)))) + +(use-package math-symbol-lists + :after cape + :config + ;; This is actually for C-\, then select input "math", + ;; then the Ω will show in the status bar. + (quail-define-package "math" "UTF-8" "Ω" t) + ;; (quail-define-rules ; add whatever extra rules you want to define here... + ;; ("\\from" #X2190) + ;; ("\\to" #X2192) + ;; ("\\lhd" #X22B2) + ;; ("\\rhd" #X22B3) + ;; ("\\unlhd" #X22B4) + ;; ("\\unrhd" #X22B5)) + (mapc (lambda (x) + (if (cddr x) + (quail-defrule (cadr x) (car (cddr x))))) + (append math-symbol-list-basic math-symbol-list-extended)) + ) +#+END_SRC + +Maybe I'll figure out a better way to organize list of modes where display-line-numbers-mode should be disabled. + +#+BEGIN_SRC emacs-lisp :tangle no +;; (use-package help +;; :elpaca nil +;; :hook +;; ((help-mode Custom-mode) . (lambda () (display-line-numbers-mode -1))) +;; ) +#+END_SRC + +Dang Custom-mode is actually capitalized + +** Minibuffer + +Enjoy emacs' editting key chords while there's still a glimmer of space in your emacs that forces you to use it, child. + +#+BEGIN_SRC emacs-lisp :tangle yes +(add-hook 'minibuffer-setup-hook (lambda () (setq cursor-type 'bar))) +(add-hook 'minibuffer-exit-hook (lambda () (setq cursor-type 'box))) +#+END_SRC + + +** Org auto tangle + +*Especially* useful for my literate emacs config. + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package org-auto-tangle + :defer t + :hook (org-mode . org-auto-tangle-mode) + :config + (setq org-auto-tangle-babel-safelist '( + "~/.config/emacsd/packages.el" + "~/.config/emacsd/init.el"))) +#+END_SRC + + +** Wrap region + +This plugin gives you true IDE-like behaviour of selecting some text, press ="= then it'll wrap your selection with quotes. + +It enables this for quotes and brackets by default, below I've added some more useful wrappers, some of which are also suggested from the wrap region README. + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package wrap-region + :config + (wrap-region-add-wrappers + '(("/* " " */" "#" (java-mode javascript-mode css-mode)) + ("`" "`" nil (markdown-mode org-mode)) + ("=" "=" nil (org-mode)) + ("~" "~" nil (org-mode)) + ("*" "*" nil (markdown-mode org-mode)))) + :hook + ((org-mode markdown-mode) . wrap-region-mode) +) +#+END_SRC + +** Magit + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package magit) +#+END_SRC + +** Breadcrumb + +By the owner of both eglot and yasnippet: breadcrumb context in your headerline that uses project.el or imenu in that order! + +And yes you can even click on the breadcrumb components to jump to things like imenu. + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package breadcrumb + :diminish breadcrumb-mode + :init + (breadcrumb-mode 1)) +#+END_SRC + + +* Vertico + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package vertico + :init + (vertico-mode) + ;; Grow and shrink the Vertico minibuffer + (setq vertico-resize t) + ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. + (setq vertico-cycle t) + ) +;; Use the `orderless' completion style. Additionally enable +;; `partial-completion' for file path expansion. `partial-completion' is +;; important for wildcard support. Multiple files can be opened at once +;; with `find-file' if you enter a wildcard. You may also give the +;; `initials' completion style a try. +(use-package orderless + :init + (setq completion-styles '(orderless) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) +;; Persist history over Emacs restarts. Vertico sorts by history position. +(use-package savehist + :elpaca nil + :init + (savehist-mode)) +;; Pasted from vertico +(use-package emacs + :elpaca nil + :init + ;; Add prompt indicator to `completing-read-multiple'. + ;; Alternatively try `consult-completing-read-multiple'. + (defun crm-indicator (args) + (cons (concat "[CRM] " (car args)) (cdr args))) + (advice-add #'completing-read-multiple :filter-args #'crm-indicator) + ;; Do not allow the cursor in the minibuffer prompt + (setq minibuffer-prompt-properties + '(read-only t cursor-intangible t face minibuffer-prompt)) + (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) + ;; Emacs 28: Hide commands in M-x which do not work in the current mode. + ;; Vertico commands are hidden in normal buffers. + ;; (setq read-extended-command-predicate + ;; #'command-completion-default-include-p) + ;; Enable recursive minibuffers + (setq enable-recursive-minibuffers t) + ;; From corfu + ;; TAB cycle if there are only few candidates + (setq completion-cycle-threshold 3) + + ;; Emacs 28: Hide commands in M-x which do not apply to the current mode. + ;; Corfu commands are hidden, since they are not supposed to be used via M-x. + ;; (setq read-extended-command-predicate + ;; #'command-completion-default-include-p) +) +#+END_SRC + +Marginalia shows description of each candidate in minibuffer completion next to candidates. +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package marginalia + :diminish + :config + (setq marginalia-annotators '(marginalia-annotators-heavy marginalia-annotators-light nil)) + (marginalia-mode 1) +) +#+END_SRC + + +* Consult + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package consult + :config + (global-set-key (kbd "C-s") 'consult-line) + (global-set-key (kbd "C-c g") 'consult-org-heading) + (global-set-key (kbd "C-x C-b") 'consult-buffer) + (define-key minibuffer-local-map (kbd "C-r") 'consult-history) + + (setq completion-in-region-function #'consult-completion-in-region) +) +#+END_SRC + + +* Corfu + +Note that some color settings are set in [[Theme]] + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package corfu + :custom + (corfu-cycle t) ;; Enable cycling for `corfu-next/previous' + ;; Default is M-SPC, if M-SPC is bound like I have on my Mac (Alfred) S-M-SPC also works + ;;(corfu-separator ?\s) ;; Orderless separator + ;; separator: Quit at boundary if no `corfu-separator' inserted + (corfu-quit-at-boundary 'separator) + ;; separator: only stay alive if no match and `corfu-separator' inserted + (corfu-quit-no-match 'separator) + ;; Don't change what I typed to what I selected when previewing completions + (corfu-preview-current nil) + (corfu-preselect 'first) + ;; Default = #'insert. Options: quit, nil + ;;(corfu-on-exact-match nil) + ;; Prevent last/first item being hidden behind windows + ;; FIXME: Doesn't work + (corfu-scroll-margin 2) + (corfu-right-margin-width 2) + + ;; Enable Corfu only for certain modes. + ;; :hook ((prog-mode . corfu-mode) + ;; (shell-mode . corfu-mode) + ;; (eshell-mode . corfu-mode)) + + :custom-face + (corfu-border ((t (:background "slate gray" :weight bold)))) + + :init + ;; Recommended: Enable Corfu globally. + ;; This is recommended since Dabbrev can be used globally (M-/). + ;; See also `global-corfu-modes'. + (global-corfu-mode) + (corfu-popupinfo-mode 1) + + :config + (defun corfu-enable-always-in-minibuffer () + "Enable Corfu in the minibuffer if Vertico/Mct are not active." + (unless (or (bound-and-true-p mct--active) + (bound-and-true-p vertico--input) + (eq (current-local-map) read-passwd-map)) + ;; (setq-local corfu-auto nil) ;; Enable/disable auto completion + (setq-local corfu-echo-delay nil ;; Disable automatic echo and popup + corfu-popupinfo-delay '(0 . 0)) ;; Use popupinfo in minibuffer too, why not? + (corfu-mode 1))) + (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1) + + (setq corfu-popupinfo-delay '(0 . 0)) +) +#+END_SRC + +** Kind-icon + Corfu + +This is like one of those (few) times that I've cherished Custom's convenience. + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package kind-icon + :after corfu + :custom + (kind-icon-mapping ; These are fetched (and cached) from pictogrammers.com/library/mdi + '((array "ar" :icon "code-brackets" :face font-lock-type-face) + (boolean "b" :icon "circle-half-full" :face font-lock-builtin-face) + (class "C" :icon "view-grid-plus-outline" :face font-lock-type-face) + (color "#" :icon "palette" :face success) + (command ">_" :icon "code-greater-than" :face default) + (constant "c$" :icon "lock-remove-outline" :face font-lock-constant-face) + (constructor "c+" :icon "table-column-plus-after" :face font-lock-function-name-face) + (enummember "em" :icon "order-bool-ascending-variant" :face font-lock-builtin-face) + (enum-member "em" :icon "order-bool-ascending-variant" :face font-lock-builtin-face) + (enum "e" :icon "format-list-bulleted-square" :face font-lock-builtin-face) + (event "ev" :icon "lightning-bolt-outline" :face font-lock-warning-face) + (field "fd" :icon "application-braces-outline" :face font-lock-variable-name-face) + (file "F" :icon "file-document-outline" :face font-lock-string-face) + (folder "D" :icon "folder" :face font-lock-doc-face) + (interface "if" :icon "application-brackets-outline" :face font-lock-type-face) + (keyword "kw" :icon "key-variant" :face font-lock-keyword-face) + (macro "mc" :icon "lambda" :face font-lock-keyword-face) + (magic "ma" :icon "auto-fix" :face font-lock-builtin-face) + (method "m" :icon "function-variant" :face font-lock-function-name-face) + (function "f" :icon "function" :face font-lock-function-name-face) + (module "mo" :icon "package-variant-closed" :face font-lock-preprocessor-face) + (numeric "0" :icon "numeric" :face font-lock-builtin-face) + (operator "÷" :icon "division" :face font-lock-comment-delimiter-face) + (param "pa" :icon "cog-outline" :face default) + (property "pr" :icon "wrench" :face font-lock-variable-name-face) + (reference "rf" :icon "library" :face font-lock-variable-name-face) + (snippet "S" :icon "note-text-outline" :face font-lock-string-face) + (string "\"" :icon "text-box" :face font-lock-string-face) + (struct "{}" :icon "code-braces" :face font-lock-variable-name-face) + (text "" :icon "text-short" :face font-lock-doc-face) + (typeparameter "tp" :icon "format-list-bulleted-type" :face font-lock-type-face) + (type-parameter "tp" :icon "format-list-bulleted-type" :face font-lock-type-face) + (unit "un" :icon "square-rounded-outline" :face font-lock-constant-face) + (value "va" :icon "plus-circle-outline" :face font-lock-builtin-face) + (variable "v" :icon "variable" :face font-lock-variable-name-face) + (t "." :icon "crosshairs-question" :face font-lock-warning-face))) + (kind-icon-blend-background nil) + :custom-face + (kind-icon-default-face ((t (:background nil)))) + + :config + ;;(setq kind-icon-default-face 'corfu-default) ; to compute blended backgrounds correctly + (setq kind-icon-use-icons nil) + (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)) +#+END_SRC + +Note on "use-icons": Kind-icon + Corfu does not support highlighting the icon portion for completion current selection popup. After digging into Emacs SVG a little I did not find an easy way to foce svg-lib to fetch transparent icons, even if that could work, I don't think emacs can handle dynamic icons properly anyway, I believe it will set the background to be the frame background color, so when current selection arrives at a given icon, the "transparent" icon's background would not change accordingly. + +Using text icons allows the kind-icon part to also be highlighted by corfu-current highlightor. + +According to jdsmith Company achieves what I want, but it would downloaded two background colors for each icon (one for unselected, one for selected). + +It's sad that Emacs being a graphical program does not (ATM) support SVGs well. It was literally only until Emacs 29 that frame's alpha-background, and SVG scaling (on Mac) is supported properly. + +** Cape + Corfu + +With references from System Crafter's crafted-emacs configuration + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package cape + ;;:after math-symbol-lists + ;;:elpaca (:repo "~/projects/cape/") + :elpaca (:repo "hedyhli/cape") + ;;:defer t + :config + ;; Add useful defaults completion sources from cape + ;; (add-to-list 'completion-at-point-functions #'cape-file) + ;; ;;(add-to-list 'completion-at-point-functions #'cape-dabbrev) + (add-to-list 'completion-at-point-functions #'cape-tex) + (add-to-list 'completion-at-point-functions #'cape-emoji) + + ;; Silence the pcomplete capf, no errors or messages! + ;; Important for corfu + (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent) + + ;; Ensure that pcomplete does not write to the buffer + ;; and behaves as a pure `completion-at-point-function'. + (advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify) + + (define-key evil-insert-state-map (kbd "C-x C-f") 'cape-file) + (define-key evil-insert-state-map (kbd "C-x C-d") 'cape-dict) + (define-key evil-insert-state-map (kbd "C-x C-w") 'cape-dabbrev) + ;; (define-key evil-insert-state-map (kbd "C-x C-$") (cape-company-to-capf #'company-math-symbols-unicode)) + ;; (define-key evil-insert-state-map (kbd "C-x C-:") (cape-company-to-capf #'company-emoji)) + + :hook (eshell-mode-hook . (lambda () (setq-local corfu-quit-at-boundary t + corfu-quit-no-match t + corfu-auto nil) + (corfu-mode))) +) +#+END_SRC + +I disabled adding dabbrev to CAPF to prevent =corfu-candidate-overlay= (see below) from suggesting arbitrary text completions when I'm in comments or strings or whatever. It's annoying. + +** Corfu Candidate Overlay + +It's like how copilot gives you a completion after your cursor... but this is corfu! (first candidate) + +Also like fish's autosuggestion. + + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package corfu-candidate-overlay + :config + (corfu-candidate-overlay-mode 1) ;; This is global + (set-face-attribute 'corfu-candidate-overlay-face nil :foreground "dim grey") + ;; Use TAB to accept a completion, how cool is that! + (define-key evil-insert-state-map (kbd "TAB") 'corfu-candidate-overlay-complete-at-point) +) +#+END_SRC + + +* Which-Key + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package which-key + :diminish + :config + (which-key-setup-side-window-right) + (which-key-mode 1)) +#+END_SRC + + +* Org + +#+BEGIN_SRC emacs-lisp :tangle yes + (use-package org + :elpaca nil + :config + ;; Enable indenting paragraphs under headings by default + (setq org-startup-indented t) + ;; Don't indent stuff in SRC. What's the point (defaulted to 2 spaces) + (setq org-edit-src-content-indentation 0) + + ;; Indent sub-list items + (setq org-list-indent-offset 2) + + (custom-theme-set-faces + 'user + '(org-block ((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))))) + '(org-indent ((t (:inherit (org-hide fixed-pitch))))) + '(org-link ((t (:foreground "deep sky blue" :underline t)))) + '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch))))) + '(org-property-value ((t (:inherit fixed-pitch))) t) + '(org-block-begin-line ((t (:inherit (font-lock-comment-face fixed-pitch)))) t) + '(org-block-end-line ((t (:inherit (font-lock-comment-face fixed-pitch)))) t) + '(org-drawer ((t (:inherit fixed-pitch))) t) + '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))) + '(org-table ((t (:inherit fixed-pitch)))) + '(org-tag ((t (:inherit (shadow fixed-pitch) :weight bold :height 0.8)))) + '(org-verbatim ((t (:inherit (shadow fixed-pitch)))))) + + :hook + (org-mode . (lambda () + (visual-line-mode 1) + (variable-pitch-mode) + (display-line-numbers-mode -1))) + ) +#+END_SRC + +Org superstar is like org-bullets but with additional customizations as well as styling plain lists + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package org-superstar + :config + (setq org-superstar-configure-like-org-bullets t) + :hook + (org-mode . (lambda () (org-superstar-mode 1)))) +#+END_SRC + +* Eglot & tree sitter + +#+BEGIN_SRC emacs-lisp :tangle yes +(use-package eglot + :elpaca nil + :defer t + :hook + ((python-ts-mode go-ts-mode) . eglot-ensure) +) +#+END_SRC + +#+BEGIN_SRC emacs-lisp :tangle yes +;; Open python files in tree-sitter mode. +(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode)) +(add-to-list 'auto-mode-alist + '("\\.go\\'" . (lambda () + (go-ts-mode) + ))) +(add-to-list 'auto-mode-alist + '("go.mod\\'" . (lambda () + (go-mod-ts-mode) + ))) +#+END_SRC + +* Modules + +The function used is defined in init.el + +#+BEGIN_SRC emacs-lisp :tangle yes +(./load-directory (concat user-emacs-directory "modules/")) +#+END_SRC + +* Diminish +Diminish allows us to use minor modes without showing it. + +Calling =diminish= to specify the mode to hide, (or specify 2nd argument for the alternative display text). + +#+BEGIN_SRC emacs-lisp :tangle no +(diminish 'buffer-face-mode) +(diminish 'org-auto-tangle-mode) +(diminish 'eldoc-mode) +(diminish 'auto-revert-mode) +(diminish 'visual-line-mode) +(diminish 'org-indent-mode) +(diminish 'subword-mode) +#+END_SRC diff --git a/.config/emacsd/init.el b/.config/emacsd/init.el deleted file mode 100644 index c325472..0000000 --- a/.config/emacsd/init.el +++ /dev/null @@ -1,52 +0,0 @@ -(setq package-enable-at-startup nil) -(setq create-lockfiles nil) - -;; Display -(set-face-attribute 'default nil :height 160) - -;; I think this saves the last cursor pos or something -(require 'saveplace) -(setq-default save-place t) -(setq save-place-file (expand-file-name ".places" user-emacs-directory)) - -;; Some better defaults? -(setq make-backup-files nil) -(setq auto-save-default nil) -(setq-default major-mode 'text-mode) -(setq sentence-end-double-space nil) - -;; Always tabs except for *.go? -;; TODO: set up language mode packages -(setq-default c-basic-offset 4 - tab-width 4 - indent-tabs-mode nil) -;; Some modes -(recentf-mode 1) -(show-paren-mode 1) -(setq electric-pair-inhibit-predicate 'electric-pair-conservative-inhibit) -(electric-pair-mode 1) - -;; IDK -(add-hook 'prog-mode-hook #'subword-mode) -(add-hook 'minibuffer-setup-hook #'subword-mode) - -;; elisp -(add-hook 'emacs-lisp-mode-hook - (lambda () - (local-set-key (kbd "C-c C-x") #'ielm) - (local-set-key (kbd "C-c C-c") #'eval-defun) - (local-set-key (kbd "C-c C-b") #'eval-buffer))) - -(load (expand-file-name "packages.el" user-emacs-directory)) -(custom-set-variables - ;; custom-set-variables was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - '(warning-suppress-types '((comp) (comp)))) -(custom-set-faces - ;; custom-set-faces was added by Custom. - ;; If you edit it by hand, you could mess it up, so be careful. - ;; Your init file should contain only one such instance. - ;; If there is more than one, they won't work right. - ) diff --git a/.config/emacsd/modules/init-highlight.el b/.config/emacsd/modules/init-highlight.el deleted file mode 100644 index 94454cb..0000000 --- a/.config/emacsd/modules/init-highlight.el +++ /dev/null @@ -1,102 +0,0 @@ -;;; init-highlight.el --- Highlighting stuff -;;; Commentary: -;; Highlighting symbols, indentation, brackets, todo - -;;; Code: - -;; TODO: do I need hl-line package?? - -;; Highlight indentions -(use-package highlight-indent-guides - :straight t - :diminish - :hook ((prog-mode yaml-mode) . highlight-indent-guides-mode) - :init (setq highlight-indent-guides-method 'character - highlight-indent-guides-responsive 'top - highlight-indent-guides-suppress-auto-error t) - :config - (with-no-warnings - ;; Don't display first level of indentation - (defun my-indent-guides-for-all-but-first-column (level responsive display) - (unless (< level 1) - (highlight-indent-guides--highlighter-default level responsive display))) - (setq highlight-indent-guides-highlighter-function - #'my-indent-guides-for-all-but-first-column) - - ;; Disable in `macrostep' expanding - (with-eval-after-load 'macrostep - (advice-add #'macrostep-expand - :after (lambda (&rest _) - (when highlight-indent-guides-mode - (highlight-indent-guides-mode -1)))) - (advice-add #'macrostep-collapse - :after (lambda (&rest _) - (when (derived-mode-p 'prog-mode 'yaml-mode) - (highlight-indent-guides-mode 1))))) - - ;; Don't display indentations in `swiper' - ;; https://github.com/DarthFennec/highlight-indent-guides/issues/40 - (with-eval-after-load 'ivy - (defun my-ivy-cleanup-indentation (str) - "Clean up indentation highlighting in ivy minibuffer." - (let ((pos 0) - (next 0) - (limit (length str)) - (prop 'highlight-indent-guides-prop)) - (while (and pos next) - (setq next (text-property-not-all pos limit prop nil str)) - (when next - (setq pos (text-property-any next limit prop nil str)) - (ignore-errors - (remove-text-properties next pos '(display nil face nil) str)))))) - (advice-add #'ivy-cleanup-string :after #'my-ivy-cleanup-indentation)))) - - -;; Colorize color names in buffers -(use-package rainbow-mode - :straight t - :diminish - :bind (:map special-mode-map - ("w" . rainbow-mode)) - :hook ((html-mode php-mode) . rainbow-mode) - :config - (with-no-warnings - ;; HACK: Use overlay instead of text properties to override `hl-line' faces. - ;; @see https://emacs.stackexchange.com/questions/36420 - (defun my-rainbow-colorize-match (color &optional match) - (let* ((match (or match 0)) - (ov (make-overlay (match-beginning match) (match-end match)))) - (overlay-put ov 'ovrainbow t) - (overlay-put ov 'face `((:foreground ,(if (> 0.5 (rainbow-x-color-luminance color)) - "white" "black")) - (:background ,color))))) - (advice-add #'rainbow-colorize-match :override #'my-rainbow-colorize-match) - - (defun my-rainbow-clear-overlays () - "Clear all rainbow overlays." - (remove-overlays (point-min) (point-max) 'ovrainbow t)) - (advice-add #'rainbow-turn-off :after #'my-rainbow-clear-overlays))) - -;; Highlight brackets according to their depth -(use-package rainbow-delimiters - :straight t - :hook (prog-mode . rainbow-delimiters-mode)) - -;; Highlight TODO and similar keywords in comments and strings -(use-package hl-todo - :straight t - :bind (:map hl-todo-mode-map - ([C-f3] . hl-todo-occur) - ("C-c t p" . hl-todo-previous) - ("C-c t n" . hl-todo-next) - ("C-c t o" . hl-todo-occur)) - ;;:hook (after-init . global-hl-todo-mode) - ;; :config - ;; (dolist (keyword '("BUG" "DEFECT" "ISSUE")) - ;; (cl-pushnew `(,keyword . ,(face-foreground 'error)) hl-todo-keyword-faces)) - ;; (dolist (keyword '("WORKAROUND" "HACK" "TRICK")) - ;; (cl-pushnew `(,keyword . ,(face-foreground 'warning)) hl-todo-keyword-faces))) - ) - -(provide 'init-highlight) -;;; init-highlight.el ends here diff --git a/.config/emacsd/packages.el b/.config/emacsd/packages.el deleted file mode 100644 index b3eee47..0000000 --- a/.config/emacsd/packages.el +++ /dev/null @@ -1,99 +0,0 @@ -;;; straight -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (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 'nomessage)) - -(straight-use-package 'use-package) -(straight-use-package 'zenburn-theme) -(use-package evil - :straight t) -(straight-use-package 'elpher) -(straight-use-package 'eww) - -;; vertico -;; Enable vertico -(use-package vertico - :straight t - :init - (vertico-mode) - ;; Grow and shrink the Vertico minibuffer - (setq vertico-resize t) - ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. - (setq vertico-cycle t) - ) -;; Use the `orderless' completion style. Additionally enable -;; `partial-completion' for file path expansion. `partial-completion' is -;; important for wildcard support. Multiple files can be opened at once -;; with `find-file' if you enter a wildcard. You may also give the -;; `initials' completion style a try. -(use-package orderless - :straight t - :init - (setq completion-styles '(orderless) - completion-category-defaults nil - completion-category-overrides '((file (styles partial-completion))))) -;; Persist history over Emacs restarts. Vertico sorts by history position. -(use-package savehist - :straight t - :init - (savehist-mode)) -;; Pasted from vertico -(use-package emacs - :init - ;; Add prompt indicator to `completing-read-multiple'. - ;; Alternatively try `consult-completing-read-multiple'. - (defun crm-indicator (args) - (cons (concat "[CRM] " (car args)) (cdr args))) - (advice-add #'completing-read-multiple :filter-args #'crm-indicator) - ;; Do not allow the cursor in the minibuffer prompt - (setq minibuffer-prompt-properties - '(read-only t cursor-intangible t face minibuffer-prompt)) - (add-hook 'minibuffer-setup-hook #'cursor-intangible-mode) - ;; Emacs 28: Hide commands in M-x which do not work in the current mode. - ;; Vertico commands are hidden in normal buffers. - ;; (setq read-extended-command-predicate - ;; #'command-completion-default-include-p) - ;; Enable recursive minibuffers - (setq enable-recursive-minibuffers t)) - -(straight-use-package 'diminish) -;; End of straight stuff hopefully - -;; Not using dracula because its background not working -(load-theme 'zenburn t) - -(global-hl-line-mode 1) -(set-face-background hl-line-face "gray13") - -;; Sometimes I disable this so I can experience how inefficient emacs's default -;; editting experience is -(require 'evil) -(evil-mode 1) - -;; Modules -;; Force the load path thing at the head to reduce startup time -;; People have both lisp and site-lisp. what the heck. I'll name it modules -;; just because. -(defun update-load-path (&rest _) - "Update `load-path'." - (dolist (dir '("modules")) - (push (expand-file-name dir user-emacs-directory) load-path))) - -;; I have no idea if I need the add subdirs to load path thingy (see centaur -;; emacs) -(advice-add #'package-initialize :after #'update-load-path) -(update-load-path) -(require 'init-highlight) - - -(use-package imenu-list - :straight t) diff --git a/.emacs-profiles.el b/.emacs-profiles.el index 627b1f7..3ea7ad3 100644 --- a/.emacs-profiles.el +++ b/.emacs-profiles.el @@ -1,4 +1,6 @@ -(("vanilla" . ((user-emacs-directory . "~/.config/emacsd"))) +( + ("vanilla" . ((user-emacs-directory . "~/.config/emacs"))) + ("test" . ((user-emacs-directory . "~/.config/emacstest"))) ("default" . ((user-emacs-directory . "~/.doomemacs") (env . (("EMACSDIR" . "~/.doomemacs") ("DOOMDIR" . "~/.config/doom")))))) diff --git a/.exportenvs b/.exportenvs index 7d0c308..0f19430 100644 --- a/.exportenvs +++ b/.exportenvs @@ -37,3 +37,8 @@ export NVM_DIR="$HOME/.config/nvm" # GPG export PASH_KEYID="F92200AF40D013F0" + +# Ugh +export HOMEBREW_PREFIX="/opt/homebrew" +export HOMEBREW_CELLAR="/opt/homebrew/Cellar" +export HOMEBREW_REPOSITORY="/opt/homebrew"