diff --git a/.emacs.d/settings.org b/.emacs.d/settings.org index b03a12a..f934f0c 100644 --- a/.emacs.d/settings.org +++ b/.emacs.d/settings.org @@ -14,11 +14,41 @@ '("melpa" . "https://melpa.org/packages/") t) #+END_SRC * General emacs -** Bell Mode +** Evil Mode! +#+BEGIN_SRC emacs-lisp + (use-package evil + :init + (setq evil-want-integration t) + (setq evil-want-keybinding nil) + (setq evil-want-C-u-scroll t) + (setq evil-want-C-i-jump t) + (setq evil-shift-width 2) + (setq evil-cross-lines t) + (setq evil-respect-visual-line-mode t) + (setq evil-vsplit-window-below t) + (setq evil-split-window-below t) + (setq evil-undo-system 'undo-redo) + :config + (evil-mode 1) + (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) + + (evil-global-set-key 'motion "j" 'evil-next-visual-line) + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) + + (add-hook 'evil-visual-activate-hook #'(lambda () (global-hl-line-mode 0) (message "Hello visual!"))) + (add-hook 'evil-visual-deactivate-hook #'(lambda () (global-hl-line-mode 1))) + + (setq evil-want-fine-undo t) + (evil-set-initial-state 'messages-buffer-mode 'normal)) +#+END_SRC + +#+RESULTS: +: t + +** Ring Bell Sound #+BEGIN_SRC emacs-lisp (setq ring-bell-function 'ignore) #+END_SRC - ** Tab bar mode #+BEGIN_SRC emacs-lisp (defun my-tabbar-buffer-groups () ;; customize to show all normal files in one group @@ -34,6 +64,7 @@ tab-width 2 indent-tabs-mode nil) #+END_SRC + ** Line numbers #+BEGIN_SRC emacs-lisp (setq display-line-numbers-type 'relative) @@ -50,21 +81,6 @@ #+BEGIN_SRC emacs-lisp (setq line-move-visual nil) #+END_SRC -** Fuzy Wuzzy -#+BEGIN_SRC emacs-lisp - (use-package ivy - :ensure t) - (use-package counsel - :ensure t) - (ivy-mode 1) - (counsel-mode 1) -#+END_SRC - -** Electric Pair Mode -#+BEGIN_SRC emacs-lisp - (electric-pair-mode) - (electric-quote-mode) -#+END_SRC ** GUI stuff #+BEGIN_SRC emacs-lisp (menu-bar-mode -1) @@ -72,6 +88,7 @@ frame-resize-pixelwise t) ;; Use 100% of window space (defun do-frame-config () (tool-bar-mode -1) ;; System bar + (add-to-list 'default-frame-alist '(undecorated . t)) (set-fringe-mode '(1 . 1)) ;; Minimize arrows before and after wrapped lines by setting fringe to 1px (toggle-scroll-bar -1)) @@ -91,7 +108,21 @@ (when (memq window-system '(mac ns x)) (exec-path-from-shell-initialize))) #+END_SRC +** Fuzy Wuzzy +#+BEGIN_SRC emacs-lisp + (use-package ivy + :ensure t) + (use-package counsel + :ensure t) + (ivy-mode 1) + (counsel-mode 1) +#+END_SRC +** Electric Pair Mode +#+BEGIN_SRC emacs-lisp + (electric-pair-mode) + (electric-quote-mode) +#+END_SRC * Theming ** Line spacing #+BEGIN_SRC emacs-lisp @@ -103,12 +134,14 @@ #+END_SRC ** Font #+BEGIN_SRC emacs-lisp - ;; (let ((font "JetBrains Mono-13:style=Regular")) - ;; (set-face-attribute 'default nil :font font) - ;; (set-frame-font font nil t)) (let ((font "ZedMono Nerd Font-13:style=Regular")) (set-face-attribute 'default nil :font font) (set-frame-font font nil t)) +#+END_SRC + +#+RESULTS: + +#+BEGIN_SRC emacs-lisp ;; This assumes you've installed the package via MELPA. (use-package ligature :config @@ -136,28 +169,57 @@ (global-ligature-mode t)) #+END_SRC +** Highlight indent guid +#+BEGIN_SRC emacs-lisp + (use-package :highlight-indent-guides + :ensure t + :config + (add-hook 'prog-mode-hook 'highlight-indent-guides-mode)) +#+END_SRC ** Catppuccin and theme notify watcher #+BEGIN_SRC emacs-lisp - (use-package catppuccin-theme - :ensure t) - (require 'filenotify) - - (setq *theme-file* "~/theme") - (defun set-system-theme () - (let ((theme - (with-temp-buffer - (insert-file-contents *theme-file*) - (buffer-string))) - (current-flavor catppuccin-flavor)) - (setq catppuccin-flavor (if (string-prefix-p "dark" theme) 'mocha 'latte)) - (if (not (eq catppuccin-flavor current-flavor)) - (catppuccin-reload)))) - - (set-system-theme) (catppuccin-reload) - (file-notify-add-watch *theme-file* '(change) - #'(lambda (event) (set-system-theme))) + (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 nil) ; if nil, italics is universally disabled +;; (load-theme 'doom-spacegrey t) + (load-theme 'doom-oceanic-next 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 +#+RESULTS: +: t + +#+BEGIN_SRC emacs-lisp + ;; (use-package catppuccin-theme + ;; :ensure t) + ;; (require 'filenotify) + ;; + ;; (setq *theme-file* "~/theme") + ;; (defun set-system-theme () + ;; (let ((theme + ;; (with-temp-buffer + ;; (insert-file-contents *theme-file*) + ;; (buffer-string))) + ;; (current-flavor catppuccin-flavor)) + ;; (setq catppuccin-flavor (if (string-prefix-p "dark" theme) 'mocha 'latte)) + ;; (if (not (eq catppuccin-flavor current-flavor)) + ;; (catppuccin-reload)))) + ;; + ;; (set-system-theme) + ;; (file-notify-add-watch *theme-file* '(change) + ;; #'(lambda (event) (set-system-theme))) +#+END_SRC ** Doom-modeline #+BEGIN_SRC emacs-lisp (use-package doom-modeline @@ -227,6 +289,11 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~ org-html-postamble nil org-html-preamble t) #+END_SRC +** Roam +#+BEGIN_SRC emacs-lisp + (use-package org-roam + :straight t) +#+END_SRC ** Babel *** Elixir #+BEGIN_SRC emacs-lisp @@ -276,25 +343,11 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~ #+BEGIN_SRC emacs-lisp (use-package magit :ensure t) #+END_SRC - - ** Autocomplete #+BEGIN_SRC emacs-lisp (use-package auto-complete :ensure t) (ac-config-default) #+END_SRC -*** Copilot -#+BEGIN_SRC emacs-lisp - (use-package copilot - :straight (:host github :repo "copilot-emacs/copilot.el" :files ("dist" "*.el")) - :ensure t - :config - (setq copilot-indent-offset-warning-disable t)) - (define-key copilot-completion-map (kbd "C-c c") 'copilot-accept-completion) - (define-key copilot-completion-map (kbd "C-c c") 'copilot-accept-completion) - (add-hook 'prog-mode-hook 'copilot-mode) -#+END_SRC - ** Company mode #+BEGIN_SRC emacs-lisp (use-package company @@ -309,28 +362,69 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~ #+END_SRC ** LSP Mode #+BEGIN_SRC emacs-lisp + (use-package which-key + :ensure t + :init (which-key-mode)) +#+END_SRC + +#+BEGIN_SRC emacs-lisp + (defun lsp-booster--advice-json-parse (old-fn &rest args) + "Try to parse bytecode instead of json." + (or + (when (equal (following-char) ?#) + (let ((bytecode (read (current-buffer)))) + (when (byte-code-function-p bytecode) + (funcall bytecode)))) + (apply old-fn args))) + (advice-add (if (progn (require 'json) + (fboundp 'json-parse-buffer)) + 'json-parse-buffer + 'json-read) + :around + #'lsp-booster--advice-json-parse) + + (defun lsp-booster--advice-final-command (old-fn cmd &optional test?) + "Prepend emacs-lsp-booster command to lsp CMD." + (let ((orig-result (funcall old-fn cmd test?))) + (if (and (not test?) ;; for check lsp-server-present? + (not (file-remote-p default-directory)) ;; see lsp-resolve-final-command, it would add extra shell wrapper + lsp-use-plists + (not (functionp 'json-rpc-connection)) ;; native json-rpc + (executable-find "emacs-lsp-booster")) + (progn + (when-let ((command-from-exec-path (executable-find (car orig-result)))) ;; resolve command from exec-path (in case not found in $PATH) + (setcar orig-result command-from-exec-path)) + (message "Using emacs-lsp-booster for %s!" orig-result) + (cons "emacs-lsp-booster" orig-result)) + orig-result))) + (advice-add 'lsp-resolve-final-command :around #'lsp-booster--advice-final-command) + (use-package company-lsp + :after (lsp-mode company)) (use-package lsp-mode :ensure t :init (setq lsp-keymap-prefix "C-c l") - :hook ((python-ts-mode . lsp) ;; pip install python-lsp-server pyls-black pyls-isort pyls-mypy + (setq lsp-file-watch-threshold 5000) + :hook ((python-ts-mode . lsp) (elixir-mode . lsp) - (rust-ts-mode . lsp) - (go-ts-mode . lsp) - (java-mode . lsp) + (rust-mode . lsp) + (go-ts-mode . lsp) (php-mode . lsp) (c-mode . lsp) - (typescript-ts-mode . lsp) - (tsx-ts-mode . lsp) + (typescript-ts-mode . lsp) + (tsx-ts-mode . lsp) + (java-ts-mode . lsp) + (kotlin-ts-mode . lsp) (lsp-mode . lsp-enable-which-key-integration)) - :config (progn - (lsp-register-custom-settings - '(("pyls.plugins.pyls_mypy.enabled" t t) - ("pyls.plugins.pyls_mypy.live_mode" nil t) - ("pyls.plugins.pyls_black.enabled" t t) - ("pyls.plugins.pyls_isort.enabled" t t)))) + :config + (setq lsp-ui-doc-enabled nil) + (setq read-process-output-max (* 1024 1024)) + (setq gc-cons-threshold 100000000) + + (setq lsp-enable-file-watchers nil) :commands lsp) #+END_SRC + ** Tree-Sitter #+BEGIN_SRC emacs-lisp (use-package treesit-auto @@ -341,6 +435,19 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~ (global-treesit-auto-mode)) #+END_SRC ** Languages +*** Python +#+BEGIN_SRC emacs-lisp + (use-package python + :config + (defun python-info-current-defun () nil)) + (use-package lsp-pyright + :ensure t + :custom (lsp-pyright-langserver-command "pyright") ;; or basedpyright + :hook (python-mode . (lambda () + (require 'lsp-pyright) + (lsp)))) ; or lsp-deferred +#+END_SRC + *** Common Lisp **** Rainbow Parentheses #+BEGIN_SRC emacs-lisp @@ -444,14 +551,30 @@ After installing the ~rust-analyzer~, the following can be used: #+END_SRC *** Kotlin #+BEGIN_SRC emacs-lisp - (use-package kotlin-mode - :ensure t) + (add-to-list 'treesit-language-source-alist '(kotlin . ("https://github.com/fwcd/tree-sitter-kotlin"))) + (use-package kotlin-ts-mode + :straight (:host gitlab :repo "bricka/emacs-kotlin-ts-mode") + :mode "\\.kt\\'") #+END_SRC *** Java #+BEGIN_SRC emacs-lisp (use-package lsp-java - :config (add-hook 'java-mode-hook 'lsp) - :ensure t) + :ensure t + :after lsp-mode + :config + (setq lsp-java-vmargs + (list + "-Xmx4G" + "-XX:+UseG1GC" + "-XX:+UseStringDeduplication" + "-javaagent:/Users/lizhunt/.emacs.d/lombok.jar")) + (add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.bemol\\'") + (setq lsp-java-project-resource-filters ["node_modules" ".metadata" "archetype-resources" "META-INF/maven" "runtime" "env"])) + + (add-hook 'java-ts-mode-hook (lambda () + (setq c-basic-offset 4 + tab-width 4 + indent-tabs-mode nil))) #+END_SRC *** PHP @@ -463,8 +586,9 @@ After installing the ~rust-analyzer~, the following can be used: ** Format All The Buffers #+BEGIN_SRC emacs-lisp (use-package format-all + :bind (("C-c C-f" . format-all-region)) :ensure t) - (add-hook 'prog-mode-hook 'format-all-mode) + ;;(add-hook 'prog-mode-hook 'format-all-mode) (add-hook 'astro-ts-mode-hook 'format-all-mode) (add-hook 'format-all-mode-hook 'format-all-ensure-formatter) #+END_SRC @@ -481,25 +605,3 @@ After installing the ~rust-analyzer~, the following can be used: ("C-c C->" . mc/mark-all-like-this) ("C-c C-SPC" . mc/edit-lines))) #+END_SRC -* Elcord -#+BEGIN_SRC emacs-lisp - (use-package elcord - :config - (setq elcord-idle-message "Idling..." - elcord-idle-timer 300 - elcord-refresh-rate 3) - :ensure t) - (elcord-mode) -#+END_SRC -* Cookbook -#+BEGIN_SRC emacs-lisp - (use-package org-chef - :config - (setq org-capture-templates - '(("c" "Cookbook" entry (file "~/org/cookbook.org") - "%(org-chef-get-recipe-from-url)" - :empty-lines 1) - ("m" "Manual Cookbook" entry (file "~/org/cookbook.org") - "* %^{Recipe title: }\n :PROPERTIES:\n :source-url:\n :servings:\n :prep-time:\n :cook-time:\n :ready-in:\n :END:\n** Ingredients\n %?\n** Directions\n\n"))) - :ensure t) -#+END_SRC diff --git a/src/pikaur b/src/pikaur index 9fc4024..1821e8d 160000 --- a/src/pikaur +++ b/src/pikaur @@ -1 +1 @@ -Subproject commit 9fc402499bd5d768141585e271c899c5fd3c3a77 +Subproject commit 1821e8d5289c2875d8af7654604251e717357242