1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:40:06 +08:00

Update lang#coffeescript layer (#4229)

This commit is contained in:
Wang Shidong 2021-04-24 22:41:36 +08:00 committed by GitHub
parent 1512348f09
commit dbd644225e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 4 deletions

View File

@ -32,7 +32,13 @@
" SPC l s l send current line
" SPC l s s send selection text
" <
"
if exists('s:coffee_interpreter')
finish
endif
let s:coffee_interpreter = 'coffee' . (s:SYS.isWindows ? '.CMD' : '')
let s:SYS = SpaceVim#api#import('system')
@ -45,12 +51,12 @@ endfunction
function! SpaceVim#layers#lang#coffeescript#config() abort
call SpaceVim#plugins#runner#reg_runner('coffee', {
\ 'exe' : 'coffee' . (s:SYS.isWindows ? '.CMD' : ''),
\ 'exe' : s:coffee_interpreter,
\ 'usestdin' : 1,
\ 'opt': ['-s'],
\ })
" call SpaceVim#plugins#runner#reg_runner('coffee', 'coffee %s')
call SpaceVim#plugins#repl#reg('coffee', ['coffee' . (s:SYS.isWindows ? '.CMD' : ''), '-i'])
call SpaceVim#plugins#repl#reg('coffee', [s:coffee_interpreter, '-i'])
call SpaceVim#mapping#space#regesit_lang_mappings('coffee', function('s:language_specified_mappings'))
endfunction
@ -99,3 +105,6 @@ endfunction
function! s:filter_coffee_lint(lines, job) abort
let a:lines = []
endfunction
function! SpaceVim#layers#lang#coffeescript#set_variable(var) abort
let s:coffee_interpreter = get(a:var, 'coffee_interpreter', s:coffee_interpreter)
endfunction

View File

@ -1752,7 +1752,6 @@ This layer also provides REPL support for coffeescript, the key bindings are:
SPC l s s send selection text
<
==============================================================================
LANG#CRYSTAL *SpaceVim-layer-lang-crystal*

View File

@ -10,6 +10,9 @@ description: "This layer is for CoffeeScript development, provide autocompletion
- [Description](#description)
- [Features](#features)
- [Install](#install)
- [Key bindings](#key-bindings)
- [Running current script](#running-current-script)
- [Inferior REPL process](#inferior-repl-process)
<!-- vim-markdown-toc -->
@ -33,3 +36,23 @@ To use this configuration layer, update custom configuration file with:
[[layers]]
name = "lang#coffeescript"
```
## Key bindings
### Running current script
To running a coffeescript file, you can press `SPC l r` to run current file without loss focus,
and the result will be shown in a runner buffer.
### Inferior REPL process
Start a `coffee -i` inferior REPL process with `SPC l s i`.
Send code to inferior process commands:
| Key Bindings | Descriptions |
| ------------ | ------------------------------------------------ |
| `SPC l s b` | send buffer and keep code buffer focused |
| `SPC l s l` | send line and keep code buffer focused |
| `SPC l s s` | send selection text and keep code buffer focused |