Re: Integration of Vim

2007-10-11 Fir de Conversatie Nico Weber

Hi Wynand,

 This is meant to run inside a virtual console (like the quake console)
 which receive all IO events primarily including mouse and keyboard
 events.

 Any help would be greatly appreciated as I have no idea where to
 start.

this is not easily possible, there's no libVim. And even if you're  
willing to modify vim's source, it will be a lot of work because vim  
insists on owning the main loop (ie, code execution sits in vim and  
it just calls its gui parts every now and then). This is not what you  
want when you're writing a game.

One thing you could try would be running vim in a separate process  
and talk to it via IPC. To do this, you could add a new GUI to vim  
which does nothing but forward drawing commands etc to your app and  
receives key input commands from your app. MacVim takes this  
approach, you can take a look at it's modifications to vim's source  
for some ideas ( http://code.google.com/p/macvim/ ). Short overview:  
MacVim/gui_macvim.m implements the gui functions vim is going to call  
and forwards them to a MMBackend, which uses OS X' IPC mechanism to  
send them to another process. Apart from that, you only need to look  
at the required modifications to vim's core (macvim-*-patch.tar.gz in  
the downloads section). But it's still a lot of work.

Sorry for the bad news :-|

Nico


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: doc nitpicking

2007-10-11 Fir de Conversatie Yakov Lerner
The screen is not redrawn then, thus you have to use
CTRL-L or :redraw! if the command did display something.

I do not think this paragraph can be interpreted ambiguously.

The first part - The screen is not redrawn then - I see it as
information not operational, it does not contradict the second part.

The second part is operational. It instructs the user
when to use Ctrl-L and when not to use Ctrl-L:

   You have to use Ctrl-L(or :redraw!) *IF* the command did display
something.

Do you interpret the above phrase differently than me ?
The problem with this instruction, it is incorrect.

Yakov

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Integration of Vim

2007-10-11 Fir de Conversatie SM Smithfield

I have a similar interest. I want to integrate vim with a smalltalk  
environment. I have also looked into vim's codebase. Where to start?

It seems like that it would be very useful to have:

A way to have a buffer that is async linked to a source that is not a  
file, but behaves like one.

And

A way to send async messages. There are so many ways to do that, e.g.  
via a tmp file, via pipes. I favor tcp.

It seems like this vimshell and slim-vim (recently somewhat deceased)  
would benefit from the addition of something like this to vim as well.

If I had any idea where to start, I would have already. Is there a  
heartbeat like cursor flashing, off of which this could piggy-back?

I would really love to be able to extend this async treatment to all  
of the scripting interpreters that vim already supports.

If there were a clean way to do this, vim could have a slime-like env  
for 6 different languages rather quickly. And that would be cool.


On Oct 11, 2007, at 2:38 AM, Wynand wrote:


 Hi

 I hope this is the right discussion board for the question.

 I wrote a game engine with embedded script engines and would like to
 integrate vim as the primary editor for the scripts and other
 functions. I googled it for several days now and cant really come up
 with anything useful, I also downloaded the source and found it quite
 overwhelming at first glance. Is there any documentation on how to
 interface with Vim, or any C/C++ libraries that I can use to do so?
 i.e libVim or similar?

 This is meant to run inside a virtual console (like the quake console)
 which receive all IO events primarily including mouse and keyboard
 events.

 Any help would be greatly appreciated as I have no idea where to
 start.

 Thanks
 Wynand


 


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Integration of Vim

2007-10-11 Fir de Conversatie krischik

On 11 Okt., 08:38, Wynand [EMAIL PROTECTED] wrote:
 Hi

 I hope this is the right discussion board for the question.

 I wrote a game engine with embedded script engines and would like to
 integrate vim as the primary editor for the scripts and other
 functions. I googled it for several days now and cant really come up
 with anything useful, I also downloaded the source and found it quite
 overwhelming at first glance. Is there any documentation on how to
 interface with Vim, or any C/C++ libraries that I can use to do so?
 i.e libVim or similar?

 This is meant to run inside a virtual console (like the quake console)
 which receive all IO events primarily including mouse and keyboard
 events.

 Any help would be greatly appreciated as I have no idea where to
 start.

Vim is usually integrated by starting a Vim and remote control it.
The following options are open:

1) You start the console version inside a terminal emulator. Used by
vimplugin [1].
2) You start the GUI version as Vim-Server. Used by gvimplugin [2].
3) You start the GUI version as a Netbeans-Server. Used by eeedit [3].

