Skip to content

feat(tmux): new completion #3

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

Closed
wants to merge 11 commits into from
Closed

feat(tmux): new completion #3

wants to merge 11 commits into from

Conversation

dseomn
Copy link
Owner

@dseomn dseomn commented Apr 10, 2025

From tmux/tmux#24 it doesn't look like the tmux maintainers were interested in having a bash completion script in the upstream repo in 2019. I didn't ask again more recently, but I did make tmux/tmux#4455 and wasn't asked to include the script there. However, I added license headers to put these new files under either bash-completion's license or tmux's, in case the current or future tmux maintainers want it in tmux's repo in the future.

I'm aware of a handful of existing tmux bash completion scripts, below. As far as I can tell, they all hard-code a decent amount of tmux's available options, commands, etc. Some are also abandoned and out of date with more recent versions of tmux. Rather than base this code off of those, I decided to implement completion using tmux's own introspection commands as much as possible. Hopefully that will reduce the ongoing maintenance work and make it stay up to date with most tmux changes automatically.

This commit has a relatively minimal set of completions, see the TODO in _comp_cmd_tmux__value(). I have code for more completions in varying states of readiness, but this commit is already pretty large. I'll make follow-up PR(s) for those.

I'm willing to maintain this script. (And I'm hoping that the design mentioned above will make that easier.)

Existing implementations that I'm aware of:

https://github.com/Bash-it/bash-it/blob/master/completion/available/tmux.completion.bash https://github.com/Boruch-Baum/tmux_bash_completion https://github.com/imomaliev/tmux-bash-completion
scop#81
https://github.com/srsudar/tmux-completion

@dseomn dseomn force-pushed the tmux branch 4 times, most recently from c1e913e to f315cde Compare April 10, 2025 22:38
yedayak and others added 9 commits April 16, 2025 21:55
The path for the transaction history sqlite moved, the options have to
be after the install subcommand
This still installs the vpnc command itself, which means we shouldn't
actually lose coverage.

Installing /usr/bin/vpnc brings vpnc-consoleuser, which then fails to
install, see https://bugzilla.redhat.com/show_bug.cgi?id=2341517.

Without this, I get conflicts about /usr/bin/vpnc and /usr/bin/vpnc-disconnect,
between vpnc-consoleuser-0.5.3-48.svn550.fc41.x86_64 and
vpnc-0.5.3-48.svn550.fc41.x86_64

Co-authored-by: Ville Skyttä <ville.skytta@iki.fi>
https://github.com/tldr-pages/tldr-python-client/blob/fa495f2fb9f4a5b35729efa4b83807bc646c8f04/README.md#autocomplete

Note: There is an alternative implementation of tldr [1], which does
not support "--print-completion bash" but provides a separate
completion file [2].  This should not cause a problem because we any
way redirect stderr by "2>/dev/null".

[1] https://github.com/tealdeer-rs/tealdeer
[2] \
https://github.com/tealdeer-rs/tealdeer/blob/769ef4da20dcaa7c00ba638ab11f063b83d99b01/docs/src/installing.md?plain=1#L64
feat(shtab): add 3rd party fallback completion loader
@dseomn dseomn force-pushed the tmux branch 4 times, most recently from 2aa6779 to 2048252 Compare April 26, 2025 21:06
From tmux/tmux#259 it doesn't look like the tmux
maintainers were interested in having a bash completion script in the
upstream repo. However, I added license headers to put these new files
under either bash-completion's license or tmux's, in case they want it
there in the future.

I'm aware of a handful of existing tmux bash completion scripts, below.
As far as I can tell, they all hard-code a decent amount of tmux's
available options, commands, etc. Some are also abandoned and out of
date with more recent versions of tmux. Rather than base this code off
of those, I decided to implement completion using tmux's own
introspection commands as much as possible. Hopefully that will reduce
the ongoing maintenance work and make it stay up to date with most tmux
changes automatically.

This commit has a relatively minimal set of completions, see the TODO in
_comp_cmd_tmux__value(). I have code for more completions in varying
states of readiness, but this commit is already pretty large. I'll make
follow-up PR(s) for those.

I'm willing to maintain this script. (And I'm hoping that the design
mentioned above will make that easier.)

Existing implementations that I'm aware of:

* https://github.com/Bash-it/bash-it/blob/master/completion/available/tmux.completion.bash
* https://github.com/Boruch-Baum/tmux_bash_completion
* https://github.com/imomaliev/tmux-bash-completion
* scop#81
* https://github.com/srsudar/tmux-completion
@dseomn dseomn closed this May 10, 2025
@dseomn dseomn deleted the tmux branch May 12, 2025 20:58
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.

4 participants