diff --git a/layers/+lang/shell-scripts/README.org b/layers/+lang/shell-scripts/README.org index 3ca3ea8e7..c1afa85d0 100644 --- a/layers/+lang/shell-scripts/README.org +++ b/layers/+lang/shell-scripts/README.org @@ -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 diff --git a/layers/+lang/shell-scripts/config.el b/layers/+lang/shell-scripts/config.el new file mode 100644 index 000000000..2b00fbfc5 --- /dev/null +++ b/layers/+lang/shell-scripts/config.el @@ -0,0 +1,14 @@ +;;; config.el --- Shell Scripts Layer Configuration File for Spacemacs +;; +;; Copyright (c) 2012-2016 Sylvain Benner & Contributors +;; +;; Author: Sylvain Benner +;; 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) diff --git a/layers/+lang/shell-scripts/packages.el b/layers/+lang/shell-scripts/packages.el index 26bf68d6b..7d81a10db 100644 --- a/layers/+lang/shell-scripts/packages.el +++ b/layers/+lang/shell-scripts/packages.el @@ -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)))))