2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/sh/config.el -*- lexical-binding: t; -*-
|
2015-09-28 14:22:26 -04:00
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! sh-script ; built-in
|
2017-05-29 00:58:12 +02:00
|
|
|
:mode ("\\.zsh$" . sh-mode)
|
|
|
|
:mode ("/bspwmrc$" . sh-mode)
|
2017-02-19 18:57:16 -05:00
|
|
|
:init
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook! sh-mode #'(flycheck-mode highlight-numbers-mode +sh|extra-fontify))
|
2016-05-13 00:29:07 -04:00
|
|
|
:config
|
2017-02-23 00:06:12 -05:00
|
|
|
(set! :electric 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
|
2017-04-17 02:17:10 -04:00
|
|
|
(set! :repl 'sh-mode #'+sh/repl)
|
2016-04-20 01:50:55 -04:00
|
|
|
(setq sh-indent-after-continuation 'always)
|
|
|
|
|
2017-05-28 16:12:28 +02:00
|
|
|
;; sh-mode has file extensions checks for other shells, but not zsh, so...
|
2017-02-19 18:57:16 -05:00
|
|
|
(defun +sh|detect-zsh ()
|
|
|
|
(when (and buffer-file-name (string-match-p "\\.zsh\\'" buffer-file-name))
|
|
|
|
(sh-set-shell "zsh")))
|
2017-04-17 02:17:10 -04:00
|
|
|
(add-hook 'sh-mode-hook #'+sh|detect-zsh))
|
2017-02-19 18:57:16 -05:00
|
|
|
|
|
|
|
|
2017-02-23 00:06:12 -05:00
|
|
|
(def-package! company-shell
|
2017-03-19 22:47:50 -04:00
|
|
|
:when (featurep! :completion company)
|
2016-04-23 22:08:46 -04:00
|
|
|
:after sh-script
|
2017-03-20 16:32:29 -04:00
|
|
|
:config
|
|
|
|
(set! :company-backend 'sh-mode '(company-shell))
|
|
|
|
(setq company-shell-delete-duplicates t))
|
2016-04-23 22:08:46 -04:00
|
|
|
|