diff --git a/.emacs.bankruptcy/init.org b/.config/emacs/init.org similarity index 85% rename from .emacs.bankruptcy/init.org rename to .config/emacs/init.org index 808a4db..e284538 100644 --- a/.emacs.bankruptcy/init.org +++ b/.config/emacs/init.org @@ -167,9 +167,8 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering #+begin_src emacs-lisp ;; (straight-use-package 'all-the-icons) (straight-use-package 'dashboard) -(require 'dashboard) (dashboard-setup-startup-hook) -(setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) +;; (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))) (setq dashboard-items '((recents . 8) (bookmarks . 8))) (setq dashboard-startup-banner 'logo) @@ -259,6 +258,15 @@ Setup other stuff (straight-use-package 'doom-modeline) (doom-modeline-mode) +(doom-modeline-def-modeline 'main + '(modals bar workspace-name bar window-number matches buffer-info remote-host buffer-position word-count selection-info) + '(parrot objed-state misc-info persp-name battery grip irc mu4e gnus github debug repl lsp bar input-method indent-info buffer-encoding bar major-mode process)) + +;; Set default mode-line +(add-hook 'doom-modeline-mode-hook + (lambda () + (doom-modeline-set-modeline 'main 'default))) + ;; (straight-use-package 'centaur-tabs) ;; (setq centaur-tabs-set-bar 'under) @@ -277,8 +285,9 @@ Setup other stuff (setq-default indent-tabs-mode nil) (setq-default tab-width 4) (setq-default line-spacing 5) -(setq indent-line-function 'insert-tab) -(set-default 'truncate-lines nil) +(setq indent-line-function #'indent-relative) + +(set-default 'truncate-lines t) (set-default 'truncate-partial-width-windows nil) ;; (add-hook 'before-save-hook 'whitespace-cleanup) @@ -339,7 +348,7 @@ Emacs is an great operating system, if only it had a good text editor... (setq evil-want-C-u-scroll t) (setq evil-want-Y-yank-to-eol t) (setq evil-disable-insert-state-bindings t) - +(setq evil-echo-state nil) (straight-use-package 'evil) (straight-use-package 'evil-collection) @@ -353,6 +362,53 @@ Emacs is an great operating system, if only it had a good text editor... (evil-define-key 'normal 'global (kbd "q") 'avy-goto-word-0) +(add-hook 'emacs-startup-hook + (lambda () + (evil-define-key 'normal 'global + (kbd "w") 'save-buffer + (kbd "q") 'kill-buffer-and-window + (kbd "k") 'kill-this-buffer + (kbd "h") 'help-command + (kbd "hf") 'helpful-callable + (kbd "hv") 'helpful-variable + (kbd "hk") 'helpful-key + (kbd "ho") 'helpful-symbol + (kbd "hg") 'helpful-at-point + (kbd "fb") 'bookmark-jump + (kbd "fr") 'consult-recent-file + (kbd "ff") 'project-find-file + (kbd "fi") 'joe/edit-init + (kbd "bl") 'mode-line-other-buffer + (kbd "ba") 'consult-buffer + (kbd "bb") 'consult-project-buffer + (kbd "bi") 'ibuffer + (kbd "bm") 'joe/toggle-buffer-mode + (kbd "br") 'joe/revert-buffer-no-confirm + (kbd "gg") 'magit-status + (kbd "gc") 'magit-clone + (kbd "ss") 'joe/vterm-here + (kbd "sv") 'vterm + (kbd "tv") 'vterm-other-window + (kbd "Ba") 'joe/bookmark-set-and-save + (kbd "Bd") 'bookmark-delete + (kbd "mr") 'joe/compile-run + (kbd "mc") 'joe/compile-comp + (kbd "ct") 'consult-theme + (kbd "cl") 'consult-line + (kbd "ci") 'consult-imenu + (kbd "cy") 'consult-yank-from-kill-ring + (kbd "cg") 'consult-ripgrep + (kbd "cF") 'consult-find + (kbd "co") 'consult-outline + ;; (kbd "ee") 'flymake-mode + (kbd "C-h") 'evil-window-left + (kbd "C-j") 'evil-window-down + (kbd "C-k") 'evil-window-up + (kbd "C-l") 'evil-window-right + (kbd "tn") 'tab-new + (kbd "tc") 'tab-close + (kbd "tr") 'tab-rename))) + (evil-define-key 'normal 'global (kbd "M-1") '(lambda () (interactive) (tab-bar-select-tab 1))) (evil-define-key 'normal 'global (kbd "M-2") '(lambda () (interactive) (tab-bar-select-tab 2))) (evil-define-key 'normal 'global (kbd "M-3") '(lambda () (interactive) (tab-bar-select-tab 3))) @@ -366,6 +422,7 @@ Emacs is an great operating system, if only it had a good text editor... ;; (define-key evil-consult-map "b" 'evil-window-bottom-right) ;; (define-key evil-consult-map "c" 'evil-window-delete) + ;; (define-key evil-normal-state-map "," 'evil-consult-map) (defun joe/evil-select-line () (interactive) @@ -403,51 +460,6 @@ Emacs is an great operating system, if only it had a good text editor... (setq evil-goggles-pulse t) (setq evil-goggles-async-duration 0.55) -(add-hook 'emacs-startup-hook (lambda () -(evil-define-key 'normal 'global - (kbd "w") 'save-buffer - (kbd "q") 'kill-buffer-and-window - (kbd "k") 'kill-this-buffer - (kbd "h") 'help-command - (kbd "hf") 'helpful-callable - (kbd "hv") 'helpful-variable - (kbd "hk") 'helpful-key - (kbd "ho") 'helpful-symbol - (kbd "hg") 'helpful-at-point - (kbd "fb") 'bookmark-jump - (kbd "fr") 'consult-recent-file - (kbd "ff") 'project-find-file - (kbd "fi") 'joe/edit-init - (kbd "bl") 'mode-line-other-buffer - (kbd "ba") 'consult-buffer - (kbd "bb") 'consult-project-buffer - (kbd "bi") 'ibuffer - (kbd "bm") 'joe/toggle-buffer-mode - (kbd "br") 'joe/revert-buffer-no-confirm - (kbd "gg") 'magit-status - (kbd "gc") 'magit-clone - (kbd "ss") 'joe/vterm-here - (kbd "sv") 'vterm - (kbd "tv") 'vterm-other-window - (kbd "Ba") 'joe/bookmark-set-and-save - (kbd "Bd") 'bookmark-delete - (kbd "mr") 'joe/compile-run - (kbd "mc") 'joe/compile-comp - (kbd "ct") 'consult-theme - (kbd "cl") 'consult-line - (kbd "ci") 'consult-imenu - (kbd "cy") 'consult-yank-from-kill-ring - (kbd "cg") 'consult-ripgrep - (kbd "cF") 'consult-find - (kbd "co") 'consult-outline - (kbd "C-h") 'evil-window-left - (kbd "C-j") 'evil-window-down - (kbd "C-k") 'evil-window-up - (kbd "C-l") 'evil-window-right - (kbd "tn") 'tab-new - (kbd "tc") 'tab-close - (kbd "tr") 'tab-rename))) - #+end_src ** Buffers #+begin_src emacs-lisp @@ -611,25 +623,25 @@ Vertico Embark Marginalia Consult Orderless vertico-directory))) (vertico-mode) -(straight-use-package 'vertico-posframe) +;; (straight-use-package 'vertico-posframe) (define-key vertico-map (kbd "C-w") #'vertico-directory-delete-word) -(define-key vertico-map (kbd "C-r") #'vertico-repeat-) +;; (define-key vertico-map (kbd "C-r") #'vertico-repeat-) -(vertico-posframe-mode t) +;; (vertico-posframe-mode t) (vertico-indexed-mode) -(setq vertico-posframe-parameters - '((left-fringe . 100) - (right-fringe . 100))) +;; (setq vertico-posframe-parameters +;; '((left-fringe . 100) +;; (right-fringe . 100))) -(setq vertico-posframe-border-width 5) -(setq vertico-posframe-min-height 20) -(defun posframe-poshandler-slightly-below-top (info) - (cons (/ (- (plist-get info :parent-frame-width) - (plist-get info :posframe-width)) - 2) - 150)) -(setq vertico-posframe-poshandler #'posframe-poshandler-slightly-below-top) +;; (setq vertico-posframe-border-width 5) +;; (setq vertico-posframe-min-height 20) +;; (defun posframe-poshandler-slightly-below-top (info) +;; (cons (/ (- (plist-get info :parent-frame-width) +;; (plist-get info :posframe-width)) +;; 2) +;; 150)) +;; (setq vertico-posframe-poshandler #'posframe-poshandler-slightly-below-top) (setq vertico-count 17 vertico-resize nil @@ -946,43 +958,64 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i ;; (straight-use-package 'yasnippet) (straight-use-package 'markdown-mode) ;; (straight-use-package 'posframe) -;; (straight-use-package '(lsp-bridge -;; :type git -;; :host github -;; :repo "manateelazycat/lsp-bridge" -;; :files (:defaults "*.py" "core/*" "langserver/*")));; (straight-use-package 'lsp-mode) +(straight-use-package 'lsp-mode) +(straight-use-package 'lsp-ui) -;; (straight-use-package -;; '(acm-terminal :type git :host github :repo "twlz0ne/acm-terminal")) -;; (straight-use-package -;; '(popon :type git :repo "https://codeberg.org/akib/emacs-popon.git")) - - -;; (straight-use-package 'lsp-mode) -;; (straight-use-package 'lsp-ui) -(evil-global-set-key 'normal (kbd "M-e") #'flymake-goto-next-error) -(evil-global-set-key 'normal (kbd "M-S-e") #'flymake-goto-prev-error) +(cl-defmethod lsp-clients-extract-signature-on-hover (contents (_server-id (eql rust-analyzer))) + (-let* (((&hash "value") contents) + (groups (--partition-by (s-blank? it) (s-lines (s-trim value)))) + (sig_group (if (s-equals? "```rust" (car (-third-item groups))) + (-third-item groups) + (car groups))) + (sig (--> sig_group + (--drop-while (s-equals? "```rust" it) it) + (--take-while (not (s-equals? "```" it)) it) + (--map (s-trim it) it) + (s-join " " it)))) + (lsp--render-element (concat "```rust\n" sig "\n```")))) ;; (setq lsp-ui-peek-always-show t) ;; (setq lsp-ui-sideline-show-hover t) ;; (setq lsp-ui-doc-enable t) -;; (setq lsp-rust-analyzer-server-display-inlay-hints t) -;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial") -;; (setq lsp-rust-analyzer-display-chaining-hints t) -;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil) -;; (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-eldoc-render-all t) -;; (setq lsp-eldoc-enable-hover nil) +(setq lsp-headerline-breadcrumb-enable nil) +(setq lsp-rust-analyzer-server-display-inlay-hints t) +(setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "skip_trivial") +(setq lsp-rust-analyzer-display-chaining-hints t) +(setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names nil) +(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-eldoc-render-all nil) +(setq lsp-eldoc-enable-hover t) +(setq lsp-headerline-breadcrumb-icons-enable t) +(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)) ;; (setq lsp-idle-delay 0.2) -;; (straight-use-package 'eglot) +;; (defun joe/toggle-linting () +;; (interactive) +;; (if (bound-and-true-p flycheck-mode) +;; () +;; (message "flymake-mode is off"))) + +(straight-use-package 'flycheck) +;; (evil-global-set-key 'normal (kbd "M-e") #'flymake-goto-next-error) +;; (evil-global-set-key 'normal (kbd "M-S-e") #'flymake-goto-prev-error) +;; (evil-global-set-key 'normal (kbd "M-e") ) +;; (evil-global-set-key 'normal (kbd "M-S-e") ) +;; (evil-define-key 'normal 'global (kbd "ee") 'joe/toggle-linting) +(evil-define-key 'normal 'global (kbd "el") #'flycheck-list-errors) +(evil-define-key 'normal 'global (kbd "en") #'flycheck-next-error) +(evil-define-key 'normal 'global (kbd "ep") #'flycheck-previous-error) +(evil-define-key 'normal 'global (kbd "le") 'flycheck-mode) +(evil-define-key 'normal 'global (kbd "lh") 'lsp-headerline-breadcrumb-mode) +(evil-define-key 'normal 'global (kbd "li") 'lsp-rust-analyzer-inlay-hints-mode) +;; (setq doom-modeline-checker-simple-format nil) +;; Define your custom doom-modeline ;; (setq eldoc-echo-area-use-multiline-p t) ;; (setq eldoc-echo-area-prefer-doc-buffer t) -;; (setq eldoc-idle-delay 0.1) +(setq eldoc-idle-delay 0.1) ;; (setq lsp-eldoc-render-all nil) ;; (setq lsp-keymap-prefix "C-c c") ;; (setq eldoc-documentation-strategy ) @@ -1015,7 +1048,16 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i ;; (lambda (&rest args) ;; (let ((marginalia-classifiers nil)) ;; (apply #'consult-completion-in-region args))))) - +;; (setq completion-in-region-function +;; (lambda (&rest args) +;; (let ((marginalia-classifiers nil)) +;; (apply #'consult-completion-in-region args)))) +(setq completion-in-region-function + (lambda (&rest args) + (apply (if vertico-mode + #'consult-completion-in-region + #'completion--in-region) + args))) (straight-use-package 'company) (require 'company) @@ -1035,7 +1077,7 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i (define-key company-active-map (kbd "") (lambda () (interactive) (company-complete-common-or-cycle -1))) (setq company-idle-delay 0.15 - company-tooltip-idle-delay 0.5 + company-tooltip-idle-delay 20 company-require-match nil company-frontends '(company-preview-frontend company-echo-metadata-frontend) ;; company-frontends @@ -1124,7 +1166,6 @@ it doesn't close it. #+end_src *** FSharp #+begin_src emacs-lisp -;; (straight-use-package 'eglot) (straight-use-package 'fsharp-mode) ;; (straight-use-package 'eglot-fsharp) @@ -1134,6 +1175,7 @@ it doesn't close it. (straight-use-package 'rust-mode) (straight-use-package 'rustic) (straight-use-package 'parsec) ;; Required by evcxr-mode +(setq rustic-lsp-setup-p nil) (straight-use-package '(evcxr :type git diff --git a/.doom.d/init.el b/.doom.d/init.el index 92b116f..761eda6 100644 --- a/.doom.d/init.el +++ b/.doom.d/init.el @@ -66,7 +66,7 @@ ;;word-wrap ; soft wrapping with language-aware indent :emacs - dired ; making dired pretty [functional] + (dired +dirvish) ; making dired pretty [functional] electric ; smarter, keyword-based electric-indent ;;ibuffer ; interactive buffer management undo ; persistent, smarter undo for your inevitable mistakes diff --git a/.gitignore b/.gitignore index e990c7f..efc2674 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,2 @@ -.emacs.*/elpa -.emacs.*/saves -.emacs.*/var -.emacs.*/transient -.emacs.*/recentf -.emacs.*/elpa -.emacs.*/undo -.emacs.*/url -.emacs.bankruptcy/elpaca/ -.emacs.kak/ -.emacs.bankruptcy/ -+.emacs.bankruptcy/init.org -.emacs.vanilla/* -!.emacs.vanilla/init.el -/.emacs.d/auto-save-list/ -/.emacs.bankruptcy/*.el +.config/emacs/* +!.config/emacs/init.org \ No newline at end of file