Add tmux_attach_start script zsh completions

Will autocomplete with currently open tmux sessions.
This commit is contained in:
Marty Oehme 2020-02-04 10:00:05 +01:00
parent e7ff8c9f78
commit 65ad7f77ee
2 changed files with 13 additions and 0 deletions

View file

@ -0,0 +1,12 @@
#compdef _tmux_attach_start
#
# Requires tmux_attach_start script in path
#
# Enables completion for zsh of tmux_attach_start function
# with currently open sessions, or tmux options.
_tmux_attach_start() {
_alternative \
"sessions:user sessions:($(tmux list-sessions -F'#{session_name}' 2>/dev/null))"
}

View file

@ -120,6 +120,7 @@ _attach_or_create() {
if ! _session_exists; then if ! _session_exists; then
_create_detached_session _create_detached_session
# look for .tmux.session file if no file has been explicitly passed in # look for .tmux.session file if no file has been explicitly passed in
# session files always take precedence over environment files when specifically passed in
if ! _file_exists "$session_file"; then if ! _file_exists "$session_file"; then
_load_env_session_file _load_env_session_file
fi fi