Merge branch 'develop' into add_shellcheck
This commit is contained in:
commit
e5e05f9d51
584 changed files with 32999 additions and 15507 deletions
|
@ -8,10 +8,10 @@ This module adds support for shell scripting languages.
|
|||
+ REPL support
|
||||
|
||||
* Table of Contents :TOC:
|
||||
- [[#install][Install]]
|
||||
- [[#dependencies][Dependencies]]
|
||||
- [[#appendix][Appendix]]
|
||||
- [[#commands][Commands]]
|
||||
- [[Install][Install]]
|
||||
- [[Dependencies][Dependencies]]
|
||||
- [[Appendix][Appendix]]
|
||||
- [[Commands][Commands]]
|
||||
|
||||
* Install
|
||||
** Dependencies
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
(defvar sh-shell-file)
|
||||
;;;###autoload
|
||||
(defun +sh/repl ()
|
||||
(defun +sh/open-repl ()
|
||||
"Open a shell REPL."
|
||||
(let* ((dest-sh (symbol-name sh-shell))
|
||||
(sh-shell-file dest-sh))
|
||||
|
|
|
@ -8,25 +8,27 @@
|
|||
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! sh-script ; built-in
|
||||
:mode ("\\.zsh$" . sh-mode)
|
||||
:mode ("\\.zunit$" . sh-mode)
|
||||
:mode ("/bspwmrc$" . sh-mode)
|
||||
:init
|
||||
(add-hook! sh-mode #'(flycheck-mode highlight-numbers-mode))
|
||||
:mode ("\\.zunit\\'" . sh-mode)
|
||||
:mode ("/bspwmrc\\'" . sh-mode)
|
||||
:config
|
||||
(set! :electric 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
|
||||
(set! :repl 'sh-mode #'+sh/repl)
|
||||
(set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
|
||||
(set-repl-handler! 'sh-mode #'+sh/open-repl)
|
||||
|
||||
(setq sh-indent-after-continuation 'always)
|
||||
|
||||
;; [pedantry intensifies]
|
||||
(setq-hook! 'sh-mode-hook mode-name "sh")
|
||||
|
||||
;; recognize function names with dashes in them
|
||||
(push '((sh . ((nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1)
|
||||
(nil "^\\s-*\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*()" 1))))
|
||||
sh-imenu-generic-expression)
|
||||
(add-to-list 'sh-imenu-generic-expression
|
||||
'(sh (nil "^\\s-*function\\s-+\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*\\(?:()\\)?" 1)
|
||||
(nil "^\\s-*\\([[:alpha:]_-][[:alnum:]_-]*\\)\\s-*()" 1)))
|
||||
|
||||
;; `sh-set-shell' is chatty about setting up indentation rules
|
||||
(advice-add #'sh-set-shell :around #'doom*shut-up)
|
||||
|
||||
;; 1. Fontifies variables in double quotes
|
||||
;; 2. Fontify command substitution in double quotes
|
||||
|
@ -39,9 +41,11 @@
|
|||
(1 'sh-quoted-exec prepend))
|
||||
(,(regexp-opt +sh-builtin-keywords 'words)
|
||||
(0 'font-lock-type-face append))))
|
||||
;; 4. Fontify delimiters by depth
|
||||
(add-hook 'sh-mode-hook #'rainbow-delimiters-mode)
|
||||
|
||||
;; autoclose backticks
|
||||
(sp-local-pair 'sh-mode "`" nil :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
(sp-local-pair 'sh-mode "`" "`" :unless '(sp-point-before-word-p sp-point-before-same-p))
|
||||
|
||||
;; sh-mode has file extensions checks for other shells, but not zsh, so...
|
||||
(defun +sh|detect-zsh ()
|
||||
|
@ -49,7 +53,7 @@
|
|||
(string-match-p "\\.zsh\\'" buffer-file-name))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(looking-at-p "^#!.+zsh[$\\s-]")))
|
||||
(looking-at-p "^#!.+/zsh[$ ]")))
|
||||
(sh-set-shell "zsh")))
|
||||
(add-hook 'sh-mode-hook #'+sh|detect-zsh))
|
||||
|
||||
|
@ -58,6 +62,11 @@
|
|||
:when (featurep! :completion company)
|
||||
:after sh-script
|
||||
:config
|
||||
(set! :company-backend 'sh-mode '(company-shell company-files))
|
||||
(set-company-backend! 'sh-mode '(company-shell company-files))
|
||||
(setq company-shell-delete-duplicates t))
|
||||
|
||||
|
||||
(def-package! fish-mode
|
||||
:when (featurep! +fish)
|
||||
:defer t
|
||||
:config (set-formatter! 'fish-mode #'fish_indent))
|
||||
|
|
|
@ -6,3 +6,6 @@
|
|||
|
||||
(when (featurep! :completion company)
|
||||
(package! company-shell))
|
||||
|
||||
(when (featurep! +fish)
|
||||
(package! fish-mode))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue