1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 02:10:05 +08:00

Add repl support for TypeScript (#3274)

This commit is contained in:
Wang Shidong 2020-02-02 12:35:14 +08:00 committed by GitHub
parent d90cf5935c
commit fd7c0a96fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 4 deletions

View File

@ -33,6 +33,7 @@ function! SpaceVim#layers#lang#typescript#config() abort
\ function('s:go_to_def'))
call SpaceVim#mapping#space#regesit_lang_mappings('typescript',
\ function('s:on_ft'))
call SpaceVim#plugins#repl#reg('typescript', ['ts-node', '-i'])
endfunction
function! SpaceVim#layers#lang#typescript#set_variable(var) abort
@ -73,8 +74,6 @@ function! s:on_ft() abort
\ 'preview definition', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'r'], 'TSRefs',
\ 'references', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 's'], 'TSSearch <C-R><C-W> *<CR>',
\ 'search', 1)
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 't'], 'TSType',
\ 'view type', 1)
else
@ -97,6 +96,20 @@ function! s:on_ft() abort
call SpaceVim#mapping#space#langSPC('nnoremap', ['l', 'g', 'd'], 'JsDoc',
\ 'generate JSDoc', 1)
let g:_spacevim_mappings_space.l.s = {'name' : '+Send'}
call SpaceVim#mapping#space#langSPC('nmap', ['l','s', 'i'],
\ 'call SpaceVim#plugins#repl#start("typescript")',
\ '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
function! s:go_to_def() abort

View File

@ -60,7 +60,6 @@ npm install -g typescript
| `SPC l g` | definition |
| `SPC l i` | import |
| `SPC l r` | references |
| `SPC l s` | search |
| `SPC l t` | type |
| `SPC l g d` | generate doc |
| `g d` | defintion preview |

View File

@ -59,7 +59,6 @@ npm install -g typescript
| `SPC l g` | definition |
| `SPC l i` | import |
| `SPC l r` | references |
| `SPC l s` | search |
| `SPC l t` | type |
| `SPC l g d` | generate doc |
| `g d` | defintion preview |