Re: vim console?

2007-02-27 Thread Charles E Campbell Jr

John Doe wrote:


Oh, thank you for your reply:

I wanted to know how to _program_ the vim 'console', from a script: the
general direction on how to do it: I know how to obtain the number of
columns and rows, but how about how to write a specific char to a
specific location, also is it possible to access the Internet from a
script, just as it's possible from awk, for example.

 


Anything you can type from the command line can go into a script.
Anything you type in normal mode can be typed from a command line; see  
:help :norm

Hence anything from normal mode can also go into a script (just use norm).

I'm not sure about what you mean by obtaining the number of columns and 
rows.


How to write to a specific location:  there are several ways, but one is:

linewise :   call setline(lnum,"new line goes here") " lnum  is an 
integer


writing a character to a specific column in a specific line:  (replacing 
in line #lnum, column# colnum, with character X)


lnum  " put line number in instead of lnum
colnum|" put column number in instead of colnum
norm! rX 

Accessing the internet is possible, see  :help :!  and  :help system() 
.  Alternatively, you may use netrw's url format:


  r scp://hostname/path/to/a/file
 w ftp://hostname/path/to/a/file
 so scp://hostname/path/to/a/file

Regards,
Chip Campbell



Re: vim console?

2007-02-27 Thread Charles E Campbell Jr

John Doe wrote:


How to control the vim 'console' from programs like the tetris and other
games written for vim? Of course, I could look in the source, but am
confused from it? Are there multiple ways to accomplish this?

 

I don't see any other replies, so here goes:  I'm not sure what you're 
asking.  Every game has its own methods for
controlling itself.  Mines.vim, for example, provides both keyboard and 
mouse interaction.  So, I suggest reading

whatever help comes with the game.

Regards,
Chip Campbell