Compare commits

...

2 Commits

Author SHA1 Message Date
34a5cecc41
oceanic next for vim 2024-12-15 16:09:37 -08:00
c1a05c697e
emacs config 2024-12-15 15:55:35 -08:00
7 changed files with 207 additions and 102 deletions

View File

@ -1,4 +1,4 @@
import = [ general.import = [
"~/.config/alacritty/catppucin-latte.toml", "~/.config/alacritty/catppucin-latte.toml",
"~/.config/alacritty/config.toml" "~/.config/alacritty/config.toml"
] ]

View File

@ -22,6 +22,7 @@
"nvim-tree.lua": { "branch": "master", "commit": "82ab19ebf79c1839d7351f2fed213d1af13a598e" }, "nvim-tree.lua": { "branch": "master", "commit": "82ab19ebf79c1839d7351f2fed213d1af13a598e" },
"nvim-treesitter": { "branch": "master", "commit": "38c12cb9ac8e1c547a8472c87df9e9d7c8b1af0d" }, "nvim-treesitter": { "branch": "master", "commit": "38c12cb9ac8e1c547a8472c87df9e9d7c8b1af0d" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" }, "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"oceanic-next": { "branch": "master", "commit": "09833f72d5ba23de2e8bcae18f479f326f5f677a" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" } "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }
} }

View File

