Eglot and org, org-roam

This commit is contained in:
Joseph Ferano 2023-08-10 11:26:29 +07:00
parent ab7a977c0b
commit ce04e2e77a
3 changed files with 194 additions and 95 deletions

View File

@ -345,23 +345,57 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering
#+end_src
We want to add whatever custom theme we selected to the custom variables since emacs will just
automatically read it on startup but we don't want emacs to add these settings to init.el, which in
our case is worse since we have a literate file. Send all custom variables to ~custom.el~
We want to add whatever custom theme we selected to the custom variables since
emacs will just automatically read it on startup but we don't want emacs to add
these settings to init.el, which in our case is worse since we have a literate
file. Send all custom variables to ~custom.el~
#+begin_src emacs-lisp
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(load custom-file)
#+end_src
Save the chosen theme after picking a new one
I copied this from consult so that I could add the customize-save-variable at
the end, so if I load another emacs process, it can have the same thing.
#+begin_src emacs-lisp
(defun joe/save-current-theme (THEME)
(let ((inhibit-message t)
(message-log-max nil))
(customize-save-variable 'custom-enabled-themes custom-enabled-themes)))
(advice-add 'consult-theme :after #'joe/save-current-theme)
(defun joe/consult-theme (theme)
"Disable current themes and enable THEME from `consult-themes'.
The command supports previewing the currently selected theme."
(interactive
(list
(let* ((regexp (consult--regexp-filter
(mapcar (lambda (x) (if (stringp x) x (format "\\`%s\\'" x)))
consult-themes)))
(avail-themes (seq-filter
(lambda (x) (string-match-p regexp (symbol-name x)))
(cons 'default (custom-available-themes))))
(saved-theme (car custom-enabled-themes)))
(consult--read
(mapcar #'symbol-name avail-themes)
:prompt "Theme: "
:require-match t
:category 'theme
:history 'consult--theme-history
:lookup (lambda (selected &rest _)
(setq selected (and selected (intern-soft selected)))
(or (and selected (car (memq selected avail-themes)))
saved-theme))
:state (lambda (action theme)
(pcase action
('return (consult-theme (or theme saved-theme)))
((and 'preview (guard theme)) (consult-theme theme))))
:default (symbol-name (or saved-theme 'default))))))
(when (eq theme 'default) (setq theme nil))
(unless (eq theme (car custom-enabled-themes))
(mapc #'disable-theme custom-enabled-themes)
(when theme
(if (custom-theme-p theme)
(enable-theme theme)
(load-theme theme :no-confirm))
))
(customize-save-variable 'custom-enabled-themes custom-enabled-themes))
#+end_src
*** Other
@ -755,7 +789,7 @@ weren't working, until I randomly saw this in someone's init.el
(kbd "SPC Bd") 'bookmark-delete
(kbd "SPC mr") 'joe/compile-run
(kbd "SPC mc") 'joe/compile-comp
(kbd "SPC ct") 'consult-theme
(kbd "SPC ct") 'joe/consult-theme
(kbd "SPC cl") 'consult-line
(kbd "SPC ci") 'consult-imenu
(kbd "SPC cy") 'consult-yank-from-kill-ring
@ -953,6 +987,7 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
"^\\*Occur\\*$" occur-mode
"^\\*lsp-help\\*" lsp-help-mode
"^\\*eldoc\\*" special-mode
"^\\*godot.*" godot-mode
"^\\*ert\\*" ert-results-mode
"^\\*HTTP Response\\*" javascript-mode
"^\\*SQL.*" sql-interactive-mode
@ -960,6 +995,7 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
"^\\*cargo-run\\*" cargo-run-mode
"^\\*rustic-compilation\\*" rustic-compilation-mode
"^\\*ansi-term\\*$" term-mode
"^\\*Async Shell Command\\*$" shell-mode
("^\\*Warnings\\*$" . hide)
help-mode
helpful-mode))
@ -1240,6 +1276,7 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really
(with-eval-after-load 'project
(setq project-vc-ignores '("target/" "bin/" "obj/"))
(add-to-list 'project-switch-commands '(magit-project-status "Magit" ?m))
;; TODO: This doesn't start in the correct working directory
(add-to-list 'project-switch-commands '(joe/vterm-here "VTerm" ?s))
(add-to-list 'project-vc-extra-root-markers ".dir-locals.el")
@ -1436,7 +1473,7 @@ When called interactively, prompt for BUFFER."
(global-set-key (kbd "C-. C-l") 'consult-line)
(global-set-key (kbd "C-. C-i") 'consult-imenu)
(global-set-key (kbd "C-. C-t") 'consult-theme)
(global-set-key (kbd "C-. C-t") 'joe/consult-theme)
(global-set-key (kbd "C-. C-r") 'consult-recent-file)
(global-set-key (kbd "C-. C-y") 'consult-yank-from-kill-ring)
@ -1714,6 +1751,7 @@ be kept here commented out in case we want to try it again.
(lambda ()
(define-key vterm-mode-map (kbd "C-c C-x") #'vterm-send-C-x)
(when (boundp 'evil-mode)
(evil-define-key 'insert vterm-mode-map (kbd "C-f") #'vterm-send-C-f)
(evil-define-key 'insert vterm-mode-map (kbd "C-w") #'vterm-send-C-w)
(evil-define-key 'insert vterm-mode-map (kbd "<delete>") #'vterm-send-delete))
(setq-local global-hl-line-mode nil)))
@ -1765,11 +1803,13 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
(evil-define-key 'insert comint-mode-map (kbd "C-n") 'comint-next-input)
(evil-define-key 'insert comint-mode-map (kbd "C-p") 'comint-previous-input))
#+end_src
*** Mono-complete
*** Completion
#+begin_src emacs-lisp
;; (evil-global-set-key 'insert (kbd "C-f") #'mono-complete-expand)
(require 'mono-complete)
(evil-global-set-key 'insert (kbd "M-/") #'mono-complete-expand-or-fallback)
(evil-global-set-key 'insert (kbd "C-f") #'mono-complete-expand-or-fallback)
(setq mono-complete-backends (list 'dabbrev 'filesystem))
(setq mono-complete-backends (list 'capf 'dabbrev 'filesystem))
@ -1784,6 +1824,13 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
:inherit 'shadow)
(mono-complete-mode +1)
(setq completion-in-region-function
(lambda (&rest args)
(apply (if vertico-mode
#'consult-completion-in-region
#'completion--in-region)
args)))
#+end_src
*** Eldoc
#+begin_src emacs-lisp
@ -1794,15 +1841,22 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
*** Eglot
#+begin_src emacs-lisp
(with-eval-after-load 'eglot
(global-eldoc-mode -1)
;; (flymake-mode -1)
;; Disable it completely until we find out how the hell we can toggle it
(setq eglot-stay-out-of '(flymake))
(setq eglot-stay-out-of '())
(setq eldoc-idle-delay 0.15)
;; (setq eglot-stay-out-of '())
;; (add-hook 'eglot-managed-mode-hook (lambda () (flymake-mode -1)))
(when (boundp 'evil-mode)
;; (evil-global-set-key 'normal (kbd "M-d") #'lsp-describe-thing-at-point)
(evil-global-set-key 'normal (kbd "SPC li") 'eglot-inlay-hints-mode)
(evil-global-set-key 'normal (kbd "<leader>cs") 'consult-eglot-symbols)))
(evil-global-set-key 'normal (kbd "SPC cs") 'consult-eglot-symbols)
(evil-global-set-key 'normal (kbd "SPC cr") 'eglot-rename)
(evil-global-set-key 'normal (kbd "SPC ca") 'eglot-code-actions))
;; These don't work
;; (setq flymake-start-on-save-buffer nil)
;; (setq flymake-start-on-flymake-mode nil)
#+end_src
*** COMMENT LSP
#+begin_src emacs-lisp
@ -1911,6 +1965,10 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
(popper-close-latest))))))
(add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err)
#+end_src
*** Godot
#+begin_src emacs-lisp
(require 'gdscript-mode)
#+end_src
** Programming Languages
*** Python
#+begin_src emacs-lisp
@ -1921,6 +1979,7 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
#+end_src>
*** Rust
#+begin_src emacs-lisp
(setq rustic-lsp-setup-p nil)
(require 'rustic)
(require 'ob-rust)
;; Org-Babel
@ -1938,19 +1997,18 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
;; (evcxr-minor-mode)
(electric-pair-local-mode)))
(with-eval-after-load 'rustic
;; Don't autostart
(setq rustic-lsp-setup-p nil)
;; (define-key rustic-mode-map (kbd "<f9>") #'joe/save-then-recompile)
;; (with-eval-after-load 'rustic
;; ;; Don't autostart
;; ;; (define-key rustic-mode-map (kbd "<f9>") #'joe/save-then-recompile)
(setq lsp-rust-analyzer-server-display-inlay-hints t)
(setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "always")
(setq lsp-rust-analyzer-display-chaining-hints t)
(setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names t)
(setq lsp-rust-analyzer-display-closure-return-type-hints t)
(setq lsp-rust-analyzer-display-parameter-hints t)
(setq lsp-rust-analyzer-display-reborrow-hints t)
(setq lsp-rust-analyzer-cargo-watch-command "clippy"))
;; (setq lsp-rust-analyzer-server-display-inlay-hints t)
;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "always")
;; (setq lsp-rust-analyzer-display-chaining-hints t)
;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names t)
;; (setq lsp-rust-analyzer-display-closure-return-type-hints t)
;; (setq lsp-rust-analyzer-display-parameter-hints t)
;; (setq lsp-rust-analyzer-display-reborrow-hints t)
;; (setq lsp-rust-analyzer-cargo-watch-command "clippy"))
#+end_src
*** Elisp
#+begin_src emacs-lisp
@ -2161,7 +2219,7 @@ and there's no need for a middle-man when it's already been implemented.
(defun joe/org-init ()
(setq org-todo-keywords '((sequence "TODO" "IN-PROGRESS" "|" "DONE" "BACKLOG")))
(setq org-agenda-files '("~/todo.org"))
(setq org-agenda-files '("~/Notes/Schedule.org"))
(org-babel-do-load-languages
'org-babel-load-languages
@ -2194,11 +2252,29 @@ and there's no need for a middle-man when it's already been implemented.
(defun joe/org-hook ()
(local-set-key (kbd "C-. C-i") 'consult-org-heading)
(org-fancy-priorities-mode)
(olivetti-mode)
(org-bullets-mode)
(org-indent-mode))
(add-hook 'org-mode-hook 'joe/org-hook)
(require 'org-kanban)
(require 'org-fancy-priorities)
;; (setq org-fancy-priorities-list '("🅰" "🅱" "🅲" "🅳" "🅴"))
;; (setq org-fancy-priorities-list '("⚡" "⬆" "⬇"))
;; (setq org-fancy-priorities-list '("⚡" "⬆" "⬇"))
(setq org-fancy-priorities-list '((?D . "🌙") (?C . "🌇") (?B . "☀️") (?A . "🌄")))
(require 'org-roam)
(setq org-roam-directory "/home/joe/Notes/Roam/")
(setq org-roam-node-display-template (concat "${title:*} "
(propertize "${tags:10}" 'face 'org-tag)))
(org-roam-db-autosync-mode)
(define-key global-map (kbd "C-c n l") #'org-roam-buffer-toggle)
(define-key global-map (kbd "C-c n f") #'org-roam-node-find)
(define-key global-map (kbd "C-c n g") #'org-roam-graph)
(define-key global-map (kbd "C-c n i") #'org-roam-node-insert)
(define-key global-map (kbd "C-c n c") #'org-roam-capture)
(org-roam-setup)
#+end_src
** Magit

View File

@ -40,4 +40,4 @@ SETUVAR fish_pager_color_description:B3A06D\x1eyellow
SETUVAR fish_pager_color_prefix:normal\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
SETUVAR fish_pager_color_selected_background:\x2dr
SETUVAR fish_user_paths:/home/joe/\x2elocal/share/bin/cargo/bin\x1e\x1e/home/joe/\x2elocal/bin
SETUVAR fish_user_paths:/home/joe/\x2elocal/bin/elm\x1e/home/joe/\x2elocal/share/bin/cargo/bin\x1e\x1e/home/joe/\x2elocal/bin

23
.config/keyd/default.conf Normal file
View File

@ -0,0 +1,23 @@
[ids]
*
[global]
overload_tap_timeout = 250
[main]
esc = capslock
capslock = overload(control, esc)
rightalt = layer(rightalt)
rightcontrol = overload(hyper, rightcontrol)
leftcontrol = overload(hyper, leftcontrol)
[hyper:C-M-S-A]
[rightalt:G]
h = left
j = down
k = up
l = right