[slim-vim] appending confusion and input-listener problems
Jim Bailey
dgym.bailey at gmail.com
Sun May 28 16:43:34 CDT 2006
Hello everybody,
I have recently seen comments about wanting to use ml_append, and
seen code using vim commands to append text to a buffer and other
strangeness and I think this is my fault.
Looking at the vim functions I originally added there are functions to
get lines and functions to replace lines. What isn't apparently clear
is that you can also append lines - by replacing.
I think the lisp stuff I wrote is 1 based to keep in line with vim but
I agree with Larry - 0 based is better for a programmer's sanity and so
all lisp stuff should be 0 based. So these examples are 0 based and
won't actually run...
To replace line 0 you would call:
(vim:replace-lines '("new text") :start 0 :end 1)
But you can also add more lines at the same time:
(vim:replace-lines '("a" "b") :start 0 :end 1)
And you can add new lines by replacing the emtpy ranges between lines:
(vim:replace-lines '("new first line") :start 0 :end 0)
Of course you can also replace x lines with y lines and thus delete,
replace and append lines as required.
This is a natural thing to do in if_python.c as Python has these list
slices and assignments as part of the language. I just copied it over
and forgot that this would be unexpected functionality for most
lispers, sorry.
I think an append function that wraps replace-lines would be tidy and
appreciated.
Unfortunately there is a bug with the :end type checking in
(vim:replace-lines) which needs fixing next time I have a proper
internet connection. For now it HAS to be specified, letting it default
to nil will not work.
The input-listener problem is, erm, problematic. Looking at what SNIFF
does has just helped me to become more miserable with the whole
terminal handling aspect of VIM 6.4. From what I can tell the GUIs that
I have added support for work just fine and I havn't seen any of those
strange crashes. The terminal code is a nightmare to wade through and I
am not sure that there is a decent or even quick and dirty hack to fire
off the input handlers at a suitable point in the code.
It certainly feels like a waste of time trying to fix it on an old code
branch and so I suggest that the vim+async+ecl stuff be ported/worked
into vim 7.x where things might be better - or they might be just as
bad, or maybe even worse, but at least I will have more incentive...
I will try and get around to this at some point, but as always I can't
say when as I am still travelling at the moment (and will be for the
next 6 months) and don't have much time or internet access.
So sorry that this is still a problem, hopefully at least one of the
supported guis is available on most platforms, for the time being the
gui is a requirement.
Cheers,
Jim
More information about the slim-vim
mailing list