Add company-shell to shell-scripts layer
This commit is contained in:
parent
bc0d0de821
commit
2af4633b4d
|
@ -5,6 +5,7 @@
|
|||
|
||||
* Table of Contents :TOC_4_org:noexport:
|
||||
- [[Description][Description]]
|
||||
- [[Features][Features]]
|
||||
- [[Install][Install]]
|
||||
- [[Key Bindings][Key Bindings]]
|
||||
|
||||
|
@ -18,6 +19,9 @@ Supported scripting files:
|
|||
|
||||
*Note:* For Windows scripting see the layer =windows-scripts=
|
||||
|
||||
** Features
|
||||
- Auto-completion using [[https://github.com/Alexander-Miller/company-shell][company-shell]]
|
||||
|
||||
* Install
|
||||
To use this configuration layer, add it to your =~/.spacemacs=. You will need to
|
||||
add =shell-scripts= to the existing =dotspacemacs-configuration-layers= list in this
|
||||
|
|
14
layers/+lang/shell-scripts/config.el
Normal file
14
layers/+lang/shell-scripts/config.el
Normal file
|
@ -0,0 +1,14 @@
|
|||
;;; config.el --- Shell Scripts Layer Configuration File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
;; variables
|
||||
(spacemacs|defvar-company-backends sh-mode)
|
||||
(spacemacs|defvar-company-backends fish-mode)
|
|
@ -12,6 +12,8 @@
|
|||
(setq shell-scripts-packages
|
||||
'(fish-mode
|
||||
(sh-script :location built-in)
|
||||
company
|
||||
company-shell
|
||||
))
|
||||
|
||||
(defun shell-scripts/init-fish-mode ()
|
||||
|
@ -41,3 +43,18 @@
|
|||
(string-match-p "\\.zsh\\'" buffer-file-name))
|
||||
(sh-set-shell "zsh")))
|
||||
(add-hook 'sh-mode-hook 'spacemacs//setup-shell))))
|
||||
|
||||
|
||||
(when (configuration-layer/layer-usedp 'auto-completion)
|
||||
(defun python/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
|
||||
:if (configuration-layer/package-usedp 'company)
|
||||
:defer t
|
||||
:init
|
||||
(progn
|
||||
(push 'company-shell company-backends-sh-mode)
|
||||
(push '(company-shell company-fish-shell) company-backends-fish-mode)))))
|
||||
|
|
Loading…
Reference in a new issue