Teach shell-scripts about common ZSH files

This commit is contained in:
James Conroy-Finn 2015-07-15 22:35:45 +01:00 committed by Eivind Fonn
parent 1a91e3ea14
commit 555313ab1f

View file

@ -0,0 +1,27 @@
;;; packages.el --- Shell Scripts Layer packages File for Spacemacs
;;
;; Copyright (c) 2012-2014 Sylvain Benner
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
;;
;; Author: James Conroy-Finn <james@logi.cl>
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; Use sh-mode when opening `.zsh' files, and when opening Prezto runcoms.
(dolist (pattern '("\\.zsh\\'"
"zlogin\\'"
"zlogout\\'"
"zpreztorc\\'"
"zprofile\\'"
"zshenv\\'"
"zshrc\\'"))
(add-to-list 'auto-mode-alist (cons pattern 'sh-mode)))
;; When we open a `.zsh' file set the shell to ZSH.
(add-hook
'sh-mode-hook
(lambda ()
(if (string-match "\\.zsh$" buffer-file-name)
(sh-set-shell "zsh"))))