Note that the 3 projects mentioned currently merge - with eeedit /
Netbeans as base. It can just do the coolest stuff - just look at the
screen shot:

http://code.google.com/p/eeedit/wiki/ScreenShots

Martin

[vimplugin]: http://vimplugin.sourceforge.net/wiki/pmwiki.php
[gvimplugin]: 
http://vimplugin.svn.sourceforge.net/viewvc/vimplugin/branches/gvimplugin/
[eeedit]: http://code.google.com/p/eeedit/



--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: is this a bug or a feature??

2007-10-11 Fir de Conversatie Charles E Campbell Jr

denis wrote:

Hello,

I am seeing a problem where execution of seemingly unrelated commands
causes a problem with resetting 'lines' variable

 here, lines is set to 23
let g:foo = tempname()
call system('touch ' . g:foo)
 here it is reset to the height of my xterm - in this case 50

eh? is this a bug or a feature?

Below please find a minimal .vimrc as well as the output when starting
gvim from an xterm on ubuntu.

Further below is my :version information.

---
[20:41:16 [EMAIL PROTECTED] ~
$ cat .vimrc-test
if has(gui_running)
  set lines=23
endif

echo lines
let g:foo = tempname()
echo g:foo
echo lines
call system('touch ' . g:foo)
echo lines


[20:41:20 [EMAIL PROTECTED] ~
$ vim -g -u .vimrc-test
23
/tmp/v102439/0
23
50
---
  

Hello!

Well, I don't see that behavior.   Do you have a .gvimrc file, and 
what's in it?

Regards,
Chip Campbell


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: doc nitpicking

2007-10-11 Fir de Conversatie Ben Schmidt

 vim -u NONE
 :help helpget some text on screen, and statuslines
 :silent :true  The screen is garbled.

Not for me.

I think the point made earlier was that the docs actually, in the most strict 
logical sense, don't say anything about what you need to do if a command 
doesn't 
output anything. I.e. they say you need Ctrl-L if the command does output 
something, but are silent (no pun intended) on whether or not you need a Ctrl-L 
if 
the command doesn't output anything. However, in English 'if' often really 
means 
'if and only if', so the logic nitpicking isn't really valid--a phrase such as 
'particularly if' or 'and even sometimes if it doesn't' could perhaps make the 
documentation clearer--if the behaviour you mention actually is reproducible 
elsewhere and not just a bug in a particular version, system or GUI!

Which version/system/GUI are you using?

Ben.



Send instant messages to your online friends http://au.messenger.yahoo.com 


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Integration of Vim

2007-10-11 Fir de Conversatie Ben Schmidt

 Wow, Thanks for everyone's feedback :), there are some great ideas on 
 how to get started. I particularly like the idea of running it as a server.
 
   2) You start the GUI version as Vim-Server. Used by gvimplugin [2].
   3) You start the GUI version as a Netbeans-Server. Used by eeedit [3].
 
 The next question that remains is then how you go about talking to the 
 server. I started looking at the source code for [3] and it doesn't seem 
 excessively hard, but I'd rather not count my chickens till they hatched.

Try reading

:help clientserver

for a start. Once you can get Vim itself to do what you need, you should be 
able 
to make something else. E.g. find the code that implements the --remote-send 
option and integrate it into your application.

Smiles,

Ben.




Send instant messages to your online friends http://au.messenger.yahoo.com 


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Custom Software Programming

2007-10-11 Fir de Conversatie krischik

On 10 Okt., 17:38, sc [EMAIL PROTECTED] wrote:
 On Wednesday 10 October 2007 07:11, VB wrote:

 big snip

 lovely -- spam on vim_dev -- please tell me we don't need a
 moderator

We are all moderators: first you can click the one star and then there
an option to report abuse. Ok, a slight disadvantage: You need to be
on-line for those options.

Anyway. I am going to report this user - but then: so more so merrier
- go ahead report him as well.

Martin


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Integration of Vim

2007-10-11 Fir de Conversatie krischik



On 11 Okt., 13:54, Wynand Marais [EMAIL PROTECTED] wrote:
 Wow, Thanks for everyone's feedback :), there are some great ideas on how to
 get started. I particularly like the idea of running it as a server.

  2) You start the GUI version as Vim-Server. Used by gvimplugin [2].

