Skip to content

Commit b7877e0

Browse files
committed
Handle checkhealth outside of tmux gracefully
1 parent c13fe0f commit b7877e0

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

autoload/tpipeline.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ func tpipeline#deferred_cleanup()
340340
endfunc
341341

342342
func tpipeline#job_state()
343+
if !exists('s:job')
344+
return "dead (init not called)"
345+
endif
346+
343347
let res = ""
344348
if s:is_nvim
345349
let pid = 0

autoload/tpipeline/debug.vim

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,34 @@ func tpipeline#debug#os()
1616
endfunc
1717

1818
func tpipeline#debug#info()
19-
let left = readfile(s:tpipeline_filepath)
20-
let right = readfile(s:tpipeline_right_filepath)
19+
if filereadable(s:tpipeline_filepath)
20+
let left = readfile(s:tpipeline_filepath)
21+
else
22+
let left = ''
23+
endif
24+
if filereadable(s:tpipeline_right_filepath)
25+
let right = readfile(s:tpipeline_right_filepath)
26+
else
27+
let right = ''
28+
endif
2129
let tmux = systemlist("tmux -V")[-1]
2230
let jobstate = tpipeline#job_state()
2331
let os = tpipeline#debug#os()
2432
let bad_colors = len(tpipeline#debug#get_bad_hl_groups())
2533
let result = #{left: left, right: right, tmux: tmux, plugin_version: tpipeline#version#string(), job_state: jobstate, job_errors: s:stderr, os: os, bad_colors: bad_colors}
2634

2735
if has('nvim')
28-
let stl = g:tpipeline_statusline
36+
let stl = get(g:, 'tpipeline_statusline', '')
2937
if empty(stl)
3038
let stl = &stl
3139
endif
32-
let native = nvim_eval_statusline(stl, #{highlights: 1, use_tabline: g:tpipeline_tabline})
40+
let native = nvim_eval_statusline(stl, #{highlights: 1, use_tabline: get(g:, 'tpipeline_tabline', 0)})
3341
let brand = 'neovim'
3442
let version_info = join(luaeval("vim.inspect(vim.version())")->split('\n'))
3543

3644
let result.native_str = native.str
3745
let result.native_highlights = native.highlights
38-
let result.tpipeline_size = g:tpipeline_size
46+
let result.tpipeline_size = get(g:, 'tpipeline_size', 0)
3947
else
4048
let brand = 'vim'
4149
let version_info = v:versionlong

0 commit comments

Comments
 (0)