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

feat(repl): add i key binding to insert text

This commit is contained in:
wsdjeg 2022-10-20 22:33:26 +08:00
parent 8ec9409fda
commit 02afefa413
2 changed files with 19 additions and 4 deletions

View File

@ -202,6 +202,7 @@ function! s:open_windows() abort
setlocal buftype=nofile bufhidden=wipe nobuflisted nolist noswapfile nowrap cursorline nospell nonu norelativenumber winfixheight nomodifiable
set filetype=SpaceVimREPL
nnoremap <silent><buffer> q :call <SID>close()<cr>
nnoremap <silent><buffer> i :call <SID>insert()<cr>
augroup spacevim_repl
autocmd!
autocmd BufWipeout <buffer> call <SID>close_repl()
@ -210,3 +211,13 @@ function! s:open_windows() abort
let s:winid = win_getid(winnr())
wincmd p
endfunction
function! s:insert() abort
call inputsave()
let input = input('input >')
if !empty(input) && s:status.is_running == 1
call s:JOB.send(s:job_id, input)
endif
normal! :
call inputrestore()
endfunction

View File

@ -88,7 +88,7 @@ description: "General documentation about how to use SpaceVim, including the qui
- [Replace text with iedit](#replace-text-with-iedit)
- [iedit states key bindings](#iedit-states-key-bindings)
- [Code runner](#code-runner)
- [Read Eval Print Loop](#read-eval-print-loop)
- [REPL(read eval print loop)](#replread-eval-print-loop)
- [Highlight current symbol](#highlight-current-symbol)
- [Error handling](#error-handling)
- [EditorConfig](#editorconfig)
@ -571,7 +571,6 @@ In font transient state:
| `-` | decrease the font size |
| Any other key | leave the transient state |
### Mouse
Mouse support is enabled in Normal mode and Visual mode by default.
@ -954,7 +953,6 @@ If only one file buffer is opened, a file is opened in the active window, otherw
| `s g` | open file in a vertically split window |
| `s v` | open file in a horizontally split window |
#### Override filetree key bindings
If you want to override the default key bindings in filetree windows. You can use User autocmd in bootstrap function. for examples:
@ -2400,12 +2398,18 @@ Key bindings within code runner buffer:
| `ctrl-c` | stop code runner |
| `i` | open promote to insert text |
### Read Eval Print Loop
### REPL(read eval print loop)
The REPL(Read Eval Print Loop) plugin provides a framework to run REPL command asynchronously.
For different language, you need to checkout the doc of language layer. The repl key bindings are defined in language layer.
Key bindings within repl buffer:
| key binding | description |
| ----------- | --------------------------- |
| `i` | open promote to insert text |
### Highlight current symbol
SpaceVim supports highlighting of the current symbol on demand and add a transient state to easily navigate and rename these symbols.