communication using the --remote options:


   --remote Dateien   Editiere Dateien in einem Vim-Server falls
möglich
   --remote-silent Dateien  Dasselbe ohne Warnung, wenn kein Server
vorhanden ist
   --remote-wait Dateien  Wie --remote, aber warte, bis die
Dateien editiert wurden
   --remote-wait-silent files  Dasselbe ohne Warnung, wenn kein
Server vorhanden ist
   --remote-tab Dateien  Wie --remote, aber öffne ein Tab für jede
Datei
   --remote-send keys Schicke keys zu einem Vim Server und beende
   --remote-expr Ausdruck Führe Ausdruck in einem Vim-Server
aus und drucke das Ergebnis
   --serverlist Drucke verfügbare Vim-Server-Namen und beende
   --servername Name  Benutze den Vim-Server Name


This is pretty simple but still, with  --remote-send and --remote-expr
you can get some quite advanced remote control done.

The way it works is first start a server gvim with:


gvim --servername Server Name --remote-silent File Name


and then you send command to the server. Of example you can end the
server again with:


gvim --servername Server Name --remote-send ':xaCR'


or the following command will tell you if the file has been modified:


gvim --servername Server Name --remote-expr 'modified'


Since the gvim sending the command won't read any plugins performance
is quite ok.

  3) You start the GUI version as a Netbeans-Server. Used by eeedit [3].

Never used that but it seems quite powerful and with the (only one of
them)


--windowid HWND Open Vim inside another win32 widget
 --socketid HWND Open Vim inside another win32 widget


you can even embed inside in you application.

Martin


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: doc nitpicking

