Repository: xonsh/xonsh

Issue:
tab completion with arrow selection like zsh
Is there a way in xsh to enable tab completion like the following where it lets me select from the list with the arrow key buttons? (up and down works too if there are many items)

Here is a video of what I mean:

[![zsh tab completion](https://cloud.githubusercontent.com/assets/55744/25497561/06bfe6aa-2b53-11e7-831f-233ef80623a9.png)](https://youtu.be/ew51b7n7QOQ)

Also perhaps there is a color scheme like the one in the video?




Discussion:
Completing file names should be default. There's a variety of color schemes available.
The names appear but the arrow key selection doesn't work by default, sorry if that wasn't clear.
Hi @ahundt -- up and down arrow keys should work with prompt_toolkit, but they don't support left-right as of yet.  See #917
@gforsyth Thanks for the link! Am I correct that the issue is closed but the functionality doesn't yet exist?
@ahundt, I closed the previous issue since it's an upstream thing. But yeah, no right-left arrows yet.
Oh I see that functionality is part of python-prompt-toolkit rather than xonsh 
https://github.com/jonathanslenders/python-prompt-toolkit/issues/147

ok fair enough, thanks!
This seems mostly working now with ptk 2.0! However there is still what might be a small issue. If you watch the video of what I'm expecting:

[![zsh tab completion](https://cloud.githubusercontent.com/assets/55744/25497561/06bfe6aa-2b53-11e7-831f-233ef80623a9.png)](https://youtu.be/ew51b7n7QOQ)

**Expected behavior:**
1. hit tab to get a list of options 
2. arrow select the item 
3. hit enter, which adds the text to the command
4. hit enter to execute the command

**Actual behavior:**
1. hit tab to get a list of options 
2. arrow select the item 
3. hitting enter actually executes the command

This means it is hard to use tab completion for a long path, because the command will execute on the directory. I'm not sure if this is an issue I should bring here or in PTK https://github.com/prompt-toolkit/python-prompt-toolkit/issues/764, so I'm sorry if it is the incorrect location.
Ah, these already exist:
```
$XONSH_HISTORY_MATCH_ANYWHERE = True
$COMPLETIONS_CONFIRM = True
```
https://xon.sh/envvars.html#completions-confirm

Any chance these or some even better set of automation options could be enabled by default? :-)

Hey @ahundt -- I'm definitely game for setting `$COMPLETIONS_CONFIRM=True` as the default -- if we get a quorum of @xonsh/xore to agree to that we can change the default.

I'm a little more wary of the match anywhere, only because it's more computationally intensive, but I'm open to being convinced if you want to run some profiling on search timings with long histories!
I am in favor of `$COMEPLETIONS_CONFIRM = True` if someone wants to put in a PR

Resolving patch:
diff --git a/xonsh/environ.py b/xonsh/environ.py
--- a/xonsh/environ.py
+++ b/xonsh/environ.py
@@ -812,7 +812,7 @@ def DEFAULT_VARS():
             is_bool,
             to_bool,
             bool_to_str,
-            False,
+            True,
             "While tab-completions menu is displayed, press <Enter> to confirm "
             "completion instead of running command. This only affects the "
             "prompt-toolkit shell.",


Test patch: