diff options
author | BK1603 <chouhan.shreyansh2702@gmail.com> | 2020-06-25 03:54:17 +0530 |
---|---|---|
committer | BK1603 <chouhan.shreyansh2702@gmail.com> | 2020-07-02 04:40:35 +0530 |
commit | 22828f59bbbee29f1a8b645a62ecfe2edb71c1ef (patch) | |
tree | 31ad2ece9404ac5477cd9ea290838fb39fef90ec | |
parent | 225f0bcd98dd8ff8cab964f13816dfdf327038ae (diff) | |
download | rneovim-22828f59bbbee29f1a8b645a62ecfe2edb71c1ef.tar.gz rneovim-22828f59bbbee29f1a8b645a62ecfe2edb71c1ef.tar.bz2 rneovim-22828f59bbbee29f1a8b645a62ecfe2edb71c1ef.zip |
Added healt check for tmux focus events
-rw-r--r-- | runtime/autoload/health/nvim.vim | 60 |
1 files changed, 45 insertions, 15 deletions
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim index c25f5ee64f..f18801ea69 100644 --- a/runtime/autoload/health/nvim.vim +++ b/runtime/autoload/health/nvim.vim @@ -129,6 +129,25 @@ function! s:check_performance() abort endif endfunction +function! s:get_tmux_option(option) abort + let cmd = 'tmux show-option -qvg '.a:option " try global scope + let out = system(cmd) + let val = substitute(out, '\v(\s|\r|\n)', '', 'g') + if v:shell_error + call health#report_error('command failed: '.cmd."\n".out) + return 'error' + elseif empty(val) + let cmd = 'tmux show-option -qvgs '.a:option " try session scope + let out = system(cmd) + let val = substitute(out, '\v(\s|\r|\n)', '', 'g') + if v:shell_error + call health#report_error('command failed: '.cmd."\n".out) + return 'error' + endif + endif + return val +endfunction + function! s:check_tmux() abort if empty($TMUX) || !executable('tmux') return @@ -136,20 +155,31 @@ function! s:check_tmux() abort call health#report_start('tmux') " check escape-time - let suggestions = ["Set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10", + let suggestions = ["set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10", \ s:suggest_faq] - let cmd = 'tmux show-option -qvgs escape-time' - let out = system(cmd) - let tmux_esc_time = substitute(out, '\v(\s|\r|\n)', '', 'g') - if v:shell_error - call health#report_error('command failed: '.cmd."\n".out) - elseif empty(tmux_esc_time) - call health#report_error('escape-time is not set', suggestions) - elseif tmux_esc_time > 300 - call health#report_error( - \ 'escape-time ('.tmux_esc_time.') is higher than 300ms', suggestions) - else - call health#report_ok('escape-time: '.tmux_esc_time.'ms') + let tmux_esc_time = s:get_tmux_option('escape-time') + if tmux_esc_time !=# 'error' + if empty(tmux_esc_time) + call health#report_error('`escape-time` is not set', suggestions) + elseif tmux_esc_time > 300 + call health#report_error( + \ '`escape-time` ('.tmux_esc_time.') is higher than 300ms', suggestions) + else + call health#report_ok('escape-time: '.tmux_esc_time) + endif + endif + + " check focus-events + let suggestions = ["(tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:\nset-option -g focus-events on"] + let tmux_focus_events = s:get_tmux_option('focus-events') + call health#report_info('Checking stuff') + if tmux_focus_events !=# 'error' + if empty(tmux_focus_events) || tmux_focus_events !=# 'on' + call health#report_warn( + \ "`focus-events` is not enabled. |'autoread'| may not work.", suggestions) + else + call health#report_ok('focus-events: '.tmux_focus_events) + endif endif " check default-terminal and $TERM @@ -203,9 +233,9 @@ function! s:check_terminal() abort call health#report_error('command failed: '.cmd."\n".out) else call health#report_info('key_backspace (kbs) terminfo entry: ' - \ .(empty(kbs_entry) ? '? (not found)' : kbs_entry)) + \ .(empty(kbs_entry) ? '? (not found)' : kbs_entry)) call health#report_info('key_dc (kdch1) terminfo entry: ' - \ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry)) + \ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry)) endif for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY'] if exists('$'.env_var) |