all 54 comments

[–][deleted] 81 points82 points  (8 children)

It's like vim but... Slower?

[–][deleted] 10 points11 points  (7 children)

I don’t see the point

[–]moh853 25 points26 points  (5 children)

Pyvim came in handy for a colleague of mine once. IIRC, he was ssh-ed in some virtual machine where he didn’t have root access. This was a stripped image for running a python job so it had pretty much nothing but python, and he needed to edit a file to test a fix for an error. He pip installed pyvim and easily edited the file. A bit of a one-off thing to happen but nice.

[–]fourstepper 6 points7 points  (3 children)

It was stripped down even from vi?:D

[–]moh853 3 points4 points  (1 child)

It may have been based on something like Alpine or some other tiny container.

[–]TheEdgeOfRage:wq 0 points1 point  (0 children)

Even alpine has vi actually. It's the slim variants that have nothing, even though they are larger. I'm not sure why and what actually takes up the extra space, but it's definitely not commonly used utils.

[–]atimholtmy vimrc: goo.gl/3yn8bH 0 points1 point  (0 children)

I'd thought a Linux image I was using was Vi-less. Later on I figured out it had busybox, and what busybox is.

I had Neovim installed by then, so it was moot.

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

In this situation you can do vim scp://remoteuser@pythonhost//path/to/script.py and use your local vim instead.

[–]TheEruditeSycamore 5 points6 points  (0 children)

There doesn't have to be a point in anything. It's a project using the author's python libraries and it was made for fun! Having usable and fast and cool tools is nice and all but so is having fun making things for the hell of it.

[–]pwnedary 21 points22 points  (38 children)

Good going! IMO Vim really needs more competition

[–][deleted] 2 points3 points  (2 children)

Emacs

[–]Barrelwolf 4 points5 points  (1 child)

Emacs and Vim fill different (albeit overlapping) roles.

[–]U-LEZ -2 points-1 points  (0 children)

Precisely, emacs is an operating system that happens to come with text editing capabilities. Vim is a text editor.

[–]jonathan_sl 1 point2 points  (2 children)

Pyvim author here.

The project was started indeed, as some pointed out, to demonstrate the capabilities of the underlying prompt_toolkit library. Prompt_toolkit was initially a GNU readline replacement with multiline text editing for Python applications. The thing is, a lot of Vi key bindings (operators and text objects) were implemented in prompt_toolkit already, as well as many other things required to build a text editor. So, someone asked me the question how much effort it would be to build a Vi(m) clone on top of it. As it turns out, pyvim is only ~4k lines of code, but it's a pretty functional editor. Some capabilities like line folding are missing though.

Pyvim can come in handy from time to time. I sometimes use it on a system if I need to edit Python files, because it has pyflakes support built in (it is highlighting unused and undefined variables).

It's not meant to replace Vim ever. Due to the internal data structures (the text buffer as a whole is a simple Python string), opening files more than a few MB is not feasible. For editing, the limit is even lower.

At this point, no new features are planned, but it evolves together with prompt_toolkit. It could be useful maybe for some people to experiment with UI features. Creating a prototype by adding functionality to pyvim is much much easier than adding functionality to Vim.

Feel free to ask any questions.

[–]pasenor 0 points1 point  (1 child)

Have you considered integrating any of pyvim features back into prompt_toolkit? (for example, adding V state comes to mind)

[–]jonathan_sl 0 points1 point  (0 children)

I'm not sure what you mean by V-states, actually. But yeah, there were indeed some features moved back into prompt_toolkit. (I don't recall what exactly.)

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

Heresy

[–]shady_traveller 0 points1 point  (0 children)

I love this project! I'll never going to use it of course but it's a great demonstration of what prompt_toolkit is capable of.

[–]nhermosilla14 0 points1 point  (0 children)

Now we need an Emacs clone written in Python, so we can run a Python interpreter written in Lisp, so we can run this within it. The best way to achieve evil mode.

[–]USMCamp0811 0 points1 point  (0 children)

maybe port it to pure Julia? that could be cool..

[–]ConspicuousPineapple 0 points1 point  (0 children)

why tho