summaryrefslogtreecommitdiff
path: root/emacs/.config/emacs-kj/lisp
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2023-03-12 11:07:20 -0400
committerKjetil Orbekk <kj@orbekk.com>2023-03-12 11:07:20 -0400
commit7964c8ce1279249e640406cfbcd4be13f3c2a2b3 (patch)
treee1ee9f2f4c3a2f6b27b6a05293798316ddbbd0bb /emacs/.config/emacs-kj/lisp
parentf9986a8179655a57e76424ed5430f1c929ce14c8 (diff)
emacs config
Diffstat (limited to 'emacs/.config/emacs-kj/lisp')
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-development.el82
-rw-r--r--emacs/.config/emacs-kj/lisp/kj-eshell.el46
2 files changed, 128 insertions, 0 deletions
diff --git a/emacs/.config/emacs-kj/lisp/kj-development.el b/emacs/.config/emacs-kj/lisp/kj-development.el
new file mode 100644
index 0000000..8750ecc
--- /dev/null
+++ b/emacs/.config/emacs-kj/lisp/kj-development.el
@@ -0,0 +1,82 @@
+;;; -*- lexical-binding: t; -*-
+(setq tab-stop-list (number-sequence 4 200 4))
+
+(use-package eglot)
+
+(add-hook 'prog-mode-hook 'subword-mode)
+
+;; Only used to get better eglot snippets.
+(use-package yasnippet
+ :config
+ (add-to-list 'yas-snippet-dirs (expand-file-name "yasnippets" user-emacs-directory))
+ (yas-global-mode))
+
+(use-package rustic
+ :after eglot
+ :bind (("C-c C-r C-s" . rustic-popup)
+ ("C-c C-r C-n" . kj/rustic-nextest-all))
+ :config
+ (defun kj/rustic-nextest-all ()
+ (interactive)
+ (setq rustic-cargo-nextest-exec-command "nextest run --run-ignored all")
+ (rustic-cargo-run-nextest))
+ (setq
+ ;; eglot seems to be the best option right now.
+ rustic-lsp-client 'eglot
+ rustic-format-on-save nil
+ ;; Prevent automatic syntax checking, which was causing lags and stutters.
+ ;; eglot-send-changes-idle-time (* 60 60)
+ )
+ :hook
+ (rustic-mode . eglot-ensure)
+ ;; Disable the annoying doc popups in the minibuffer.
+ ;; (add-hook 'eglot-managed-mode-hook (lambda () (eldoc-mode -1)))
+ )
+
+(use-package markdown-mode
+ :ensure t
+ :mode ("README\\.md\\'" . gfm-mode)
+ :init (setq markdown-command "multimarkdown"))
+
+(straight-use-package
+ '(nix-mode :type git :host github :repo "NixOS/nix-mode"))
+(use-package nix-mode
+ :mode "\\.nix\\'")
+
+(use-package ledger-mode
+ :mode "\\.journal")
+(use-package unobtrusive-magit-theme)
+
+(use-package editorconfig
+ :ensure t
+ :config
+ (editorconfig-mode 1))
+
+(use-package tree-sitter
+ :config
+ (global-tree-sitter-mode)
+ (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))
+
+(use-package tree-sitter-langs
+ :after tree-sitter)
+
+(use-package clojure-mode)
+
+;; Devicetree mode for keyboard configs.
+(use-package dts-mode
+ :mode "\\.keymap\\'")
+
+(use-package yaml-mode
+ :mode "\\.\(yml|yaml\)\\'")
+
+(use-package ansi-color
+ :hook (compilation-filter . ansi-color-compilation-filter))
+
+(use-package diff-hl
+ :config
+ (global-diff-hl-mode))
+
+(use-package graphviz-dot-mode
+ :ensure t)
+
+(provide 'kj-development)
diff --git a/emacs/.config/emacs-kj/lisp/kj-eshell.el b/emacs/.config/emacs-kj/lisp/kj-eshell.el
new file mode 100644
index 0000000..bd20f05
--- /dev/null
+++ b/emacs/.config/emacs-kj/lisp/kj-eshell.el
@@ -0,0 +1,46 @@
+;;; -*- lexical-binding: t; -*-
+(use-package eshell
+ :config
+ (add-hook 'eshell-mode-hook
+ (lambda ()
+ (setenv "PAGER" "cat"))
+ (setenv "EDITOR" "emacsclient"))
+ (setq eshell-prefer-lisp-functions nil
+ eshell-scroll-to-bottom-on-input 'all
+ eshell-hist-ignoredups t
+ eshell-error-if-no-glob t)
+ (setq tramp-remote-path '(tramp-own-remote-path))
+
+ (add-to-list 'eshell-modules-list 'eshell-tramp)
+ (add-to-list 'eshell-load-hook #'kj/on-eshell-load)
+
+ (add-hook 'eshell-mode-hook 'visual-line-mode))
+
+(use-package esh-help
+ :init
+ (setup-esh-help-eldoc))
+
+(use-package eshell-syntax-highlighting
+ :hook (eshell-mode . eshell-syntax-highlighting-mode))
+
+(use-package fish-completion
+ :config
+ (setq fish-completion-fallback-on-bash-p t)
+ :init
+ (fish-completion-mode 1))
+
+(defun kj/on-eshell-load (&args rest)
+ (add-to-list 'eshell-visual-commands
+ '("htop" "tmux" "vim" "nvim"))
+ (add-to-list 'eshell-complex-commands "ssh"))
+
+(defun eshell/ssh (&rest args)
+ (if (= 1 (length args))
+ (throw 'eshell-replace-command
+ (eshell/cd
+ (format "/ssh:%s:" (car args))))
+ (throw 'eshell-replace-command
+ (eshell-parse-command "*ssh"
+ (eshell-stringify-list (flatten-tree args))))))
+
+(provide 'kj-eshell)