Add windows-scripts layer for poweshell and dos

This commit is contained in:
syl20bnr 2014-12-13 00:31:01 -05:00
parent f5a200e66a
commit e2634674a9
7 changed files with 93 additions and 10 deletions

View file

@ -0,0 +1,55 @@
# Windows Scripting contribution layer for Spacemacs
![logo](ps.png)
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc/generate-toc again -->
**Table of Contents**
- [Windows Scripting contribution layer for Spacemacs](#windows-scripting-contribution-layer-for-spacemacs)
- [Description](#description)
- [Install](#install)
- [Key Bindings](#key-bindings)
- [Powershell](#powershell)
- [Batch (dos.el)](#batch-dosel)
<!-- markdown-toc end -->
## Description
This simple layer adds support for the Powershell scripting language as well
as support for batch files.
Incuded packages for extensions:
- `.ps1`: [powershell][]
- `.bat`: [dos.el][]
## Install
To use this contribution add it to your `~/.spacemacs`
```elisp
(setq-default dotspacemacs-configuration-layers '(windows-scripts)
"List of contribution to load."
)
```
## Key Bindings
### Powershell
No useful bindings.
### Batch (dos.el)
Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>SPC m D</kbd> | ask for a command and display help
<kbd>SPC m e b</kbd> | evaluate buffer
<kbd>SPC m e B</kbd> | evaluate buffer with args
<kbd>SPC m s</kbd> | insert separator ` & `
<kbd>SPC m t</kbd> | mini snippet to start a batch script
<kbd>SPC m T</kbd> | big snippet to start a batch script
<kbd>SPC m z</kbd> | toggle outline
[powershell]: https://github.com/jschaf/powershell.el
[dos.el]: http://www.emacswiki.org/emacs/dos.el

View file

@ -0,0 +1,28 @@
;; Post extensions are loaded *after* the packages
(defvar windows-scripts-post-extensions '(dos))
;; Initialize the extensions
(defun windows-scripts/init-dos ()
(use-package dos
:commands dos-mode
:mode ("\\.bat$" . dos-mode)
:init
(progn
(defun windows-scripts/dos-outline-hook ()
(local-set-key (kbd "SPC m z") 'dos-mode)
(defun outline-mouse-select ()
"Select position and return to `dos-mode'."
(interactive)
(dos-mode)
(beginning-of-line)))
(add-hook 'outline-mode-hook 'windows-scripts/dos-outline-hook))
:config
(evil-leader/set-key-for-mode 'dos-mode
"mD" 'dos-help-cmd
"meb" 'dos-run
"meB" 'dos-run-args
"ms" 'dos-sep
"mt" 'dos-template-mini
"mT" 'dos-template
"mz" 'dos-outline)))

View file

@ -0,0 +1,10 @@
(defvar windows-scripts-packages
'(
powershell
)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defun windows-scripts/init-powershell ()
(use-package powershell
:defer t))

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View file

@ -10,7 +10,6 @@
(defvar spacemacs-post-extensions
'(
centered-cursor
dos
emoji-cheat-sheet
evil-plugins
helm-rcirc
@ -39,10 +38,6 @@
evil-mouse-drag-region))))
(spacemacs|diminish centered-cursor-mode ""))))
(defun spacemacs/init-dos ()
(use-package dos
:mode ("\\.bat$" . dos-mode)))
(defun spacemacs/init-emoji-cheat-sheet ()
(use-package emoji-cheat-sheet
:commands emoji-cheat-sheet))

View file

@ -91,7 +91,6 @@
popup
popwin
powerline
powershell
projectile
puppet-mode
;; not working well for now
@ -1839,10 +1838,6 @@ determine the state to enable when escaping from the insert state.")
(powerline-render rhs))))))
)))
(defun spacemacs/init-powershell ()
(use-package powershell
:defer t))
(defun spacemacs/init-projectile ()
(use-package projectile
:commands (projectile-ack