many updates...

This commit is contained in:
Levi 2024-11-20 08:15:40 +01:00
parent 3a743c894f
commit 41a17231b4
8 changed files with 151 additions and 29 deletions

2
emacs/.dir-locals.el Normal file
View File

@ -0,0 +1,2 @@
((nil (eglot-workspace-configuration . ((gopls . ((staticcheck . t)
(matcher . "CaseSensitive")))))))

View File

@ -22,6 +22,7 @@
(require 'module-apitest)
(require 'module-qt)
(require 'module-eglot)
;; (require 'module-lsp)
(provide 'feature-dev)
;;; feature-dev.el ends here.

View File

@ -74,20 +74,14 @@
(insert "\n\n"))))))))))
(defun my/search-denote-notes ()
"Use consult-ripgrep to search only the Denote metadata index file."
(interactive)
(let* ((index-file my/denote-metadata-index-file)
(default-directory (file-name-directory index-file))
(file-name (file-name-nondirectory index-file))
(consult-ripgrep-args
(concat "rg --null --ignore-case --type org --line-buffered --color=never "
"--max-columns=500 --no-heading --line-number "
"--max-depth 0 "
(shell-quote-argument file-name))))
(if (file-exists-p index-file)
(consult-ripgrep default-directory)
(message "Metadata index file not found: %s" index-file))))
(defun my/search-denote-notes ()
"Use consult-ripgrep to search Denote notes in denote-directory."
(interactive)
(let ((consult-ripgrep-args
"rg --null --ignore-case --type org --line-buffered --color=never --max-columns=500 --no-heading --line-number"))
(if (file-directory-p denote-directory)
(consult-ripgrep denote-directory)
(message "Denote directory not found: %s" denote-directory))))
(global-set-key (kbd "C-x n /") #'my/search-denote-notes))

View File

@ -7,8 +7,26 @@
(require 'module-pkg)
(pkg/require 'eglot)
(pkg/require 'go-mode)
(add-hook 'go-mode-hook 'eglot-ensure)
(add-hook 'c-mode-hook 'eglot-ensure)
(defun eglot-format-buffer-before-save ()
(add-hook 'before-save-hook #'eglot-format-buffer -10 t))
(add-hook 'go-mode-hook #'eglot-format-buffer-before-save)
(setq-default eglot-workspace-configuration
'((:gopls .
((staticcheck . t)
(matcher . "CaseSensitive")))))
(defun go-mode-setup-organize-imports ()
(add-hook 'before-save-hook
(lambda ()
(call-interactively 'eglot-code-action-organize-imports))
nil t))
(add-hook 'go-mode-hook #'go-mode-setup-organize-imports)
(provide 'module-eglot)
;;; module-eglot.el ends here

View File

@ -10,6 +10,15 @@
(pkg/require-defer 'go-mode)
(defun project-find-go-module (dir)
(when-let ((root (locate-dominating-file dir "go.mod")))
(cons 'go-module root)))
(cl-defmethod project-root ((project (head go-module)))
(cdr project))
(add-hook 'project-find-functions #'project-find-go-module)
(with-eval-after-load 'go-mode
(add-to-list 'auto-mode-alist '("\\.go$" . go-mode))
(add-hook 'before-save-hook #'gofmt-before-save))

View File

@ -0,0 +1,94 @@
;;; module-lsp.el --- LSP configuration module -*- lexical-binding: t -*-
;;; Commentary:
;; This module sets up lsp-mode with specific configurations for Please build system
;;; Code:
(require 'lsp-mode)
(require 'lsp-ui)
(require 'which-key)
;; LSP Mode core settings
(setq lsp-keymap-prefix "C-c l")
(setq lsp-idle-delay 0.500)
(setq lsp-log-io nil)
(setq lsp-completion-provider :capf)
(setq lsp-prefer-flymake nil)
;; Please build system specific configurations
(setq lsp-file-watch-ignored-directories
'("[/\\\\]\\.git$"
"[/\\\\]\\.hg$"
"[/\\\\]\\.bzr$"
"[/\\\\]_darcs$"
"[/\\\\]\\.svn$"
"[/\\\\]_FOSSIL_$"
"[/\\\\]\\.idea$"
"[/\\\\]\\.ensime_cache$"
"[/\\\\]\\.eunit$"
"[/\\\\]node_modules$"
"[/\\\\]\\.fslckout$"
"[/\\\\]\\.tox$"
"[/\\\\]\\.stack-work$"
"[/\\\\]\\.bloop$"
"[/\\\\]\\.metals$"
"[/\\\\]target$"
"[/\\\\]\\.ccls-cache$"
"[/\\\\]\\.deps$"
"[/\\\\]build-aux$"
"[/\\\\]autom4te.cache$"
"[/\\\\]\\.reference$"
"[/\\\\]plz-out$")) ;; Add plz-out to ignored directories
;; Increase watch threshold for large Please projects
(setq lsp-file-watch-threshold 10000)
;; LSP UI configurations
(setq lsp-ui-doc-enable t)
(setq lsp-ui-doc-show-with-cursor t)
(setq lsp-ui-doc-position 'at-point)
(setq lsp-ui-doc-delay 0.5)
(setq lsp-ui-sideline-enable t)
(setq lsp-ui-sideline-show-diagnostics t)
(setq lsp-ui-sideline-show-hover t)
(setq lsp-ui-sideline-show-code-actions t)
;; Performance optimizations for large projects
(setq gc-cons-threshold 100000000)
(setq read-process-output-max (* 3 1024 1024)) ;; Increased for larger projects
(setq lsp-response-timeout 20) ;; Increased timeout
(setq lsp-idle-delay 0.500)
;; Decrease the amount of data lsp has to process
(setq lsp-enable-file-watchers t)
(setq lsp-enable-folding nil)
(setq lsp-enable-text-document-color nil)
(setq lsp-enable-on-type-formatting nil)
(setq lsp-enable-links nil)
;; Which-key integration
(with-eval-after-load 'lsp-mode
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration))
;; Enable LSP for specific modes
(add-hook 'python-mode-hook #'lsp-deferred)
(add-hook 'c-mode-hook #'lsp-deferred)
(add-hook 'c++-mode-hook #'lsp-deferred)
(add-hook 'rust-mode-hook #'lsp-deferred)
(add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'js-mode-hook #'lsp-deferred)
(add-hook 'typescript-mode-hook #'lsp-deferred)
;; Format on save (optional)
(add-hook 'before-save-hook #'lsp-format-buffer)
;; Keybindings
(define-key lsp-mode-map (kbd "C-c l f") #'lsp-format-buffer)
(define-key lsp-mode-map (kbd "C-c l r") #'lsp-rename)
(define-key lsp-mode-map (kbd "C-c l a") #'lsp-execute-code-action)
(define-key lsp-mode-map (kbd "C-c l d") #'lsp-find-definition)
(define-key lsp-mode-map (kbd "C-c l R") #'lsp-find-references)
(provide 'module-lsp)
;;; module-lsp.el ends here

View File

@ -20,6 +20,10 @@
(org-babel-do-load-languages
'org-babel-load-languages '((plantuml . t))))
(with-eval-after-load 'plantuml-mode
(add-to-list 'auto-mode-alist '("\\.puml$" . plantuml-mode)))
(provide 'module-plantuml)
;;; module-plantuml.el ends here.

View File

@ -62,6 +62,19 @@ input "2821:6246:Asus_Keyboard" {
xkb_variant "dvorak"
}
input "1:1:AT_Translated_Set_2_keyboard" {
xkb_layout "us"
xkb_variant "dvorak"
}
input "1267:12811:ELAN0688:00_04F3:320B_Touchpad" {
natural_scroll enabled
dwt disabled
drag enabled
drag_lock enabled
tap enabled
}
### Input configuration
#
# Example configuration:
@ -244,18 +257,6 @@ input "2821:6246:Asus_Keyboard" {
input "type:keyboard" xkb_options compose:ralt
exec foot --server
# setup displays
exec wlr-randr --output HDMI-A-1 --scale 1 --preferred
exec wlr-randr --output eDP-1 --scale 1.5
# start pipewire
exec pipewire &
exec wireplumber &
# pulseaudio compatibility, mainly for gaming
exec pipewire-pulse &
bindsym --locked XF86AudioRaiseVolume exec --no-startup-id amixer set Master 5%+
bindsym --locked XF86AudioLowerVolume exec --no-startup-id amixer set Master 5%-
bindsym --locked XF86AudioMute exec --no-startup-id amixer set Master mute toggle
@ -272,9 +273,8 @@ exec vorta &
include /etc/sway/config.d/*
seat seat0 xcursor_theme Adwaita 48
exec eval $(gnome-keyring-daemon --start)
exec export SSH_AUTH_SOCK