Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 6259665e972d478f1ce4ab3d233033ec1dd7eef2
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Thu Apr 4 11:02:35 2013 -0500

    change spaces to tabs

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>

commit 465333d982db441f430767b645fdcd95e44cc5d6
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Wed Apr 3 11:15:22 2013 -0500

    tmux: implement completion for panes

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>

commit 684baf98a6ac070847f20a02838abe58e8c22d5b
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Tue Apr 2 23:56:27 2013 -0500

    tmux: don't suggest dirs

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>

commit 8c4a9854a1f173866439f976301b743354c945c8
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Tue Apr 2 21:57:40 2013 -0500

    move front flags to the top of the tmux file

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>

commit 7f2321e9cd20a5aa2bcbfe940e20ec57bcca2609
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Tue Apr 2 20:06:54 2013 -0500

    fix some of the initial parameters

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>

commit f70fc55bed40c0ccd2a00921c0e7373e7c18b5d7
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Tue Apr 2 21:47:25 2013 -0500

    implement tmux KEY BINDINGS

    implement the commands in the KEY BINDINGS man page section

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>

commit ec423040dba742f67c06dbb932417f6d19b90fba
Author: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Date:   Tue Apr 2 00:10:43 2013 -0500

    implement tmux completion for CLIENTS AND SESSIONS

    Fully implement all tmux commands found in the tmux man
    page section titled: "CLIENTS AND SESSIONS"

    Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
  • Loading branch information
ridiculousfish committed Apr 5, 2013
1 parent c052814 commit 46edc49
Showing 1 changed file with 187 additions and 13 deletions.
200 changes: 187 additions & 13 deletions share/completions/tmux.fish
@@ -1,13 +1,187 @@
complete -c tmux -d 'Terminal multiplexer' -a 'attach'
complete -c tmux -s 2 -d 'Force tmux to assume the terminal supports 256 colours'
complete -c tmux -s 8 -d 'Like -2, but indicates that the terminal supports 88 colours'
complete -c tmux -s c -r -d 'Execute shell-command using the default shell'
complete -c tmux -s f -r -d 'Specify an alternative configuration file'
complete -c tmux -s L -x -d 'Specify the socket'
complete -c tmux -s l -d 'Behave as a login shell'
complete -c tmux -s q -d 'Set the quiet server option'
complete -c tmux -s S -r -d 'Specify a full alternative path to the server socket'
complete -c tmux -s u -d 'Flag explicitly informs tmux that UTF-8 is supported'
complete -c tmux -s v -d 'Request verbose logging'
complete -c tmux -s V -d 'Report the tmux version'
complete -c tmux -d "Complete subcommand" -x -a "(__fish_complete_subcommand -c -f -L -S)"
function __fish_tmux_sessions --description 'available sessions'
tmux list-sessions -F "#S #{session_windows} windows Created: #{session_created_string} [#{session_width}x#{session_height}] Attached=#{session_attached}" ^/dev/null
end

function __fish_tmux_clients --description 'connected clients'
tmux list-clients -F "#{client_tty} #{session_name}: Created: #{client_created_string} [#{client_width}x#{client_height} #{client_termname}]" ^/dev/null
end

function __fish_tmux_panes --description 'window panes'
set -l panes (tmux list-panes -F "#S:#{window_name}.")

#fully qualified pane names
for i in (seq (count $panes))
echo "$panes[$i]"(math $i - 1)' session:window.pane'
end

#panes by themselves
for i in (seq (count $panes))
echo (math $i - 1)' pane'
end

#windows by themselves
tmux list-panes -F '#{window_name} window'
end

#don't allow dirs in the completion list...
complete -c tmux -x

############### Begin: Front Flags ###############
#these do not require parameters
complete -c tmux -n '__fish_use_subcommand' -s 2 -d 'Force tmux to assume the terminal supports 256 colours'
complete -c tmux -n '__fish_use_subcommand' -s 8 -d 'Like -2, but indicates that the terminal supports 88 colours'
complete -c tmux -n '__fish_use_subcommand' -s l -d 'Behave as a login shell'
complete -c tmux -n '__fish_use_subcommand' -s q -d 'Set the quiet server option'
complete -c tmux -n '__fish_use_subcommand' -s u -d 'Flag explicitly informs tmux that UTF-8 is supported'
complete -c tmux -n '__fish_use_subcommand' -s v -d 'Request verbose logging'
complete -c tmux -n '__fish_use_subcommand' -s V -d 'Report the tmux version'

