From 53c89a60d191ec886b31129ae42c1d88e7d907e2 2013-11-13 00:51:58 From: Paul Ivanov Date: 2013-11-13 00:51:58 Subject: [PATCH] bash completion: ipython shows only subcmds If a partial filename, or an flag or option argument is invoked, those completions will still take place, but by default, to aid the user in the discovery of subcommands, pressing tab immediately after ipython will list *only* the subcommands as possible completions --- diff --git a/examples/core/ipython-completion.bash b/examples/core/ipython-completion.bash index ae0ff6a..f9a56de 100644 --- a/examples/core/ipython-completion.bash +++ b/examples/core/ipython-completion.bash @@ -102,8 +102,8 @@ EOF local IFS=$'\t\n' COMPREPLY=( $(compgen -W "${__ipython_complete_profiles}" -- ${cur}) ) else - if [ -z "$mode" ]; then - COMPREPLY=( $(compgen -f -W "${subcommands}" -- ${cur}) ) + if [ "$COMP_CWORD" == 1 ]; then + COMPREPLY=( $(compgen -W "${subcommands}" -- ${cur}) ) else COMPREPLY=( $(compgen -f -- ${cur}) ) fi