mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-04-14 15:19:12 +08:00
Update doc for lang#swift layer (#3700)
This commit is contained in:
parent
e7e515eaec
commit
e866f12104
@ -6,6 +6,22 @@
|
||||
" License: GPLv3
|
||||
"=============================================================================
|
||||
|
||||
""
|
||||
" @section lang#swig, layer-lang-swift
|
||||
" @parentsection layers
|
||||
" This layer is for swift development, including syntax highlighting and
|
||||
" indent. To enable it:
|
||||
" >
|
||||
" [layers]
|
||||
" name = "lang#swift"
|
||||
" <
|
||||
" @subsection Mappings
|
||||
" >
|
||||
" Key Function
|
||||
" -----------------------------------------------
|
||||
" SPC l k jumping to placeholders
|
||||
" <
|
||||
|
||||
func! SpaceVim#layers#lang#swift#plugins() abort
|
||||
let plugins = []
|
||||
call add(plugins, ['keith/swift.vim', {'merged' : 0}])
|
||||
@ -15,10 +31,30 @@ endf
|
||||
|
||||
|
||||
function! SpaceVim#layers#lang#swift#config() abort
|
||||
call SpaceVim#plugins#repl#reg('swift', 'swift')
|
||||
call SpaceVim#plugins#runner#reg_runner('swift', 'swift %s')
|
||||
call SpaceVim#mapping#space#regesit_lang_mappings('swift', function('s:language_specified_mappings'))
|
||||
endfunction
|
||||
function! s:language_specified_mappings() abort
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','k'],
|
||||
\ '<Plug>(autocomplete_swift_jump_to_placeholder)',
|
||||
\ 'jumping to placeholders', 0)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','r'], 'call SpaceVim#plugins#runner#open()', 'execute current file', 1)
|
||||
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
|
||||
\ 'call SpaceVim#plugins#repl#start("swift")',
|
||||
\ 'start REPL process', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'l'],
|
||||
\ 'call SpaceVim#plugins#repl#send("line")',
|
||||
\ 'send line and keep code buffer focused', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'b'],
|
||||
\ 'call SpaceVim#plugins#repl#send("buffer")',
|
||||
\ 'send buffer and keep code buffer focused', 1)
|
||||
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 's'],
|
||||
\ 'call SpaceVim#plugins#repl#send("selection")',
|
||||
\ 'send selection and keep code buffer focused', 1)
|
||||
endfunction
|
||||
|
||||
" ref:
|
||||
" 1. https://jblevins.org/log/swift
|
||||
" 2. https://medium.com/@mahmudahsan/running-and-compiling-swift-code-in-terminal-237ee4087a9c
|
||||
|
@ -142,22 +142,23 @@ CONTENTS *SpaceVim-contents*
|
||||
66. lang#scala...............................|SpaceVim-layer-lang-scala|
|
||||
67. lang#scheme.............................|SpaceVim-layer-lang-scheme|
|
||||
68. lang#sh.....................................|SpaceVim-layer-lang-sh|
|
||||
69. lang#swig.................................|SpaceVim-layer-lang-swig|
|
||||
70. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
||||
71. lang#toml.................................|SpaceVim-layer-lang-toml|
|
||||
72. lang#typescript.....................|SpaceVim-layer-lang-typescript|
|
||||
73. lang#v.......................................|SpaceVim-layer-lang-v|
|
||||
74. lang#vbnet...............................|SpaceVim-layer-lang-vbnet|
|
||||
75. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
76. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
||||
77. language server protocol........................|SpaceVim-layer-lsp|
|
||||
78. leaderf.....................................|SpaceVim-layer-leaderf|
|
||||
79. operator...................................|SpaceVim-layer-operator|
|
||||
80. shell.........................................|SpaceVim-layer-shell|
|
||||
81. test...........................................|SpaceVim-layer-test|
|
||||
82. tmux...........................................|SpaceVim-layer-tmux|
|
||||
83. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
84. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
||||
69. lang#swig................................|SpaceVim-layer-lang-swift|
|
||||
70. lang#swig.................................|SpaceVim-layer-lang-swig|
|
||||
71. lang#tcl...................................|SpaceVim-layer-lang-tcl|
|
||||
72. lang#toml.................................|SpaceVim-layer-lang-toml|
|
||||
73. lang#typescript.....................|SpaceVim-layer-lang-typescript|
|
||||
74. lang#v.......................................|SpaceVim-layer-lang-v|
|
||||
75. lang#vbnet...............................|SpaceVim-layer-lang-vbnet|
|
||||
76. lang#xml...................................|SpaceVim-layer-lang-xml|
|
||||
77. lang#xquery.............................|SpaceVim-layer-lang-xquery|
|
||||
78. language server protocol........................|SpaceVim-layer-lsp|
|
||||
79. leaderf.....................................|SpaceVim-layer-leaderf|
|
||||
80. operator...................................|SpaceVim-layer-operator|
|
||||
81. shell.........................................|SpaceVim-layer-shell|
|
||||
82. test...........................................|SpaceVim-layer-test|
|
||||
83. tmux...........................................|SpaceVim-layer-tmux|
|
||||
84. tools#dash...............................|SpaceVim-layer-tools-dash|
|
||||
85. tools#zeal...............................|SpaceVim-layer-tools-zeal|
|
||||
7. Usage....................................................|SpaceVim-usage|
|
||||
1. custom_plugins........................|SpaceVim-usage-custom_plugins|
|
||||
2. tasks..........................................|SpaceVim-usage-tasks|
|
||||
@ -3036,6 +3037,23 @@ disabled by default, to enable this layer, add following snippet to your
|
||||
<
|
||||
|
||||
|
||||
==============================================================================
|
||||
LANG#SWIG *SpaceVim-layer-lang-swift*
|
||||
|
||||
This layer is for swift development, including syntax highlighting and indent.
|
||||
To enable it:
|
||||
>
|
||||
[layers]
|
||||
name = "lang#swift"
|
||||
<
|
||||
MAPPINGS
|
||||
|
||||
>
|
||||
Key Function
|
||||
-----------------------------------------------
|
||||
SPC l k jumping to placeholders
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
LANG#SWIG *SpaceVim-layer-lang-swig*
|
||||
|
||||
|
50
docs/_posts/2020-08-10-use-vim-as-a-swift-ide.md
Normal file
50
docs/_posts/2020-08-10-use-vim-as-a-swift-ide.md
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
title: "Use Vim as a Swift IDE"
|
||||
categories: [tutorials, blog]
|
||||
image: https://user-images.githubusercontent.com/13142418/89797871-0d9ca580-db5e-11ea-8d43-c02cd9e49915.png
|
||||
description: "A general guide for using SpaceVim as Swift IDE, including layer configuration, requiems installation and usage."
|
||||
type: article
|
||||
comments: true
|
||||
commentsID: "Use Vim as a Swift IDE"
|
||||
---
|
||||
|
||||
# [Blogs](../blog/) >> Use Vim as a Swift IDE
|
||||
|
||||
This is a general guide for using SpaceVim as a Swift IDE, including layer configuration and usage.
|
||||
Each of the following sections will be covered:
|
||||
|
||||
<!-- vim-markdown-toc GFM -->
|
||||
|
||||
- [Enable language layer](#enable-language-layer)
|
||||
- [code running](#code-running)
|
||||
- [REPL support](#repl-support)
|
||||
|
||||
<!-- vim-markdown-toc -->
|
||||
|
||||
### Enable language layer
|
||||
|
||||
To add swift language support in SpaceVim, you need to enable the `lang#swift` layer. Press `SPC f v d` to open
|
||||
SpaceVim configuration file, and add following configuration:
|
||||
|
||||
```toml
|
||||
[[layers]]
|
||||
name = "lang#swift"
|
||||
```
|
||||
|
||||
for more info, you can read the [lang#swift](../layers/lang/swift/) layer documentation.
|
||||
|
||||
### code running
|
||||
|
||||
The default code running key binding is `SPC l r`. It will run `swift current_file` asynchronously.
|
||||
And the stdout will be shown on a runner buffer.
|
||||
|
||||

|
||||
|
||||
### REPL support
|
||||
|
||||
Start a `swift` inferior REPL process with `SPC l s i`. After the REPL process being started, you can
|
||||
send code to inferior process. All key bindings prefix with `SPC l s`, including sending line, sending selection or even
|
||||
send whole buffer.
|
||||
|
||||

|
||||
|
Loading…
x
Reference in New Issue
Block a user