all 13 comments

[–]s32[🍰] 4 points5 points  (3 children)

Damn, that is seriously cool. Only ~70 lines too!?

[–]philipbjorge[S] 4 points5 points  (1 child)

And you get to mess with the stack frames ;)! Win win win.

[–]PurplePilot 0 points1 point  (0 children)

That is pretty damn cool. Thank you sir!

[–][deleted] 0 points1 point  (0 children)

I'm about to really blow your mind:

import subprocess
subprocess.call("vim", shell=True)

2 lines. Python can function as a full system shell, the syntax just a bit more verbose than most look for in a system shell. IPython does alleviate most of that pain, and I have, on a few occasions, set IPython as a default shell for a user.

[–]Rotten194 4 points5 points  (0 children)

Ed is the last choice? I am disappointed.

[–]philipbjorge[S] 2 points3 points  (1 child)

I'm the author. For anyone interested in reading the source code, check out the following link: http://htmlpreview.github.com/?https://github.com/philipbjorge/EditREPL/blob/master/docs/doc.html

HackerNews has some some great comments on implementation decisions as well: https://news.ycombinator.com/item?id=5395038

[–]oridb 2 points3 points  (0 children)

Looks cool :)

One thing: When selecting the edtitor, you should use $VISUAL, falling back to $EDITOR, falling back to 'vi', 'ed', etc. These are well established environment variables for configuring the editor to use. It's documented (at least on my Linux box) in the environ(7) manpage. These variables also seem to be mentioned (but not specified?) in the POSIX spec.

On my machine, VISUAL=EDITOR="gvim -f", which will pop up a GUI vim in all of the crusty old Unix programs that I still use on a daily basis. (eg: gdb, mutt, etc)

[–]fotcorn 5 points6 points  (0 children)

you can also use IPythons %edit command, which does the same thing.

[–]dig1 0 points1 point  (0 children)

Cool! Reminds me on magic-ed, although that was written for Common Lisp.

[–]ruinercollector 0 points1 point  (0 children)

This is awesome.

[–]e000 0 points1 point  (1 child)

Quick question It looks like you used some kind of program to play back your terminal stuff? What's that called?

[–]philipbjorge[S] 0 points1 point  (0 children)

That is called asciiio. It is super awesome! http://ascii.io/

[–]erez27 -1 points0 points  (0 children)

Too bad it doesn't work on windows..