mirror of
https://github.com/SpaceVim/SpaceVim.git
synced 2025-03-12 09:35:40 +08:00
Add stdin support for python (#2536)
* Add stdin support for python * Remove extra line break in stdout
This commit is contained in:
parent
294f723469
commit
8391fa1fa8
@ -53,7 +53,8 @@ function! SpaceVim#layers#lang#python#config() abort
|
|||||||
call SpaceVim#plugins#runner#reg_runner('python',
|
call SpaceVim#plugins#runner#reg_runner('python',
|
||||||
\ {
|
\ {
|
||||||
\ 'exe' : function('s:getexe'),
|
\ 'exe' : function('s:getexe'),
|
||||||
\ 'opt' : [],
|
\ 'opt' : ['-'],
|
||||||
|
\ 'usestdin' : 1,
|
||||||
\ })
|
\ })
|
||||||
call SpaceVim#mapping#gd#add('python', function('s:go_to_def'))
|
call SpaceVim#mapping#gd#add('python', function('s:go_to_def'))
|
||||||
call SpaceVim#mapping#space#regesit_lang_mappings('python', function('s:language_specified_mappings'))
|
call SpaceVim#mapping#space#regesit_lang_mappings('python', function('s:language_specified_mappings'))
|
||||||
|
@ -156,6 +156,7 @@ endfunction
|
|||||||
" @vimlint(EVL103, 1, a:data)
|
" @vimlint(EVL103, 1, a:data)
|
||||||
" @vimlint(EVL103, 1, a:event)
|
" @vimlint(EVL103, 1, a:event)
|
||||||
if has('nvim') && exists('*chanclose')
|
if has('nvim') && exists('*chanclose')
|
||||||
|
" remoet
at the end of each
|
||||||
let s:_out_data = ['']
|
let s:_out_data = ['']
|
||||||
function! s:on_stdout(job_id, data, event) abort
|
function! s:on_stdout(job_id, data, event) abort
|
||||||
let s:_out_data[-1] .= a:data[0]
|
let s:_out_data[-1] .= a:data[0]
|
||||||
@ -167,6 +168,7 @@ if has('nvim') && exists('*chanclose')
|
|||||||
let lines = s:_out_data
|
let lines = s:_out_data
|
||||||
endif
|
endif
|
||||||
if !empty(lines)
|
if !empty(lines)
|
||||||
|
let lines = map(lines, "substitute(v:val, '
$', '', 'g')")
|
||||||
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
|
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 1, 0, lines)
|
||||||
endif
|
endif
|
||||||
let s:lines += len(lines)
|
let s:lines += len(lines)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user