From 7964c8ce1279249e640406cfbcd4be13f3c2a2b3 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Sun, 12 Mar 2023 11:07:20 -0400 Subject: emacs config --- emacs/.config/emacs-kj/lisp/kj-development.el | 82 +++++++++++++++++++++++++++ emacs/.config/emacs-kj/lisp/kj-eshell.el | 46 +++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 emacs/.config/emacs-kj/lisp/kj-development.el create mode 100644 emacs/.config/emacs-kj/lisp/kj-eshell.el (limited to 'emacs/.config/emacs-kj/lisp') 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) -- cgit v1.2.3