lang/sh: improve zsh buffer detection
This commit is contained in:
parent
02bfb73264
commit
f4e3080432
1 changed files with 5 additions and 1 deletions
|
@ -35,7 +35,11 @@
|
|||
|
||||
;; sh-mode has file extensions checks for other shells, but not zsh, so...
|
||||
(defun +sh|detect-zsh ()
|
||||
(when (and buffer-file-name (string-match-p "\\.zsh\\'" buffer-file-name))
|
||||
(when (or (and buffer-file-name
|
||||
(string-match-p "\\.zsh\\'" buffer-file-name))
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(looking-at-p "^#!.+zsh[$\\s-]")))
|
||||
(sh-set-shell "zsh")))
|
||||
(add-hook 'sh-mode-hook #'+sh|detect-zsh))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue