Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] health.vim: Fix tmux default-terminal check #6348

Merged
merged 1 commit into from
Mar 24, 2017

Conversation

tweekmonster
Copy link
Contributor

I ran :CheckHealth and was aghast when the tmux checker accused me of not setting default-terminal.

It was changed to a server option in 2.1. tmux's change log says it's a session option, but that's a typo.

@justinmk
Copy link
Member

Oh, yuck. The problem is -qvgs doesn't work on older versions, at least not when I tried. I'm running tmux 1.8. So we probably have to check -qvg and then also -qvs. Hopefully not also -qvgs ...

@justinmk
Copy link
Member

Oh, but we are using -qvgs for escape-time. Hmm..

@tweekmonster
Copy link
Contributor Author

I was worried about that. Maybe we can just check tmux -V? But, that's also a little weird because now it will show master if you build from source.

@justinmk
Copy link
Member

Just confirmed tmux show-option -qvgs default-terminal doesn't work but tmux show-option -qvgs escape-time does. And here's my .tmux.config:

set -g default-terminal "screen-256color"
set-option -g escape-time 2

So we can check both, and if at least one of them returns a sane value, assume it's good.

@@ -115,7 +115,7 @@ function! s:check_tmux() abort

" check default-terminal and $TERM
call health#report_info('$TERM: '.$TERM)
let cmd = 'tmux show-option -qvg default-terminal'
let cmd = 'tmux show-option -qvgs default-terminal'
let out = system(cmd)
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
Copy link
Member

@justinmk justinmk Mar 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

something like this:

if tmux_default_term ==# ''
  let cmd = 'tmux show-option -qvgs default-terminal'
  let out = system(cmd)
  let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
endif

Assuming -qvg variant returns empty on your system?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just about to get on this 😀 Does it set a non-zero exit code? That'll be better than duplicating substitution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found out in a docker container. Both just return empty strings.

@justinmk
Copy link
Member

Good enough for now. We can DRY it later if more tmux checks are needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants