mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
lang/sh: improve zsh buffer detection
This commit is contained in:
@ -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))
|
||||
|
||||
|
Reference in New Issue
Block a user