#these require parameters
complete -c tmux -n '__fish_use_subcommand' -xs c -d 'Execute command using the default shell'
complete -c tmux -n '__fish_use_subcommand' -rs f -d 'Alternate config file'
complete -c tmux -n '__fish_use_subcommand' -rs L -d 'Specify the name of the server socket to use'
complete -c tmux -n '__fish_use_subcommand' -rs S -d 'Full path to sever socket. If set, -L is ignored.'
############### End: Front Flags ###############

############### Begin: Clients and Sessions ###############
set -l attach 'attach-session attach'
set -l detach 'detach-client detach'
set -l has 'has-session has'
set -l killserver 'kill-server'
set -l killsession 'kill-session'
set -l lsc 'list-clients lsc'
set -l lscm 'list-commands lscm'
set -l ls 'list-sessions ls'
set -l lockc 'lock-client lockc'
set -l locks 'lock-session locks'
set -l new 'new-session new'
set -l refresh 'refresh-client refresh'
set -l rename 'rename-session rename'
set -l showmsgs 'show-messages showmsgs'
set -l source 'source-file source'
set -l start 'start-server start'
set -l suspendc 'suspend-client suspendc'
set -l switchc 'switch-client switchc'

complete -c tmux -n '__fish_use_subcommand' -a $attach -d 'attach to existing session'
complete -c tmux -n "__fish_seen_subcommand_from $attach" -s d -d 'detach other clients'
complete -c tmux -n "__fish_seen_subcommand_from $attach" -s r -d 'attach in read-only mode'

complete -c tmux -n '__fish_use_subcommand' -a $detach -d 'detach current client'
complete -c tmux -n "__fish_seen_subcommand_from $detach" -s P -d 'SIGHUP parent process of client, likely causing it to exit'

complete -c tmux -n '__fish_use_subcommand' -a $has -d 'report error and exit with 1 if the specified session does not exist'
complete -c tmux -n '__fish_use_subcommand' -a $killserver -d 'kill tmux server, clients, and sessions'
complete -c tmux -n '__fish_use_subcommand' -a $killsession -d 'destroy session, closing windows linked to it and no other sessions, detach all clients'
complete -c tmux -n '__fish_use_subcommand' -a $lsc -d 'list all attached clients'
complete -c tmux -n '__fish_use_subcommand' -a $lscm -d 'list syntax for all tmux commands'
complete -c tmux -n '__fish_use_subcommand' -a $ls -d 'list all sessions'
complete -c tmux -n '__fish_use_subcommand' -a $lockc -d 'lock client'
complete -c tmux -n '__fish_use_subcommand' -a $locks -d 'lock session'

complete -c tmux -n '__fish_use_subcommand' -a $new -d 'create a new session with name session-name'
complete -c tmux -n "__fish_seen_subcommand_from $new" -s d -d "don't attach to current window"
complete -c tmux -n "__fish_seen_subcommand_from $new" -xs n -d 'window-name'
complete -c tmux -n "__fish_seen_subcommand_from $new" -xs s -d 'session-name'
complete -c tmux -n "__fish_seen_subcommand_from $new" -xs x -d 'width'
complete -c tmux -n "__fish_seen_subcommand_from $new" -xs y -d 'height'

complete -c tmux -n '__fish_use_subcommand' -a $refresh -d 'refresh client'
complete -c tmux -n "__fish_seen_subcommand_from $refresh" -s S -d 'update client status bar'

complete -c tmux -n '__fish_use_subcommand' -a $rename -d 'rename session'
complete -c tmux -n '__fish_use_subcommand' -a $showmsgs -d 'save msgs in status bar in per-client msg log'

complete -c tmux -n '__fish_use_subcommand' -a $source -d 'execute commands from path'
complete -c tmux -n '__fish_use_subcommand' -a $start -d 'start tmux server if not running; do not create a session'

complete -c tmux -n '__fish_use_subcommand' -a $suspendc -d 'send SIGTSTP signal to client (tty stop)'

complete -c tmux -n '__fish_use_subcommand' -a $switchc -d 'Switch the current session for client target-client to target-session'
complete -c tmux -n "__fish_seen_subcommand_from $switchc" -s l -d 'move client to the last session'
complete -c tmux -n "__fish_seen_subcommand_from $switchc" -s n -d 'move client to the next session'
complete -c tmux -n "__fish_seen_subcommand_from $switchc" -s p -d 'move client to the previous session'
complete -c tmux -n "__fish_seen_subcommand_from $switchc" -s r -d 'toggle if client is read-only'

