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

Add statusline for repl

This commit is contained in:
wsdjeg 2017-12-12 15:14:35 +08:00
parent b19851d3d6
commit 4ec6a9d015
2 changed files with 12 additions and 2 deletions

View File

@ -351,6 +351,8 @@ function! SpaceVim#layers#core#statusline#get(...) abort
return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#' return '%#SpaceVim_statusline_a# HelpDescribe %#SpaceVim_statusline_a_SpaceVim_statusline_b#'
elseif &filetype ==# 'SpaceVimRunner' elseif &filetype ==# 'SpaceVimRunner'
return '%#SpaceVim_statusline_a# Runner %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{SpaceVim#plugins#runner#status()}' return '%#SpaceVim_statusline_a# Runner %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{SpaceVim#plugins#runner#status()}'
elseif &filetype ==# 'SpaceVimREPL'
return '%#SpaceVim_statusline_a# REPL %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{SpaceVim#plugins#repl#status()}'
elseif &filetype ==# 'VimMailClient' elseif &filetype ==# 'VimMailClient'
return '%#SpaceVim_statusline_a# VimMail %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{mail#client#win#status().dir}' return '%#SpaceVim_statusline_a# VimMail %#SpaceVim_statusline_a_SpaceVim_statusline_b# %{mail#client#win#status().dir}'
elseif &filetype ==# 'SpaceVimQuickFix' elseif &filetype ==# 'SpaceVimQuickFix'

View File

@ -48,15 +48,15 @@ endfunction
function! s:start(exe) abort function! s:start(exe) abort
call s:open_windows()
let s:lines = 0 let s:lines = 0
let s:status = { let s:status = {
\ 'is_running' : 0, \ 'is_running' : 1,
\ 'is_exit' : 0, \ 'is_exit' : 0,
\ 'has_errors' : 0, \ 'has_errors' : 0,
\ 'exit_code' : 0 \ 'exit_code' : 0
\ } \ }
let s:start_time = reltime() let s:start_time = reltime()
call s:open_windows()
call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[REPL executable] ' . a:exe, '', repeat('-', 20)]) call s:BUFFER.buf_set_lines(s:bufnr, s:lines , s:lines + 3, 0, ['[REPL executable] ' . a:exe, '', repeat('-', 20)])
let s:lines += 3 let s:lines += 3
let s:job_id = s:JOB.start(a:exe,{ let s:job_id = s:JOB.start(a:exe,{
@ -158,6 +158,14 @@ function! SpaceVim#plugins#repl#reg(ft, execute) abort
endfunction endfunction
function! SpaceVim#plugins#repl#status() abort
if s:status.is_running == 1
return 'running'
elseif s:status.is_exit == 1
return 'exit code : ' . s:status.exit_code
\ . ' time: ' . s:STRING.trim(reltimestr(s:end_time))
endif
endfunction
let s:bufnr = 0 let s:bufnr = 0
function! s:open_windows() abort function! s:open_windows() abort