Repository: xonsh/xonsh

Issue:
Weird completion issue
<!--- Provide a general summary of the issue in the Title above -->
<!--- If you have a question along the lines of "How do I do this Bash command in xonsh"
please first look over the Bash to Xonsh translation guide: https://xon.sh/bash_to_xsh.html
If you don't find an answer there, please do open an issue! -->

## xonfig

<details>

```
$ xonfig
+------------------+-----------------+
| xonsh            | 0.9.12          |
| Python           | 3.7.4           |
| PLY              | 3.11            |
| have readline    | True            |
| prompt toolkit   | 2.0.9           |
| shell type       | prompt_toolkit2 |
| pygments         | 2.4.2           |
| on posix         | True            |
| on linux         | False           |
| on darwin        | True            |
| on windows       | False           |
| on cygwin        | False           |
| on msys2         | False           |
| is superuser     | False           |
| default encoding | utf-8           |
| xonsh encoding   | utf-8           |
| encoding errors  | surrogateescape |
+------------------+-----------------+
```

</details>

## Expected Behavior
<!--- Tell us what should happen -->
Tab completion behind shell command `vim` should work

## Current Behavior
<!--- Tell us what happens instead of the expected behavior -->
<!--- If part of your bug report is a traceback, please first enter debug mode before triggering the error
To enter debug mode, set the environment variable `XONSH_DEBUG=1` _before_ starting `xonsh`.
On Linux and OSX, an easy way to to do this is to run `env XONSH_DEBUG=1 xonsh` -->
existing file is not being found by completion (see screenshot).
As you can see in the lower part of the screenshot, the file `pip_packages_to_install.txt` exists in the current folder but isn't found when used behind the shell command `vim` (but does work behind `cat`).
Is this maybe created by interfering completions installed elsewhere? Maybe some vim completions from homebrew?


<img width="822" alt="Screenshot 2019-10-31 14 11 02" src="https://user-images.githubusercontent.com/69774/67982582-99090380-fbe8-11e9-839a-b6fd0536a3ed.png">


Discussion:
Addition: `code pip_` also does not autocomplete, which is annoying, so both my editors don't auto-complete.
adding a ./ in front doesn't help either.
Thanks for reporting @michaelaye !  The completers fire in order and the `pip` completer comes before the `path` completer -- what's happening here is that the `pip` completer is firing (incorrectly).  

This regex needs to be a little less aggressive: https://github.com/xonsh/xonsh/blob/master/xonsh/completers/pip.py#L10-L12
of course I get a regex-related reply ON HALLOWEEN!! ;) *scares_the_s***_outta_me* ;)

Resolving patch:
diff --git a/xonsh/completers/pip.py b/xonsh/completers/pip.py
--- a/xonsh/completers/pip.py
+++ b/xonsh/completers/pip.py
@@ -9,12 +9,12 @@
 
 @xl.lazyobject
 def PIP_RE():
-    return re.compile(r"\bx?pip(?:\d|\.)*")
+    return re.compile(r"\bx?pip(?:\d|\.)*\b")
 
 
 @xl.lazyobject
 def PIP_LIST_RE():
-    return re.compile(r"\bx?pip(?:\d|\.)* (?:uninstall|show)")
+    return re.compile(r"\bx?pip(?:\d|\.)*\b (?:uninstall|show)")
 
 
 @xl.lazyobject


Test patch:
diff --git a/tests/completers/test_pip_completer.py b/tests/completers/test_pip_completer.py
--- a/tests/completers/test_pip_completer.py
+++ b/tests/completers/test_pip_completer.py
@@ -33,6 +33,9 @@ def test_pip_list_re(line):
         "![thewholepipandpaboodle uninstall",
         "$[littlebopip show",
         "!(boxpip uninstall",
+        "pipx",
+        "vim pip_",
+        "pip_",
     ],
 )
 def test_pip_list_re(line):