@ -64,7 +64,7 @@ lspconfig.lua_ls.setup {
} }
-- setup multiple servers with same default options -- setup multiple servers with same default options
local servers = { "tsserver", "html", "cssls" } local servers = { "ts_ls", "html", "cssls" }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig[lsp].setup { lspconfig[lsp].setup {

View File

@ -2,6 +2,7 @@ local plugins = {
{ lazy = true, "nvim-lua/plenary.nvim" }, { lazy = true, "nvim-lua/plenary.nvim" },
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 }, { "catppuccin/nvim", name = "catppuccin", priority = 1000 },
{ "mhartington/oceanic-next", name = "oceanic-next", priority = 1000 },
-- file tree -- file tree
{ {

View File

@ -7,13 +7,14 @@ function Set_theme_at(path)
theme = theme:gsub("%s+", "") theme = theme:gsub("%s+", "")
f:close() f:close()
vim.schedule(function() vim.schedule(function()
if (theme == "light") then vim.cmd("colorscheme OceanicNext")
vim.api.nvim_set_option("background", "light") -- if (theme == "light") then
vim.cmd("colorscheme catppuccin-latte") -- vim.api.nvim_set_option("background", "light")
else -- vim.cmd("colorscheme catppuccin-latte")
vim.api.nvim_set_option("background", "dark") -- else
vim.cmd("colorscheme catppuccin-mocha") -- vim.api.nvim_set_option("background", "dark")
end -- vim.cmd("colorscheme catppuccin-mocha")
-- end
end) end)
end end

View File

@ -14,11 +14,41 @@
'("melpa" . "https://melpa.org/packages/") t) '("melpa" . "https://melpa.org/packages/") t)
#+END_SRC #+END_SRC
* General emacs * 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 #+BEGIN_SRC emacs-lisp
(setq ring-bell-function 'ignore) (setq ring-bell-function 'ignore)
#+END_SRC #+END_SRC
** Tab bar mode ** Tab bar mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun my-tabbar-buffer-groups () ;; customize to show all normal files in one group (defun my-tabbar-buffer-groups () ;; customize to show all normal files in one group
@ -34,6 +64,7 @@
tab-width 2 tab-width 2
indent-tabs-mode nil) indent-tabs-mode nil)
#+END_SRC #+END_SRC
** Line numbers ** Line numbers
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq display-line-numbers-type 'relative) (setq display-line-numbers-type 'relative)
@ -50,21 +81,6 @@
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq line-move-visual nil) (setq line-move-visual nil)
#+END_SRC #+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 ** GUI stuff
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(menu-bar-mode -1) (menu-bar-mode -1)
@ -72,6 +88,7 @@
frame-resize-pixelwise t) ;; Use 100% of window space frame-resize-pixelwise t) ;; Use 100% of window space
(defun do-frame-config () (defun do-frame-config ()
(tool-bar-mode -1) ;; System bar (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 (set-fringe-mode '(1 . 1)) ;; Minimize arrows before and after wrapped lines by setting fringe to 1px
(toggle-scroll-bar -1)) (toggle-scroll-bar -1))
@ -91,7 +108,21 @@
(when (memq window-system '(mac ns x)) (when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize))) (exec-path-from-shell-initialize)))
#+END_SRC #+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 * Theming
** Line spacing ** Line spacing
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -103,12 +134,14 @@
#+END_SRC #+END_SRC
** Font ** Font
#+BEGIN_SRC emacs-lisp #+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")) (let ((font "ZedMono Nerd Font-13:style=Regular"))
(set-face-attribute 'default nil :font font) (set-face-attribute 'default nil :font font)
(set-frame-font font nil t)) (set-frame-font font nil t))
#+END_SRC
#+RESULTS:
#+BEGIN_SRC emacs-lisp
;; This assumes you've installed the package via MELPA. ;; This assumes you've installed the package via MELPA.
(use-package ligature (use-package ligature
:config :config
@ -136,28 +169,57 @@
(global-ligature-mode t)) (global-ligature-mode t))
#+END_SRC #+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 ** Catppuccin and theme notify watcher
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package catppuccin-theme (use-package doom-themes
:ensure t) :ensure t
(require 'filenotify) :config
;; Global settings (defaults)
(setq *theme-file* "~/theme") (setq doom-themes-enable-bold t ; if nil, bold is universally disabled
(defun set-system-theme () doom-themes-enable-italic nil) ; if nil, italics is universally disabled
(let ((theme ;; (load-theme 'doom-spacegrey t)
(with-temp-buffer (load-theme 'doom-oceanic-next t)
(insert-file-contents *theme-file*) ;; Enable flashing mode-line on errors
(buffer-string))) (doom-themes-visual-bell-config)
(current-flavor catppuccin-flavor)) ;; Enable custom neotree theme (all-the-icons must be installed!)
(setq catppuccin-flavor (if (string-prefix-p "dark" theme) 'mocha 'latte)) (doom-themes-neotree-config)
(if (not (eq catppuccin-flavor current-flavor)) ;; or for treemacs users
(catppuccin-reload)))) (setq doom-themes-treemacs-theme "doom-atom") ; use "doom-colors" for less minimal icon theme
(doom-themes-treemacs-config)
(set-system-theme) (catppuccin-reload) ;; Corrects (and improves) org-mode's native fontification.
(file-notify-add-watch *theme-file* '(change) (doom-themes-org-config))
#'(lambda (event) (set-system-theme)))
#+END_SRC #+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 ** Doom-modeline
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package doom-modeline (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-postamble nil
org-html-preamble t) org-html-preamble t)
#+END_SRC #+END_SRC
** Roam
#+BEGIN_SRC emacs-lisp
(use-package org-roam
:straight t)
#+END_SRC
** Babel ** Babel
*** Elixir *** Elixir
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -276,25 +343,11 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package magit :ensure t) (use-package magit :ensure t)
#+END_SRC #+END_SRC
** Autocomplete ** Autocomplete
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package auto-complete :ensure t) (use-package auto-complete :ensure t)
(ac-config-default) (ac-config-default)
#+END_SRC #+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 ** Company mode
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package company (use-package company
@ -309,28 +362,69 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~
#+END_SRC #+END_SRC
** LSP Mode ** LSP Mode
#+BEGIN_SRC emacs-lisp #+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 (use-package lsp-mode
:ensure t :ensure t
:init :init
(setq lsp-keymap-prefix "C-c l") (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) (elixir-mode . lsp)
(rust-ts-mode . lsp) (rust-mode . lsp)
(go-ts-mode . lsp) (go-ts-mode . lsp)
(java-mode . lsp)
(php-mode . lsp) (php-mode . lsp)
(c-mode . lsp) (c-mode . lsp)
(typescript-ts-mode . lsp) (typescript-ts-mode . lsp)
(tsx-ts-mode . lsp) (tsx-ts-mode . lsp)
(java-ts-mode . lsp)
(kotlin-ts-mode . lsp)
(lsp-mode . lsp-enable-which-key-integration)) (lsp-mode . lsp-enable-which-key-integration))
:config (progn :config
(lsp-register-custom-settings (setq lsp-ui-doc-enabled nil)
'(("pyls.plugins.pyls_mypy.enabled" t t) (setq read-process-output-max (* 1024 1024))
("pyls.plugins.pyls_mypy.live_mode" nil t) (setq gc-cons-threshold 100000000)
("pyls.plugins.pyls_black.enabled" t t)
("pyls.plugins.pyls_isort.enabled" t t)))) (setq lsp-enable-file-watchers nil)
:commands lsp) :commands lsp)
#+END_SRC #+END_SRC
** Tree-Sitter ** Tree-Sitter
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package treesit-auto (use-package treesit-auto
@ -341,6 +435,19 @@ must run ~(all-the-icons-install-fonts)~ and ~(nerd-fonts-install-fonts)~
(global-treesit-auto-mode)) (global-treesit-auto-mode))
#+END_SRC #+END_SRC
** Languages ** 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 *** Common Lisp
**** Rainbow Parentheses **** Rainbow Parentheses
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -444,14 +551,30 @@ After installing the ~rust-analyzer~, the following can be used:
#+END_SRC #+END_SRC
*** Kotlin *** Kotlin
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package kotlin-mode (add-to-list 'treesit-language-source-alist '(kotlin . ("https://github.com/fwcd/tree-sitter-kotlin")))
:ensure t) (use-package kotlin-ts-mode
:straight (:host gitlab :repo "bricka/emacs-kotlin-ts-mode")
:mode "\\.kt\\'")
#+END_SRC #+END_SRC
*** Java *** Java
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package lsp-java (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 #+END_SRC
*** PHP *** PHP
@ -463,8 +586,9 @@ After installing the ~rust-analyzer~, the following can be used:
** Format All The Buffers ** Format All The Buffers
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package format-all (use-package format-all
:bind (("C-c C-f" . format-all-region))
:ensure t) :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 'astro-ts-mode-hook 'format-all-mode)
(add-hook 'format-all-mode-hook 'format-all-ensure-formatter) (add-hook 'format-all-mode-hook 'format-all-ensure-formatter)
#+END_SRC #+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->" . mc/mark-all-like-this)
("C-c C-SPC" . mc/edit-lines))) ("C-c C-SPC" . mc/edit-lines)))
#+END_SRC #+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

@ -1 +1 @@
Subproject commit 9fc402499bd5d768141585e271c899c5fd3c3a77 Subproject commit 1821e8d5289c2875d8af7654604251e717357242