TypeScript layer: tweak layer

- remove not necessary binding for flymake
- adapt key bindings to conventions
- minor reformat of README.md
This commit is contained in:
syl20bnr 2015-05-08 00:16:26 -04:00
parent f9fa443f83
commit 37e515a57c
2 changed files with 20 additions and 26 deletions

View file

@ -15,16 +15,19 @@
## Description
This adds support for TypeScript editing via [typescript-tools](https://github.com/clausreinke/typescript-tools) and [emacs-tss](https://github.com/aki2o/emacs-tss).
This layer adds support for TypeScript editing via [typescript-tools][] and
[emacs-tss][].
These provide:
This layer provides:
- syntax coloring
- error highlighting
- autocompletion
- auto-completion via Flymake
- jump-to-definition
## Install
### Layer
To use this contribution add it to your `~/.spacemacs`
```elisp
@ -33,9 +36,10 @@ To use this contribution add it to your `~/.spacemacs`
### Prerequisites
You'll need [typescript-tools](https://github.com/clausreinke/typescript-tools) and fairly obviously also the TypeScript compiler:
You'll need [typescript-tools][] and fairly obviously also the TypeScript
compiler:
```
```sh
$ npm install typescript
$ git clone git://github.com/clausreinke/typescript-tools.git
$ cd typescript-tools/
@ -46,6 +50,8 @@ $ npm install -g
Key Binding | Description
--------------|------------------------------------------------------------
`<SPC> m h` | Show popup help (with type info)
`<SPC> m d` | Jump to definition
`<SPC> m c f` | Flymake check (is done automatically on save)
`<SPC> m g g` | Jump to definition
`<SPC> m h h` | Show popup help (with type info)
[emacs-tss]: https://github.com/aki2o/emacs-tss
[typescript-tools]: https://github.com/clausreinke/typescript-tools

View file

@ -10,26 +10,14 @@
;;
;;; License: GPLv3
(defvar typescript-packages '(tss)
"List of all packages to install and/or initialize. Built-in packages
which require an initialization must be listed explicitly in the list.")
(defvar typescript-excluded-packages '()
"List of packages to exclude.")
(setq typescript-packages '(tss))
(defun typescript/init-tss ()
"Initialize my package"
(use-package tss
:mode ("\\.ts\\'" . typescript-mode)
:defer t
:init
(progn
(require 'typescript)
(require 'tss)
(evil-leader/set-key-for-mode 'typescript-mode
"mh" 'tss-popup-help
"md" 'tss-jump-to-definition
"mcf" 'tss-run-flymake))
:config
(progn
(tss-config-default))))
:mode ("\\.ts\\'" . typescript-mode)
:init (evil-leader/set-key-for-mode 'typescript-mode
"mgg" 'tss-jump-to-definition
"mhh" 'tss-popup-help)
:config (tss-config-default)))