2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- Windows Scripts Layer packages File for Spacemacs
|
|
|
|
;;
|
2021-03-22 20:11:29 +00:00
|
|
|
;; Copyright (c) 2012-2021 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
2021-03-24 03:31:44 +00:00
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2015-01-14 04:12:56 +00:00
|
|
|
|
2020-07-06 21:13:52 +00:00
|
|
|
(defconst windows-scripts-packages
|
2014-12-13 05:31:01 +00:00
|
|
|
'(
|
2021-03-19 03:44:21 +00:00
|
|
|
(bat-mode :location built-in)
|
|
|
|
bmx-mode
|
|
|
|
(counsel-gtags :if (configuration-layer/package-used-p 'counsel))
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
2021-03-19 03:44:21 +00:00
|
|
|
(helm-gtags :if (configuration-layer/package-used-p 'helm))
|
2020-07-06 21:13:52 +00:00
|
|
|
powershell))
|
2014-12-13 05:31:01 +00:00
|
|
|
|
2021-03-19 03:44:21 +00:00
|
|
|
(defun windows-scripts/init-bat-mode()
|
|
|
|
(use-package bat-mode
|
|
|
|
:commands (bat-cmd-help bat-run bat-run-args bat-template)
|
|
|
|
:mode (("\\.bat\\'" . bat-mode)
|
|
|
|
("\\.cmd\\'" . bat-mode))
|
|
|
|
:hook (outline-mode . windows-scripts/bat-outline-setup)
|
2016-01-18 03:06:04 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2021-03-19 03:44:21 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode 'bat-mode "me" "eval")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'bat-mode "mh" "help")
|
|
|
|
(spacemacs/declare-prefix-for-mode 'bat-mode "mi" "insert"))
|
|
|
|
:spacebind
|
|
|
|
(:major
|
|
|
|
(bat-mode
|
|
|
|
("e" "eval"
|
|
|
|
("b" bat-run "eval buffer")
|
|
|
|
("B" bat-run-args "eval buffer with args"))
|
|
|
|
("h" "help"
|
|
|
|
("h" bat-cmd-help "show help of cmd"))
|
|
|
|
("i" "insert"
|
|
|
|
("t" bat-template "insert minimal template"))
|
|
|
|
("z" windows-scripts/bat-outline "batch file outline")))))
|
|
|
|
|
|
|
|
(defun windows-scripts/init-bmx-mode()
|
|
|
|
(use-package bmx-mode
|
|
|
|
:commands (bmx-insert-colon-and-complete
|
|
|
|
bmx-fixup-labels
|
|
|
|
bmx-insert-percentage-and-complete
|
|
|
|
bmx-fixup-variable
|
|
|
|
bmx-find-references-at-point
|
|
|
|
bmx-navigate-to-symbol-at-point
|
|
|
|
bmx-rename-symbol-at-point
|
|
|
|
bmx-fixup-labels-and-variables)
|
|
|
|
:hook bat-mode
|
|
|
|
:spacebind
|
|
|
|
(:minor
|
|
|
|
(bmx-mode
|
|
|
|
("g" "goto"
|
|
|
|
("d" bmx-navigate-to-symbol-at-point "go to definition")
|
|
|
|
("r" bmx-find-references-at-point "find references"))
|
|
|
|
("r" "refactor"
|
|
|
|
("r" bmx-rename-symbol-at-point "rename symbol")
|
|
|
|
("f" bmx-fixup-labels-and-variables ("ensure all symbols has consistent casing/syntax"
|
|
|
|
:label "bmx-fixup")))))))
|
|
|
|
|
|
|
|
(defun windows-scripts/post-init-company ()
|
|
|
|
(when (configuration-layer/package-used-p 'company)
|
|
|
|
(add-hook 'company-completion-finished-hook #'bmx--company-completion-finished-hook)
|
|
|
|
(spacemacs|add-company-backends
|
|
|
|
:backends (bmx--company-label-backend bmx--company-variable-backend company-files company-capf)
|
|
|
|
:modes bat-mode)))
|
2016-01-18 03:06:04 +00:00
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun windows-scripts/post-init-ggtags ()
|
2021-03-19 03:44:21 +00:00
|
|
|
(add-hook 'bat-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 windows-scripts/post-init-counsel-gtags ()
|
2021-03-19 03:44:21 +00:00
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'bat-mode))
|
2017-08-26 21:18:09 +00:00
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun windows-scripts/post-init-helm-gtags ()
|
2021-03-19 03:44:21 +00:00
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'bat-mode))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
2014-12-13 05:31:01 +00:00
|
|
|
(defun windows-scripts/init-powershell ()
|
|
|
|
(use-package powershell
|
2016-05-13 06:36:24 +00:00
|
|
|
:mode (("\\.ps1\\'" . powershell-mode)
|
|
|
|
("\\.psm1\\'" . powershell-mode))
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2015-05-31 00:11:55 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(defun powershell/define-text-objects ()
|
2020-07-06 21:13:52 +00:00
|
|
|
(spacemacs|define-text-object "$" "dollarparen" "$(" ")"))
|
2015-05-31 00:11:55 +00:00
|
|
|
(add-hook 'powershell-mode-hook 'powershell/define-text-objects)
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys
|
2020-07-06 21:13:52 +00:00
|
|
|
"atsp" 'powershell)
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'powershell-mode
|
2021-03-19 03:44:21 +00:00
|
|
|
"rr" 'powershell-regexp-to-regex))))
|
2020-07-06 21:13:52 +00:00
|
|
|
;; TODO
|
|
|
|
;; - split out powershell
|
|
|
|
;; - get help output with mgg (Get-Help) or Get-Help -online
|
|
|
|
;; -
|