Skip to content

Instantly share code, notes, and snippets.

@JamieFlournoy
Created February 1, 2012 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamieFlournoy/1715383 to your computer and use it in GitHub Desktop.
Save JamieFlournoy/1715383 to your computer and use it in GitHub Desktop.
Patch to make Ubuntu's GNU Screen bash completion complete on the text part of the name
--- screen 2012-01-31 21:24:46.000000000 -0800
+++ screen-new 2012-01-31 21:24:49.000000000 -0800
@@ -12,7 +12,7 @@
fi
COMPREPLY=( $( command screen -ls | sed -ne \
- 's|^['$'\t'']\+\('"$cur"'[0-9]\+\.[^'$'\t'']\+\)'"$pattern"'$|\1|p' ) )
+ '/^\t'$cur[0-9]*'\..*\|^\t[0-9]*\.'$cur'.*\|^\t'$cur'.*/!d;s|^['$'\t'']\+\([0-9]*\.[^'$'\t'']\+\).*'$pattern'.*$|\1|p' ) )
} &&
_screen()
{
@JamieFlournoy
Copy link
Author

Download it, name it screen.patch, and apply it like so (to an Ubuntu 10.04 or later system, and maybe Debian too since that's where the script came from):
$ sudo patch /etc/bash_completion.d/screen screen.patch
$ exec bash # <-- to reload the completions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment