2015-12-04 04:51:31 +00:00
|
|
|
|
#+TITLE: Swift layer
|
2015-10-19 11:17:24 +00:00
|
|
|
|
|
|
|
|
|
[[file:img/swift.png]]
|
|
|
|
|
|
2018-09-19 03:54:47 +00:00
|
|
|
|
* Table of Contents :TOC_4_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
|
- [[#description][Description]]
|
2017-08-31 16:25:47 +00:00
|
|
|
|
- [[#features][Features:]]
|
2017-05-22 14:16:12 +00:00
|
|
|
|
- [[#install][Install]]
|
|
|
|
|
- [[#usage-information][Usage information]]
|
|
|
|
|
- [[#key-bindings][Key bindings]]
|
|
|
|
|
- [[#swift-mode][swift-mode]]
|
|
|
|
|
- [[#swift-repl-mode][swift-repl-mode]]
|
2015-10-19 11:17:24 +00:00
|
|
|
|
|
|
|
|
|
* Description
|
2018-09-19 03:54:47 +00:00
|
|
|
|
This layer adds support for Apple’s Swift programming language, used as a
|
2015-10-19 11:17:24 +00:00
|
|
|
|
general purpose scripting language.
|
|
|
|
|
|
2017-08-31 16:25:47 +00:00
|
|
|
|
** Features:
|
2018-09-19 03:54:47 +00:00
|
|
|
|
- Syntax highlighting with [[https://github.com/swift-emacs/swift-mode][swift-mode]]
|
|
|
|
|
- Indentation
|
|
|
|
|
- Code navigation using =imenu= (built-in)
|
|
|
|
|
- Automatic syntax checking with =flycheck= (available with the
|
|
|
|
|
=syntax-checking= layer)
|
2015-10-19 11:17:24 +00:00
|
|
|
|
|
|
|
|
|
* Install
|
2016-01-06 05:21:55 +00:00
|
|
|
|
First check that you are able to run this from the command line:
|
2015-10-19 11:17:24 +00:00
|
|
|
|
|
|
|
|
|
On OS X:
|
2018-07-10 10:57:25 +00:00
|
|
|
|
|
2015-10-19 11:17:24 +00:00
|
|
|
|
#+BEGIN_SRC sh
|
2016-04-13 03:31:38 +00:00
|
|
|
|
xcrun swift
|
2015-10-19 11:17:24 +00:00
|
|
|
|
#+END_SRC
|
|
|
|
|
|
2016-01-06 05:21:55 +00:00
|
|
|
|
Then to use this configuration layer, add it to your =~/.spacemacs=. You will
|
|
|
|
|
need to add =swift= to the existing =dotspacemacs-configuration-layers= list in
|
|
|
|
|
this file.
|
|
|
|
|
|
2015-10-19 11:17:24 +00:00
|
|
|
|
* Usage information
|
2016-11-22 20:53:50 +00:00
|
|
|
|
Unless configured by the user, the REPL will be invoked using the command =xcrun
|
|
|
|
|
swift=.
|
2015-10-19 11:17:24 +00:00
|
|
|
|
You can launch the REPL using the keybinding ~SPC m s s~ (or ~C-c C-z~).
|
|
|
|
|
The universal prefix ~SPC u~ (~C-u~) may be used to modify command invocation.
|
|
|
|
|
|
|
|
|
|
* Key bindings
|
|
|
|
|
** swift-mode
|
|
|
|
|
|
2015-12-04 04:43:49 +00:00
|
|
|
|
| Key bindings | Description |
|
|
|
|
|
|--------------+------------------------|
|
|
|
|
|
| ~SPC m s s~ | swift-mode-run-repl |
|
|
|
|
|
| ~SPC m s b~ | swift-mode-send-buffer |
|
|
|
|
|
| ~SPC m s r~ | swift-mode-send-region |
|
2015-10-19 11:17:24 +00:00
|
|
|
|
|
2016-04-13 03:31:38 +00:00
|
|
|
|
Notes:
|
2016-11-22 20:53:50 +00:00
|
|
|
|
1. =swift-mode-run-repl= will run or switch to an existing REPL.
|
2015-10-19 11:17:24 +00:00
|
|
|
|
2. To edit the command invocation, prefix with ~SPC u~ (or ~C-u~).
|
|
|
|
|
3. Emacs key bindings in use are the those set by the package.
|
|
|
|
|
|
|
|
|
|
** swift-repl-mode
|
|
|
|
|
|
2015-12-04 04:43:49 +00:00
|
|
|
|
| Key bindings | Description |
|
|
|
|
|
|--------------+-----------------------------|
|
|
|
|
|
| ~SPC m s s~ | swift-repl-mode-switch-back |
|