You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was recently thinking about adding vi-style editing to some software written in Python.
Naturally I start searching for "vi"/"vim"/etc on PyPI, and I find this - looks promising, I'm super excited, etc.
At a glance, it looks like the focus of this project is the full interactive TUI of vi. Does it have a core that can be reused as a library? So that for example a GUI written in Python could easily add vi-style editing to a command line that it has? If not, is there interest in a PR to refactor things to make it that happen?
[click to expand some design thoughts]
I'm hoping for a library that's more like a state machine of sorts: off the top of my head, I imagine/design
a class representing a thing being edited,
we construct/initialize it with one argument - a string, bytes, or bytearray object, or something similarly sensible,
it has a method which takes inputs (a string representing key strokes, probably) and returns something to indicate if further inputs are needed (for example, the user hit "d" and the second "d" or motion hasn't come in yet) and what vi mode this instance of the object is in, and
another method that returns the current string/bytearray/whatever after all the edits/input up to this point (perhaps this could/should also return the current vi mode, for convenience).
(A full vi replacement use-case would probably need to layer in optimizations with this - which could be done by for example creating an object that fulfills a relevant editable interface - but this seems like a sufficient minimal interface for basic use-cases.)
The text was updated successfully, but these errors were encountered:
I was recently thinking about adding vi-style editing to some software written in Python.
Naturally I start searching for "vi"/"vim"/etc on PyPI, and I find this - looks promising, I'm super excited, etc.
At a glance, it looks like the focus of this project is the full interactive TUI of vi. Does it have a core that can be reused as a library? So that for example a GUI written in Python could easily add vi-style editing to a command line that it has? If not, is there interest in a PR to refactor things to make it that happen?
[click to expand some design thoughts]
I'm hoping for a library that's more like a state machine of sorts: off the top of my head, I imagine/design
string
,bytes
, orbytearray
object, or something similarly sensible,(A full vi replacement use-case would probably need to layer in optimizations with this - which could be done by for example creating an object that fulfills a relevant editable interface - but this seems like a sufficient minimal interface for basic use-cases.)
The text was updated successfully, but these errors were encountered: