(provide 'thoom-prog) (use-package treesit-auto :ensure t :custom (treesit-auto-install 'prompt) :config (treesit-auto-add-to-auto-mode-alist 'all) (global-treesit-auto-mode)) (use-package markdown-mode :ensure t :mode ("README\\.md\\'" . gfm-mode) :hook ((markdown-mode . visual-line-mode))) (use-package yaml-mode :ensure t) (use-package rust-mode :ensure t) (use-package dockerfile-mode :ensure t) ;; TODO - replace with https://github.com/sshaw/copy-as-format if necessary (defun copy-source-for-reddit () (interactive) (let ((contents (buffer-substring (point) (mark)))) (with-temp-buffer (insert contents) (mark-whole-buffer) (indent-rigidly (point) (mark) 4 t) (mark-whole-buffer) (kill-ring-save 0 0 t)))) (keymap-global-set "C-c o r" #'copy-source-for-reddit) (use-package eat :ensure t :custom (eat-term-name "xterm-256color") :init (eval-after-load 'eshell #'eat-eshell-mode) (eval-after-load 'eshell #'eat-eshell-visual-command-mode) :hook (eat-mode . (lambda () (setq display-line-numbers nil) (hl-line-mode -1)))) (use-package eshell :config (setq eshell-destroy-buffer-when-process-dies t eshell-visual-commands '()) ;; From https://karthinks.com/software/jumping-directories-in-eshell/ (defun eshell/j (&optional regexp) "Navigate to a previously visited directory in eshell, or to any directory proferred by `consult-dir'." (let ((eshell-dirs (delete-dups (mapcar 'abbreviate-file-name (ring-elements eshell-last-dir-ring))))) (cond ((and (not regexp) (featurep 'consult-dir)) (let* ((consult-dir--source-eshell `(:name "Eshell" :narrow ?e :category file :face consult-file :items ,eshell-dirs)) (consult-dir-sources (cons consult-dir--source-eshell consult-dir-sources))) (eshell/cd (substring-no-properties (consult-dir--pick "Switch directory: "))))) (t (eshell/cd (if regexp (eshell-find-previous-directory regexp) (completing-read "cd: " eshell-dirs)))))))) (use-package eshell-toggle :ensure t :custom (eshell-toggle-size-fraction 2) (eshell-toggle-window-side 'below) :bind (("M-`" . eshell-toggle))) (use-package eshell-p10k :ensure (:host github :repo "elken/eshell-p10k") :config (eshell-p10k-def-segment time "" (format-time-string "%H:%M" (current-time)) 'eshell-p10k-distro-face) (defun num-exitcode-string () (if (= eshell-last-command-status 0) (number-to-string eshell-p10k--prompt-num-index) (format "%d (%d)" eshell-p10k--prompt-num-index eshell-last-command-status))) (defun num-exitcode-face () (if (= eshell-last-command-status 0) 'eshell-p10k-git-clean-face 'eshell-p10k-git-dirty-face)) (eshell-p10k-def-segment num-exitcode "" (num-exitcode-string) (num-exitcode-face)) (defun eshell-p10k-prompt-function () "Prompt defining function." (eshell-p10k-def-prompt '(num-exitcode time dir git))) (setq eshell-prompt-function #'eshell-p10k-prompt-function eshell-prompt-regexp eshell-p10k-prompt-string)) (use-package lsp-mode :ensure t :commands lsp :init (setq lsp-keymap-prefix "C-c l") :hook ((rust-ts-mode . lsp-deferred) (lsp-mode . lsp-enable-which-key-integration))) (use-package lsp-ui :ensure t :commands lsp-ui-mode)