2007-10-11 Fir de Conversatie Yakov Lerner
On 10/11/07, Yakov Lerner [EMAIL PROTECTED] wrote:

 On 10/11/07, ap [EMAIL PROTECTED] wrote:
 
 
 
 
  On Oct 10, 10:22 pm, Yakov Lerner [EMAIL PROTECTED] wrote:
   :help :! says:
   :silent !{cmd}
   The screen is not redrawn then, thus you have to use
   CTRL-L or :redraw! if the command did display something.
  
   The last part (if the command did display something) is not true.
   In console vim, screen is always grabled after ':silent !CMD
   even if CMD did not print anything. (try ':silent !true' after ':help
   help').
   The correct wording would be:
  
   :silent !{cmd}
   The screen is not redrawn then, thus you have to use
   CTRL-L or :redraw! even if the command did not display anything.
  
   Yakov
 
  logic nitpicking:



 I forgot to include the testcase that demonstrates
 the discrepancy between the doc and the reality. Here it is:

 vim -u NONE
 :help helpget some text on screen, and statuslines
 :silent :true  The screen is garbled. Now you need Ctrl-L.


Oops. This sould have veen
 :silent !true  The screen is garbled. Now you need Ctrl-L.

console vim, Linux, v 7.1.2.
 This is noting new. I had always have this behavour since 6.3 times.
In GUI vim, the sceen seems to be not garbled in such scenario.

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: is this a bug or a feature??

2007-10-11 Fir de Conversatie denis


On Oct 11, 6:00 am, Charles E Campbell Jr [EMAIL PROTECTED]
wrote:
 denis wrote:
 I am seeing a problem where execution of seemingly unrelated commands
 causes a problem with resetting 'lines' variable

 Well, I don't see that behavior.   Do you have a .gvimrc file, and
 what's in it?

That's extremely strange :( I don't seem to have a .gvimrc, but just
to make sure I started vim -g like so:

$ vim -g -u .vimrc-test -U NONE

The result is still the same!

-d


--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



syntaxset error

2007-10-11 Fir de Conversatie Gary Johnson

I just encountered this error message while trying to debug a 
problem with extracting vimballs.  It's not related to 
vimballs--that's just how I happened to find it.  I executed

   vim -V9verbose.out DrawIt.vba.gz

and discovered this message among the others in the verbose.out log 
file:

   ...
   continuing in /home/garyjohn/share/vim/vim71/syntax/manual.vim
   Error detected while processing 
/home/garyjohn/share/vim/vim71/syntax/manual.vim:
   line   20:
   E216: No such group or event: syntaxset FileType
   finished sourcing /home/garyjohn/share/vim/vim71/syntax/manual.vim
   ...

Here is that section of manual.vim, with line numbers enabled:

19  Remove the connection between FileType and Syntax autocommands.
20 silent! au! syntaxset FileType

Is this a bug or is this error expected under some conditions and 
hence the silent! command?  If the latter, it would be nice if a 
comment to that effect could be added to syntax/manual.vim so that 
folks could know to ignore the message when it appears in their 
debug logs.

I see this running vim 7.1.79 on Cygwin and 7.1.77 on SunOS 5.8.

Regards,
Gary

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: doc nitpicking

2007-10-11 Fir de Conversatie Bram Moolenaar


Yakov Lerner wrote:

 :help :! says:
 :silent !{cmd}
 The screen is not redrawn then, thus you have to use
 CTRL-L or :redraw! if the command did display something.
 
 The last part (if the command did display something) is not true.
 In console vim, screen is always grabled after ':silent !CMD
 even if CMD did not print anything. (try ':silent !true' after ':help
 help').
 The correct wording would be:
 
 :silent !{cmd}
 The screen is not redrawn then, thus you have to use
 CTRL-L or :redraw! even if the command did not display anything.

The docs are correct, :silent !true doesn't mess up the display for
me.

Check your shell init scripts for something that produces output.

-- 
hundred-and-one symptoms of being an internet addict:
14. You start introducing yourself as Jim at I-I-Net dot net dot au

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: doc nitpicking

2007-10-11 Fir de Conversatie Yakov Lerner
On 10/11/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


 Yakov Lerner wrote:

  :help :! says:
  :silent !{cmd}
  The screen is not redrawn then, thus you have to use
  CTRL-L or :redraw! if the command did display something.
 
  The last part (if the command did display something) is not true.
  In console vim, screen is always grabled after ':silent !CMD
  even if CMD did not print anything. (try ':silent !true' after ':help
  help').
  The correct wording would be:
 
  :silent !{cmd}
  The screen is not redrawn then, thus you have to use
  CTRL-L or :redraw! even if the command did not display anything.

 The docs are correct, :silent !true doesn't mess up the display for
 me.

 Check your shell init scripts for something that produces output.


To make sure that shell init script are not even invoked, I set
  :set shell=/bin/true
Still, screen is cleared after :silent !/bin/true.
In gdb, I caught the place and the string that clears the screen.
The string is \033[?1049h\033[?1h\033= (length=15).
It is printed after fork+execve(/bin/true), at this place:

mch_write ( s=0x820b040 \033[?1049h\033[?1h\033=..., len=15) at
os_unix.c:307
307 write(1, (char *)s, len);
(gdb) n

[Yakov] the vim screen is cleared at after the write() above

308 if (p_wd)   /* Unix is too fast, slow down a bit more */
(gdb) where
#0  mch_write (
s=0x820b040 \033[?1049h\033[?1h\033=..., len=15) at os_unix.c:308
#1  0x081a2b74 in ui_write (
s=0x820b040 \033[?1049h\033[?1h\033=..., len=15) at ui.c:51
#2  0x0819ed96 in out_flush () at term.c:2545
#3  0x0819fa6a in starttermcap () at term.c:3233
#4  0x08090393 in do_shell (cmd=0x82155d8 /bin/true, flags=0) at
ex_cmds.c:1471
#5  0x0808fac8 in do_bang (addr_count=0, eap=0xbf96b110, forceit=0, do_in=1,
do_out=1) at ex_cmds.c:1021
#6  0x080a99de in ex_bang (eap=0xbf96b110) at ex_docmd.c:8305
#7  0x080a0e58 in do_one_cmd (cmdlinep=0xbf96b278, sourcing=0,
cstack=0xbf96b2d4, fgetline=0x80b4454 getexline,
cookie=0x0) at ex_docmd.c:2622
#8  0x0809e718 in do_cmdline (cmdline=0x0, getline=0x80b4454 getexline,
cookie=0x0, flags=0) at ex_docmd.c:1100
#9  0x0811b3f5 in nv_colon (cap=0xbf96b658) at normal.c:5168
#10 0x08114a32 in normal_cmd (oap=0xbf96b6f8, toplevel=1) at normal.c:1141
#11 0x080dc833 in main_loop (cmdwin=0, noexmode=0) at main.c:1180
#12 0x080dc383 in main (argc=3, argv=0xbf96b8f4) at main.c:939

After that, there is only one mch_write(), \033[1;25H (len=7),
and screen remains empty, and vim waits for input.

Yakov

--~--~-~--~~~---~--~~
You received this message from the vim_dev maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---