2015-04-03 21:44:11 +00:00
|
|
|
;;; packages.el --- Shell Scripts Layer packages File for Spacemacs
|
|
|
|
;;
|
2020-09-16 21:34:40 +00:00
|
|
|
;; Copyright (c) 2012-2020 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
|
|
|
'(
|
2017-07-03 07:52:54 +00:00
|
|
|
(company-shell :requires company)
|
2016-03-01 13:50:09 +00:00
|
|
|
fish-mode
|
|
|
|
flycheck
|
2016-11-12 21:08:57 +00:00
|
|
|
flycheck-bashate
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
2017-08-26 21:18:09 +00:00
|
|
|
counsel-gtags
|
2016-04-05 04:08:34 +00:00
|
|
|
helm-gtags
|
2016-09-16 18:03:28 +00:00
|
|
|
insert-shebang
|
2017-08-12 10:08:48 +00:00
|
|
|
org
|
2016-05-30 02:39:21 +00:00
|
|
|
(sh-script :location built-in)
|
|
|
|
))
|
|
|
|
|
|
|
|
(defun shell-scripts/init-company-shell ()
|
|
|
|
(use-package company-shell
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-05-30 02:39:21 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends
|
2017-05-19 09:11:37 +00:00
|
|
|
:backends (company-shell company-shell-env)
|
2017-01-02 05:39:04 +00:00
|
|
|
:modes sh-mode)
|
|
|
|
(spacemacs|add-company-backends
|
2017-05-19 09:11:37 +00:00
|
|
|
:backends (company-shell company-shell-env company-fish-shell)
|
2017-01-02 05:39:04 +00:00
|
|
|
:modes fish-mode))))
|
2016-03-01 13:50:09 +00:00
|
|
|
|
|
|
|
(defun shell-scripts/post-init-flycheck ()
|
2017-02-14 03:27:29 +00:00
|
|
|
(spacemacs/enable-flycheck 'sh-mode))
|
2015-04-03 21:44:11 +00:00
|
|
|
|
2016-11-12 21:08:57 +00:00
|
|
|
(defun shell-scripts/init-flycheck-bashate ()
|
|
|
|
(use-package flycheck-bashate
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-08-05 22:10:39 +00:00
|
|
|
:init (add-hook 'sh-mode-hook 'flycheck-bashate-setup)))
|
2016-11-12 21:08:57 +00:00
|
|
|
|
2015-04-03 21:44:11 +00:00
|
|
|
(defun shell-scripts/init-fish-mode ()
|
|
|
|
(use-package fish-mode
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t))
|
2015-11-15 11:49:38 +00:00
|
|
|
|
|
|
|
(defun shell-scripts/init-sh-script ()
|
|
|
|
(use-package sh-script
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-11-15 11:49:38 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2017-08-05 22:10:39 +00:00
|
|
|
;; Add meaningful names for prefix categories
|
|
|
|
(spacemacs/declare-prefix-for-mode 'sh-mode "mi" "insert")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'sh-mode "mg" "goto")
|
|
|
|
|
|
|
|
;; Add standard key bindings for insert commands
|
2016-01-08 14:37:39 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'sh-mode
|
2017-08-05 22:10:39 +00:00
|
|
|
"\\" 'sh-backslash-region
|
|
|
|
"ic" 'sh-case
|
|
|
|
"ii" 'sh-if
|
|
|
|
"if" 'sh-function
|
|
|
|
"io" 'sh-for
|
|
|
|
"ie" 'sh-indexed-loop
|
|
|
|
"iw" 'sh-while
|
|
|
|
"ir" 'sh-repeat
|
|
|
|
"is" 'sh-select
|
|
|
|
"iu" 'sh-until
|
|
|
|
"ig" 'sh-while-getopts)
|
2016-01-08 14:37:39 +00:00
|
|
|
|
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")))
|
2019-01-03 10:53:34 +00:00
|
|
|
(add-hook 'sh-mode-hook 'spacemacs//setup-shell)
|
|
|
|
(add-hook 'sh-mode-hook 'spacemacs//shell-scripts-setup-backend))))
|
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
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun shell-scripts/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'sh-mode))
|
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun shell-scripts/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'sh-mode))
|
2016-09-16 18:03:28 +00:00
|
|
|
|
2017-08-28 17:34:15 +00:00
|
|
|
(defun shell-scripts/pre-init-org ()
|
2017-08-12 10:08:48 +00:00
|
|
|
(spacemacs|use-package-add-hook org
|
|
|
|
:post-config (add-to-list 'org-babel-load-languages '(shell . t))))
|
|
|
|
|
2016-09-16 18:03:28 +00:00
|
|
|
(defun shell-scripts/init-insert-shebang ()
|
|
|
|
(use-package insert-shebang
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-09-16 18:03:28 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2017-08-05 22:10:39 +00:00
|
|
|
;; Insert shebang must be available for non shell modes like python or
|
|
|
|
;; groovy but also in the major mode menu with shell specific inserts
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'sh-mode
|
|
|
|
"i!" 'spacemacs/insert-shebang)
|
2016-09-16 18:03:28 +00:00
|
|
|
(spacemacs/set-leader-keys "i!" 'spacemacs/insert-shebang)
|
|
|
|
;; we don't want to insert shebang lines automatically
|
|
|
|
(remove-hook 'find-file-hook 'insert-shebang))))
|