Compare commits

...

10 commits

73
init.el
View file

@ -119,6 +119,15 @@
("C-:" . avy-goto-word-1) ("C-:" . avy-goto-word-1)
("M-g g" . avy-goto-line))) ("M-g g" . avy-goto-line)))
(use-package undo-tree
:after evil
:config
(setq undo-tree-auto-save-history nil)
(advice-add #'evil-undo :override #'undo-tree-undo)
(advice-add #'evil-redo :override #'undo-tree-redo)
(define-key evil-normal-state-map (kbd "SPC u v") #'undo-tree-visualize)
(global-undo-tree-mode))
;; Magit (git frontend) ;; Magit (git frontend)
(use-package magit) (use-package magit)
@ -165,6 +174,9 @@
:init :init
(setq markdown-fontify-code-blocks-natively t)) (setq markdown-fontify-code-blocks-natively t))
;; Justfile
(use-package just-mode)
;; String casing functions ;; String casing functions
(use-package string-inflection) (use-package string-inflection)
@ -219,7 +231,10 @@
(which-key-mode +1)) (which-key-mode +1))
;; On the fly syntax checking ;; On the fly syntax checking
(use-package flycheck) (use-package flycheck
:after evil
:config
(define-key evil-normal-state-map (kbd "SPC e") #'flycheck-list-errors))
;; Completions ;; Completions
(use-package company (use-package company
@ -261,25 +276,25 @@
:config :config
(add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration) (add-hook 'lsp-mode-hook #'lsp-enable-which-key-integration)
(add-hook 'evil-insert-state-entry-hook #'lsp-signature-activate) (add-hook 'evil-insert-state-entry-hook #'lsp-signature-activate)
(add-hook 'evil-insert-state-exit-hook #'lsp-signature-stop)) (add-hook 'evil-insert-state-exit-hook #'lsp-signature-stop)
(use-package lsp-ui
:after lsp-mode
:init
(setq lsp-ui-doc-position 'at-point
lsp-ui-doc-delay 0.5)
:config
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)
(define-key evil-normal-state-map (kbd "SPC l d") #'lsp-ui-peek-find-definitions)
(define-key evil-normal-state-map (kbd "SPC l u") #'lsp-ui-peek-find-references)
(define-key evil-normal-state-map (kbd "SPC l r") #'lsp-rename) (define-key evil-normal-state-map (kbd "SPC l r") #'lsp-rename)
(define-key evil-normal-state-map (kbd "SPC l a") #'lsp-execute-code-action) (define-key evil-normal-state-map (kbd "SPC l a") #'lsp-execute-code-action)
(define-key evil-normal-state-map (kbd "SPC l = =") #'lsp-format-buffer) (define-key evil-normal-state-map (kbd "SPC l = =") #'lsp-format-buffer)
(define-key evil-normal-state-map (kbd "SPC l = r") #'lsp-format-region) (define-key evil-normal-state-map (kbd "SPC l = r") #'lsp-format-region)
(define-key evil-normal-state-map (kbd "SPC l s q") #'lsp-workspace-shutdown) (define-key evil-normal-state-map (kbd "SPC l s q") #'lsp-workspace-shutdown)
(define-key evil-normal-state-map (kbd "SPC l s r") #'lsp-workspace-restart) (define-key evil-normal-state-map (kbd "SPC l s r") #'lsp-workspace-restart)
(define-key evil-normal-state-map (kbd "SPC l i") #'lsp-ui-doc-glance) (define-key evil-normal-state-map (kbd "SPC l i") #'lsp-describe-thing-at-point))
(use-package lsp-ui
:after lsp-mode
:init
(setq lsp-ui-doc-enable nil
lsp-ui-sideline-enable nil)
:config
(define-key lsp-ui-mode-map [remap xref-find-definitions] #'lsp-ui-peek-find-definitions)
(define-key lsp-ui-mode-map [remap xref-find-references] #'lsp-ui-peek-find-references)
(define-key evil-normal-state-map (kbd "SPC l d") #'lsp-ui-peek-find-definitions)
(define-key evil-normal-state-map (kbd "SPC l u") #'lsp-ui-peek-find-references)
;; Controls inside references popup ;; Controls inside references popup
(define-key lsp-ui-peek-mode-map (kbd "j") #'lsp-ui-peek--select-next) (define-key lsp-ui-peek-mode-map (kbd "j") #'lsp-ui-peek--select-next)
(define-key lsp-ui-peek-mode-map (kbd "k") #'lsp-ui-peek--select-prev) (define-key lsp-ui-peek-mode-map (kbd "k") #'lsp-ui-peek--select-prev)
@ -290,6 +305,18 @@
(use-package lsp-treemacs (use-package lsp-treemacs
:after (lsp-mode treemacs)) :after (lsp-mode treemacs))
;; Java lsp
(use-package lsp-java
:after lsp-mode
:hook (java-ts-mode . lsp-deferred)
:config
(setq lsp-java-server-install-dir (getenv "JDTLS_PATH"))
(defun lsp-java--ls-command ()
(list "jdt-language-server"
;; this is called "configuration" for come reasn, its acually a cache
"-configuration" (concat (file-name-as-directory (getenv "XDG_CACHE_HOME")) "jdtls")
"-data" "../.jdtls")))
;; Nix support ;; Nix support
(use-package nix-mode (use-package nix-mode
:mode "\\.nix\\'" :mode "\\.nix\\'"
@ -324,6 +351,8 @@
(hyprctl "hy3:makegroup" "h, ephemeral") (hyprctl "hy3:makegroup" "h, ephemeral")
(make-frame-command))) (make-frame-command)))
(define-key evil-normal-state-map (kbd "C-w a") #'make-frame-command)
(advice-add #'evil-window-left :override (advice-add #'evil-window-left :override
(lambda (&optional count file) (hyprctl "hy3:movefocus" "l"))) (lambda (&optional count file) (hyprctl "hy3:movefocus" "l")))
(advice-add #'evil-window-right :override (advice-add #'evil-window-right :override
@ -332,3 +361,19 @@
(lambda (&optional count file) (hyprctl "hy3:movefocus" "u"))) (lambda (&optional count file) (hyprctl "hy3:movefocus" "u")))
(advice-add #'evil-window-down :override (advice-add #'evil-window-down :override
(lambda (&optional count file) (hyprctl "hy3:movefocus" "d"))) (lambda (&optional count file) (hyprctl "hy3:movefocus" "d")))
;;; Overrides
;; stop lsp-mode from yoloing code actions when only one is present
(defun lsp--select-action (actions)
"Select an action to execute from ACTIONS."
(cond
((seq-empty-p actions) (signal 'lsp-no-code-actions nil))
;;((and (eq (seq-length actions) 1) lsp-auto-execute-action)
;;(lsp-seq-first actions))
(t (let ((completion-ignore-case t))
(lsp--completing-read "Select code action: "
(seq-into actions 'list)
(-compose (lsp--create-unique-string-fn)
#'lsp:code-action-title)
nil t)))))