Repository: xonsh/xonsh

Issue:
Troublesome command entering python mode
I'm trying to run this command which I used to use often in zsh:
```
svn diff ./test.py | vim -R -
```
but it keeps trying to evaluate in Python mode. 

I can usually wrestle these types of troublesome commands into submission with `$()` and `@()` but I can't figure this one out.


Discussion:
I think this an old issue exists since xonsh born? :)
A simpler try is something like this: `ps ax | view -`.
Confirmed - this problem's been around for a while.

From one angle,  "this isn't bash, it's xonsh, it works subtly differently"
is certainly a reasonable stance... but from another angle, it sure would
be nice if xonsh could handle pipelines with "screen owning" commands like
"view", "vim", "vi", "emacs", etc contained in them better than it does
right now.

AFAIK Anthony and possibly some others on the Xonsh core team have been
working hard on a bunch of improvements related to "subprocess mode".  I've
been in a sort of holding pattern, hoping that gets resolved soon myself.

In terms of impact - this is the main thing keeping me from using Xonsh for
my day to day work right now.


Kind regards,


*Paul Reiber*http://about.me/reiber

On Sun, Dec 11, 2016 at 12:48 AM, Hugo Wang <notifications@github.com>
wrote:

> I think this an old issue exists since xonsh born? :)
> A simpler try is something like this: ps ax | view -.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/xonsh/xonsh/issues/2002#issuecomment-266270496>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AADlQNVTbwP4GikqFJVy7x8hQzp0okIMks5rG7jOgaJpZM4LHJEe>
> .
>

I do not believe the recent subprocess refactor affects how subprocesses are parsed, just how they're executed. (Disclaimer: I haven't worked on the parser or the executor.)

Since that looks like valid xonsh, that should not raise a syntax error, and this is a valid bug.
I am not sure when this issue first came about, but I know the above commands parse properly on what I am running (which I forked from before 0.3.5).
I came in just sort of looking for a workaround, but I think I would agree with @astronouth7303. This isn't a complicated command line by any measure. The only "exotic" features are the pipe and the stdin. 

In fact I can simplify this to `svn diff | vim -` with the same results.
I am looking into this now.  @JohnLunzer  can you set `$XONSH_DEBUG = 2` before you run the command and report on the output, please? Thanks!

Resolving patch:
diff --git a/xonsh/commands_cache.py b/xonsh/commands_cache.py
--- a/xonsh/commands_cache.py
+++ b/xonsh/commands_cache.py
@@ -256,6 +256,7 @@ def default_threadable_predictors():
         'clear': predict_false,
         'cls': predict_false,
         'cmd': predict_shell,
+        'ex': predict_false,
         'fish': predict_shell,
         'htop': predict_help_ver,
         'ksh': predict_shell,
@@ -267,6 +268,8 @@ def default_threadable_predictors():
         'nano': predict_help_ver,
         'psql': predict_false,
         'ranger': predict_help_ver,
+        'rview': predict_false,
+        'rvim': predict_false,
         'scp': predict_false,
         'sh': predict_shell,
         'ssh': predict_false,
@@ -275,6 +278,7 @@ def default_threadable_predictors():
         'tcsh': predict_shell,
         'top': predict_help_ver,
         'vi': predict_false,
+        'view': predict_false,
         'vim': predict_false,
         'vimpager': predict_help_ver,
         'xo': predict_help_ver,


Test patch: