;;; shell.el --- initializes shell modes -*- lexical-binding: t; -*- ;;; Commentary: ;;; Code: (defun user--sh-mode-hook () "Initialize mode for shell script editing." (validate-setq ;; Indent with four spaces. sh-basic-offset 4 sh-indentation 4)) (defun user--shell-mode-common-hook () "Shell mode common hook." (with-feature 'ansi-color ;; Enable ANSI colors for comint. (ansi-color-for-comint-mode-on)) (with-feature 'shelldoc (shelldoc-minor-mode-on))) (defun user--shell-mode-hook () "Initialize mode for interactive shell." (user--shell-mode-common-hook) (validate-setq ;; Set up to use Bash with input echoing. explicit-shell-file-name "bash" explicit-bash-args '("-c" "export EMACS=; stty echo; bash") comint-process-echoes t)) (use-package shell :defer :hook ((sh-mode-hook . user--sh-mode-hook) (shell-mode-hook . user--shell-mode-hook)) :config ;;; (Packages) ;;; ;; https://github.com/wilkystyle/lsp-sh ;; Bash support for lsp-mode using Mads Hartmann's bash-language-server (use-package lsp-sh :if (executable-find "bash-language-server") :hook (sh-mode-hook . lsp-sh-enable)) ;; https://github.com/szermatt/emacs-bash-completion ;; Add programmable bash completion to Emacs shell-mode (use-package bash-completion) ;; https://github.com/Alexander-Miller/company-shell ;; Company mode completion backends for your shell scripting (use-package company-shell :after (company) :config (add-to-list 'company-backends '(company-shell company-shell-env))) ;; https://github.com/charlesdaniels/shelldoc ;; A tool for generating ReST documentation from shell scripts (use-package shelldoc :disabled) ;; (use-package shell-command) ;; https://github.com/cuonglm/flycheck-checkbashisms ;; Flycheck linter for checkbashisms (use-package flycheck-checkbashisms :if (executable-find "checkbashisms") :config (flycheck-checkbashisms-setup)) ;; https://github.com/alexmurray/flycheck-bashate ;; Integrate bashate with flycheck to automatically check the style of your bash scripts on the fly. (use-package flycheck-bashate :disabled :if (executable-find "bashate") :config (flycheck-bashate-setup))) (provide 'modes/shell) ;;; shell.el ends here