#commands with a session flag
complete -c tmux -xs t -n "__fish_seen_subcommand_from $attach $new $has $killsession $lsc $locks $rename $switchc" -a '(__fish_tmux_sessions)' -d 'target-session'
complete -c tmux -xs s -n "__fish_seen_subcommand_from $detach" -a '(__fish_tmux_sessions)' -d 'target-session'

#commands with a client flag
complete -c tmux -xs t -n "__fish_seen_subcommand_from $detach $lockc $refresh $showmsgs $suspendc" -a '(__fish_tmux_clients)' -d 'target-client'
complete -c tmux -xs c -n "__fish_seen_subcommand_from $switchc" -a '(__fish_tmux_clients)' -d 'target-client'

#commands with the -F format flag
complete -c tmux -n "__fish_seen_subcommand_from $lsc $ls" -rs F -d 'format string'

############### End: Clients and Sessions ###############

############### Begin: Windows and Panes ###############
#TODO - these commands are not currently implemented.
#there is a section in the tmux man page that has the same title as this section
#use the "Clients and Sessions" code as an example when implementing this
############### End: Windows and Panes ###############

############### Begin: Key Bindings ###############
set -l bind 'bind-key bind'
set -l lsk 'list-keys lsk'
set -l send 'send-keys send'
set -l sendprefix 'send-prefix'
set -l unbind 'unbind-key unbind'

set -l key_table 'vi-edit emacs-edit vi-choice emacs-choice vi-copy emacs-copy'

complete -c tmux -n '__fish_use_subcommand' -a $bind -d 'bind key to command'
complete -c tmux -n "__fish_seen_subcommand_from $bind" -s c -d 'bind for command mode instead of normal mode'
complete -c tmux -n "__fish_seen_subcommand_from $bind" -s n -d 'make the binding work without using a prefix key'
complete -c tmux -n "__fish_seen_subcommand_from $bind" -s r -d 'key may repeat'
complete -c tmux -n "__fish_seen_subcommand_from $bind" -xs t -d 'choose key table for binding' -xa "$key_table"

complete -c tmux -n '__fish_use_subcommand' -a $lsk -d 'list all key bindings'
complete -c tmux -n "__fish_seen_subcommand_from $lsk" -s t -d 'key table' -xa "$key_table"

complete -c tmux -n '__fish_use_subcommand' -a $send -d 'list all key bindings'
complete -c tmux -n "__fish_seen_subcommand_from $send" -s R -d 'reset terminal state'
complete -c tmux -n "__fish_seen_subcommand_from $send" -xs t -a '(__fish_tmux_panes)' -d 'target pane'

complete -c tmux -n '__fish_use_subcommand' -a $sendprefix -d 'send the prefix key'
complete -c tmux -n "__fish_seen_subcommand_from $sendprefix" -s 2 -d 'use secondary prefix'
complete -c tmux -n "__fish_seen_subcommand_from $sendprefix" -xs t -a '(__fish_tmux_panes)' -d 'target pane'

complete -c tmux -n '__fish_use_subcommand' -a $unbind -d 'unbind the command bound to key'
complete -c tmux -n "__fish_seen_subcommand_from $unbind" -s a -d 'remove all key bindings'
complete -c tmux -n "__fish_seen_subcommand_from $unbind" -s c -d 'binding for command mode'
complete -c tmux -n "__fish_seen_subcommand_from $unbind" -s n -d 'command bound to key without a prefix (if any) removed'
complete -c tmux -n "__fish_seen_subcommand_from $unbind" -xs t -d 'key table' -xa "$key_table"

############### End: Key Bindings ###############

############### Begin: Options ###############
#TODO - these commands are not currently implemented.
#there is a section in the tmux man page that has the same title as this section
#use the "Clients and Sessions" code as an example when implementing this
############### End: Options ###############

############### Begin: Environment ###############
#TODO - these commands are not currently implemented.
#there is a section in the tmux man page that has the same title as this section
#use the "Clients and Sessions" code as an example when implementing this
############### End: Environment ###############

############### Begin: Status Line ###############
#TODO - these commands are not currently implemented.
#there is a section in the tmux man page that has the same title as this section
#use the "Clients and Sessions" code as an example when implementing this
############### End: Status Line ###############

############### Begin: Buffers ###############
#TODO - these commands are not currently implemented.
#there is a section in the tmux man page that has the same title as this section
#use the "Clients and Sessions" code as an example when implementing this
############### End: Buffers ###############

############### Begin: Miscellaneous ###############
#TODO - these commands are not currently implemented.
#there is a section in the tmux man page that has the same title as this section
#use the "Clients and Sessions" code as an example when implementing this
############### End: Miscellaneous ###############

0 comments on commit 46edc49

Please sign in to comment.