This commit is contained in:
Joe Frikker
2026-06-02 16:44:33 -04:00
parent 9e653100f2
commit 591f00e2f9
2 changed files with 81 additions and 47 deletions
+72 -38
View File
@@ -889,7 +889,7 @@ Set up a few project- / workspace-related key bindings.
(bind-keys ("s-f" . project-find-file)
("s-F" . project-switch-project))
(with-eval-after-load tab-bar-mode
(with-eval-after-load 'tab-bar
(bind-keys :map tab-bar-mode-map
("s-s" . tab-bar-switch-to-tab)))
#+END_SRC
@@ -1148,7 +1148,7 @@ its own devil-mode-only repeat maps that don't interfere when using normal modif
(setq cursor-type (cond
(org-present-mode nil)
((or (and nil god-local-mode) buffer-read-only
(and meow-mode (not (eq 'insert meow-current-state)))) 'box)
(and meow-mode (not (eq 'insert meow--current-state)))) 'box)
(t 'bar))))
(add-hook 'post-command-hook 'my-god-mode-update-cursor-type)
@@ -1275,17 +1275,37 @@ Just "silently" wrap when searching at the bottom of a document.
}
#+END_SRC
#+BEGIN_SRC elisp
(electric-pair-mode 1)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(global-tree-sitter-mode 1)
(setopt ediff-split-window-function 'split-window-horizontally)
(defun project-nix-flake ()
(interactive)
(nix-flake (project-root (project-current t))))
(bind-keys ("C-x p n" . project-nix-flake))
#+END_SRC
Show a vertical bar 100 characters out; ideally I don't want lines longer than this. 100 characters
is about the max you can have and still fit two files side-by-side on the screen.
#+begin_src elisp
(setq-default fill-column 100)
(defun jf-init-fill-column ()
(display-fill-column-indicator-mode 1))
(add-hook 'prog-mode-hook 'jf-init-fill-column)
#+end_src
I had some weird problems with jsx code where the default M-q would just do a text fill rather than
a re-indent. The solution seems to be to only do the ~syntax-ppss~ stuff if tree-sitter isn't
available? It seems to work for now anyway...
#+BEGIN_SRC elisp
(electric-pair-mode 1)
(autoload 'flymake-show-project-diagnostics "flymake")
(autoload 'flymake-goto-next-error "flymake")
(autoload 'flymake-goto-prev-error "flymake")
#+begin_src elisp
(with-eval-after-load 'prog-mode
(defun my-prog-fill-reindent-defun (&optional argument)
"Refill or reindent the paragraph or defun that contains point.
@@ -1306,47 +1326,57 @@ available? It seems to work for now anyway...
(and (not (and (treesit-available-p) (treesit-parser-list))) (nth 8 (syntax-ppss)))
(re-search-forward "\\s-*\\s<" (line-end-position) t))
(fill-paragraph argument (region-active-p))
(beginning-of-defun)
(beginning-of-defun)/
(let ((start (point)))
(end-of-defun)
(indent-region start (point) nil))))))
(advice-add 'prog-fill-reindent-defun :override #'my-prog-fill-reindent-defun)
(advice-add 'prog-fill-reindent-defun :override #'my-prog-fill-reindent-defun))
#+end_src
*** Flymake
#+begin_src elisp
(autoload 'flymake-show-project-diagnostics "flymake")
(autoload 'flymake-goto-next-error "flymake")
(autoload 'flymake-goto-prev-error "flymake")
(with-eval-after-load 'prog-mode
(bind-keys :map prog-mode-map
("C-c D" . flymake-show-project-diagnostics)
("M-n" . flymake-goto-next-error)
("M-p" . flymake-goto-prev-error))
(defun jf-init-fill-column ()
(display-fill-column-indicator-mode 1))
(add-hook 'prog-mode-hook 'jf-init-fill-column))
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(global-tree-sitter-mode 1)
(setq-default fill-column 100)
(setopt eglot-ignored-server-capabilities '(:inlayHintProvider :semanticTokensProvider))
(add-hook 'eglot-managed-mode-hook (lambda () (eglot-inlay-hints-mode -1)) nil t)
(setopt eglot-code-action-indications nil)
(with-eval-after-load 'eglot
(bind-keys :map eglot-mode-map
("C-c a" . eglot-code-actions)
("C-c r" . eglot-rename)
("C-c i" . eglot-find-implementation))
(add-to-list 'eglot-stay-out-of 'yasnippet))
(setopt ediff-split-window-function 'split-window-horizontally)
(defun project-nix-flake ()
(interactive)
(nix-flake (project-root (project-current t))))
(bind-keys ("C-x p n" . project-nix-flake))
("M-p" . flymake-goto-prev-error)))
(with-eval-after-load 'flymake
(bind-keys :map flymake-project-diagnostics-mode-map
("q" . quit-window)))
#+END_SRC
#+end_src
*** Eglot
I don't like UI elements that insert fake text into the file. They mess up the spacing in the file, and can make everything too wide.
#+BEGIN_SRC elisp
(setopt eglot-ignored-server-capabilities '(:inlayHintProvider :semanticTokensProvider))
(add-hook 'eglot-managed-mode-hook (lambda () (eglot-inlay-hints-mode -1)) nil t)
(setopt eglot-code-action-indications nil)
#+END_SRC
Set up a few useful eglot keys.
#+begin_src elisp
(with-eval-after-load 'eglot
(bind-keys :map eglot-mode-map
("C-c a" . eglot-code-actions)
("C-c r" . eglot-rename)
("C-c i" . eglot-find-implementation)))
#+end_src
Eglot's yasnippet support uses the tab key, but I *also* use the tab key both for indentation, and
for completion. That makes it really annoying to use; don't use yasnippet with eglot.
#+begin_src elisp
(with-eval-after-load 'eglot
(add-to-list 'eglot-stay-out-of 'yasnippet))
#+end_src
*** Rust
#+BEGIN_SRC elisp
@@ -1386,6 +1416,8 @@ available? It seems to work for now anyway...
*** Typescript
#+BEGIN_SRC elisp
(push '("\\.tsx?\\'" . typescript-mode) auto-mode-alist)
(push '(typescript-mode . typescript-ts-mode) major-mode-remap-alist)
(setopt typescript-ts-mode-indent-offset 4)
(with-eval-after-load 'typescript-ts-mode
(defun my-tsx-ts-mode--indent-compatibility-b893426 ()
@@ -1404,6 +1436,7 @@ available? It seems to work for now anyway...
*** Java
#+BEGIN_SRC elisp
(push '(java-mode . java-ts-mode) major-mode-remap-alist)
(with-eval-after-load 'java-ts-mode
(bind-keys :map java-ts-mode-map
("C-c u" . string-inflection-java-style-cycle))
@@ -1491,6 +1524,7 @@ available? It seems to work for now anyway...
#+BEGIN_SRC elisp
(setopt magit-define-global-key-bindings 'recommended)
(bind-keys ("s-g" . magit))
(setopt magit-save-repository-buffers 'dontask)
(setopt magit-commit-show-diff nil)