2015-04-03 21:44:11 +00:00
|
|
|
;;; packages.el --- Shell Scripts Layer packages File for Spacemacs
|
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-04-03 21:44:11 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2015-04-19 03:40:24 +00:00
|
|
|
(setq shell-scripts-packages
|
2016-05-30 02:39:21 +00:00
|
|
|
'(
|
|
|
|
company
|
|
|
|
(company-shell :toggle (configuration-layer/package-usedp 'company))
|
2016-03-01 13:50:09 +00:00
|
|
|
fish-mode
|
|
|
|
flycheck
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
|
|
|
helm-gtags
|
2016-05-30 02:39:21 +00:00
|
|
|
(sh-script :location built-in)
|
|
|
|
))
|
|
|
|
|
|
|
|
(defun shell-scripts/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook sh-mode)
|
|
|
|
(spacemacs|add-company-hook fish-mode))
|
|
|
|
|
|
|
|
(defun shell-scripts/init-company-shell ()
|
|
|
|
(use-package company-shell
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(push 'company-shell company-backends-sh-mode)
|
|
|
|
(push '(company-shell company-fish-shell) company-backends-fish-mode))))
|
2016-03-01 13:50:09 +00:00
|
|
|
|
|
|
|
(defun shell-scripts/post-init-flycheck ()
|
|
|
|
(spacemacs/add-flycheck-hook 'sh-mode))
|
2015-04-03 21:44:11 +00:00
|
|
|
|
|
|
|
(defun shell-scripts/init-fish-mode ()
|
|
|
|
(use-package fish-mode
|
|
|
|
:defer t))
|
2015-11-15 11:49:38 +00:00
|
|
|
|
|
|
|
(defun shell-scripts/init-sh-script ()
|
|
|
|
(use-package sh-script
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(progn
|
2016-01-08 14:37:39 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'sh-mode
|
|
|
|
"\\" 'sh-backslash-region)
|
|
|
|
|
2015-11-15 11:49:38 +00:00
|
|
|
;; 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)))
|
|
|
|
|
|
|
|
(defun spacemacs//setup-shell ()
|
|
|
|
(when (and buffer-file-name
|
2015-11-16 10:07:10 +00:00
|
|
|
(string-match-p "\\.zsh\\'" buffer-file-name))
|
2015-11-15 11:49:38 +00:00
|
|
|
(sh-set-shell "zsh")))
|
|
|
|
(add-hook 'sh-mode-hook 'spacemacs//setup-shell))))
|
2016-02-10 19:48:29 +00:00
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun shell-scripts/post-init-ggtags ()
|
2016-08-15 19:24:44 +00:00
|
|
|
(add-hook 'sh-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
|
|
|
(defun shell-scripts/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'sh-mode))
|