Re: .vimrc from URL

2007-01-12 Thread Charles E Campbell Jr

A.J.Mechelynck wrote:


Charles E Campbell Jr wrote:


OK, with all that:

 vim -U NONE -c set nocp|so $HOME/.vim/plugin/netrwPlugin.vim -c 
so scp://HOSTNAME/.vimrc




Rather than -U NONE (i.e., no gvimrc) shouldn't that be -u NORC 
(i.e., with small u: don't source $HOME/.vimrc but do source the 
global plugins)? I suggest the amended command-line below (with --cmd 
for early sourcing):


vim -u NORC -N --cmd runtime plugin/netrwPlugin.vim --cmd source 
scp://HOSTNAME/.vimrc



Sounds better!

I'll put a note to that effect in pi_netrw.txt.

Regards,
Chip Campbell



Re: .vimrc from URL

2007-01-11 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Maurí­cio wrote:


I change my .vimrc very often, and I use vim
in many computers. The result is that my changes
are not always updated to all computers.

Is it possible to ask vim to update its
.vimrc from an URL, like an FTP address?



With v108c, netrw can source remote files.  You can get v108c from my 
website:

  http://mysite.verizon.net/astronaut/vim/index.html#NETRW

With vim 7.0 and official patches 1-182, vim will emit an error message 
(but works anyway) when sourcing a remote file.
With the same plus the patch to vim's source at 
http://mysite.verizon.net/astronaut/vim/index.html#SOURCECMD, no error 
message gets issued.
The patch at my website provides a new autocmd event: SourceCmd, which 
netrw will take advantage of if present.


OK, with all that:

 vim -U NONE -c set nocp|so $HOME/.vim/plugin/netrwPlugin.vim -c so 
scp://HOSTNAME/.vimrc


will

 (a) avoid attempting to source in any local .vimrc
 (b) source in netrwPlugin.vim from $HOME/.vim/plugin
 (c) source in the remote .vimrc via scp, presumably on HOSTNAME.

Regards,
Chip Campbell




Rather than -U NONE (i.e., no gvimrc) shouldn't that be -u NORC (i.e., with 
small u: don't source $HOME/.vimrc but do source the global plugins)? I 
suggest the amended command-line below (with --cmd for early sourcing):


vim -u NORC -N --cmd runtime plugin/netrwPlugin.vim --cmd source 
scp://HOSTNAME/.vimrc



Best regards,
Tony.


RE: .vimrc from URL

2007-01-05 Thread Hugo Ahlenius
| I change my .vimrc very often, and I use vim
| in many computers. The result is that my changes
| are not always updated to all computers.

Mauricio,
Maybe you should consider having your .vimrc (and other vim configuration
files, like plugins etc) under source control? I have all my personal
vimfiles directory + .vimrc under subversion, and it works very well. I
don't synchronize these daily with the repository, unless there are some
major changes, but now and then (weekly?).

Cheers,
Hugo


--
Hugo Ahlenius
fraxinus (at) oxel.net
http://www.oxel.net




Re: .vimrc from URL

2007-01-05 Thread Albie Janse van Rensburg

Hi all (Hugo, sorry about the double-post - I replied *wrong*)

I find this idea of a net-vimrc very interesting, so I have made a
simple .vimrc that the OP can use:

===
so $VIMRUNTIME/plugin/netrwPlugin.vim
Nread {website}_vimrc.http
sav! ~/__vimrc
so ~/__vimrc
silent !rm ~/__vimrc
enew
===

(For some reason, the netrw plugin is named netrwPlugin.vim on my
version of vim.  Modify as is needed.)

Of course, this must be loaded in each vimrc on the network, and you
will need a web server to host the master vimrc.

I have also hacked about a bit, and now I also have some functions for
sourcing a file over a network, which I am attaching in
remotexecute.vim. If someone could look it over it would be
appreciated.  It only handles reading over FTP and HTML at the moment.

I then went ahead and added the following to the tail of my vimrc:

===

 netrw source the remote exec functions file - ugly!
  new
  Nread http://morph.telspace.co.za/remotexecute.vim;
  let s:tempfilename = tempname()
  execute(sav!  . s:tempfilename)
  execute(so  . s:tempfilename)
  execute(silent !rm  . s:tempfilename)
  quit!

 Now that we have the functions for sourcing files over a net connection, we
 can map keys to edit our vimrc over the net, and associated functions.

 Read the _vimrc into a new buffer
nmap silent C-F1 :newCR:execute ReadNetFileFTP(, _vimrc,
)CR
 Write the current buffer to the onlince _vimrc
nmap silent S-F1 :execute WriteNetFileFTP(, _vimrc, )CR

===

Unfortunately, there seems to be something wrong with the write (Nwrite)
action, whenever I try to write a file back to the server, I get the error:

===
(netrw) Processing your write request
***netrw*** VIR14E.tmp: File not found
Press cr to continue
===

or (with g:netrw_ftp = 1):

===
(netrw) Processing your write request
***netrw*** Invalid command.
Press cr to continue
===

How can I use netrw to write a file over ftp?  I have tried various
different methods to do this, but none seem to work.  Does anyone else
have the same problem?

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | http://counter.li.org

On 1/5/07, Hugo Ahlenius [EMAIL PROTECTED] wrote:

| I change my .vimrc very often, and I use vim
| in many computers. The result is that my changes
| are not always updated to all computers.

Mauricio,
Maybe you should consider having your .vimrc (and other vim configuration
files, like plugins etc) under source control? I have all my personal
vimfiles directory + .vimrc under subversion, and it works very well. I
don't synchronize these daily with the repository, unless there are some
major changes, but now and then (weekly?).

Cheers,
Hugo


--
Hugo Ahlenius
fraxinus (at) oxel.net
http://www.oxel.net





remotexecute.vim
Description: Binary data


[Fwd: Re: .vimrc from URL]

2007-01-05 Thread A.J.Mechelynck

Forwarding to list.

 Original Message 
Subject: Re: .vimrc from URL
Date: Fri, 5 Jan 2007 13:12:41 +0200
From: Albie Janse van Rensburg [EMAIL PROTECTED]
To: A.J.Mechelynck [EMAIL PROTECTED]
References: [EMAIL PROTECTED] [EMAIL PROTECTED]	 
[EMAIL PROTECTED] [EMAIL PROTECTED]	 
[EMAIL PROTECTED]


Hi all

I find this idea of a net-vimrc very interesting, so I have made a
simple .vimrc that the OP can use:

===
so $VIMRUNTIME/plugin/netrwPlugin.vim
Nread {website}_vimrc.http
sav! ~/__vimrc
so ~/__vimrc
silent !rm ~/__vimrc
enew
===

(For some reason, the netrw plugin is named netrwPlugin.vim on my
version of vim.  Modify as is needed.)

Of course, this must be loaded in each vimrc on the network, and you
will need a web server to host the master vimrc.

I have also hacked about a bit, and now I also have some functions for
sourcing a file over a network, which I am attaching in
remotexecute.vim. If someone could look it over it would be
appreciated.  It only handles reading over FTP and HTML at the moment.

I then went ahead and added the following to the tail of my vimrc:

===

 netrw source the remote exec functions file - ugly!
new
Nread http://morph.telspace.co.za/remotexecute.vim;
let s:tempfilename = tempname()
execute(sav!  . s:tempfilename)
execute(so  . s:tempfilename)
execute(silent !rm  . s:tempfilename)
quit!

 Now that we have the functions for sourcing files over a net connection, we
 can map keys to edit our vimrc over the net, and associated functions.

 Read the _vimrc into a new buffer
nmap silent C-F1 :newCR:execute ReadNetFileFTP(, _vimrc,
)CR
 Write the current buffer to the onlince _vimrc
nmap silent S-F1 :execute WriteNetFileFTP(, _vimrc, )CR

===

Unfortunately, there seems to be something wrong with the write (Nwrite)
action, whenever I try to write a file back to the server, I get the error:

===
(netrw) Processing your write request
***netrw*** VIR14E.tmp: File not found
Press cr to continue
===

or (with g:netrw_ftp = 1):

===
(netrw) Processing your write request
***netrw*** Invalid command.
Press cr to continue
===

How can I use netrw to write a file over ftp?  I have tried various
different methods to do this, but none seem to work.  Does anyone else
have the same problem?

--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | http://counter.li.org

On 1/5/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Mikolaj Machowski wrote:
 On pią sty 5 2007, Mikolaj Machowski wrote:
 Mikolaj Machowski wrote:
 On pią sty 5 2007, Maurí­cio wrote:
 Or else, have the following at the top of the vimrc:

let g:vimrcdate =   4 Jan 2007 22:49 UTC
echo This vimrc was last changed on g:vimrcdate
if input(Do you want to continue? ) !~? y
qall!
endif
 Since this requires specific .vimrc OP can explicitly source netrw
^^^
 at the beginning of .vimrc; open net address; write it to temporary
 file; source that file; remove temporary file.

 m.
 I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT
 YET sourced. So if the vimrc tries to issue

 That is why I wrote explicitly source netrw.

 m.



Oops, I read too fast. Looks like a kludge to me but I guess it would work.


Best regards,
Tony.



remotexecute.vim
Description: Binary data


Re: .vimrc from URL

2007-01-05 Thread Albie

Hi DrChip

I have updated netrw.

I then checked out a  page from my ftp server using


Nread ftp://morph.t.../_vimrc


Then, to save it back, I used:


Nwrite ftp://mo.../_vimrc


Now I get a new, much improved error message:


NetrwMessage --No lines in buffer--
Error detected whole processing function netrw#NetRestorePosn:
line19:
E121: Undefined variable: w:netrw_hline
E15: Invalid expression: norm! .w:netrw_hline.G0z\CR
line23:
E121: Undefined variable: w:netrw_line
E15: Invalid expression: norm! .w:netrw_line.G0.w:netrw_col.\bar
Press ENTER or type command to continue


after which a new buffer window is opened (unsaved), containing:


VIF1DF.tmp: File not found



Charles E Campbell Jr wrote:
Albie: have you updated your netrw to 107?  To get up-to-date versions 
of vimball and netrw:


  vimball:
http://vim.sourceforge.net/scripts/script.php?script_id=1502
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#VimBall
 (the mysite.verizon.net one will be the more recent version)

  netrw:
http://vim.sourceforge.net/scripts/script.php?script_id=1075
 -or-   http://mysite.verizon.net/astronaut/vim/index.html#NETRW

(you'll need an up-to-date vimball to extract netrw).

Regards,
Chip Campbell






--
Albie Janse van Rensburg (neonpill)

Registered Linux User 438873 | http://counter.li.org


Re: .vimrc from URL

2007-01-05 Thread Maurí­cio

  I change my .vimrc very often, and I use vim
  in many computers. (...)

 Mauricio, Maybe you should consider having your
 .vimrc (and other vim configuration files, like
 plugins etc) under source control? I have all my
 personal vimfiles directory + .vimrc under
 subversion, and it works very well. I don't
 synchronize these daily with the repository,
 unless there are some major changes, but now and
 then (weekly?).  (...)

I like the idea. Today, I use Google Docs to save
my files. However, I know of no free subversion
(or other system) sites where I could store my
files. Do you?

  Maurício



Re: .vimrc from URL

2007-01-05 Thread Maurí­cio

 I change my .vimrc very often, and I use vim in
 many computers. The result is that my changes
 are not always updated to all computers.  Is it
 possible to ask vim to update its .vimrc from
 an URL, like an FTP address?


 The vimrc is sourced before the global plugins,
 in particular before the netrw plugin. So I
 think the short answer is no. What you could do
 (maybe) is setup a shell script (aka Batch
 file on Dos/Windows) to synchronize your vimrc
 from the master online version just before
 starting Vim. (...)

I don't need vim to read .vimrc from URL at
startup. I can just map a key, like F12, to try to
download that file and update the one at my home
dir. Then I can just press F12 and restart vim
when I want a configuration update.

However, writing an external script to do that for
me can be easier, since I know nothing about vim
scripting...

  Thanks,
  Maurício



Re: .vimrc from URL

2007-01-04 Thread A.J.Mechelynck

Maurí­cio wrote:

  Hi,

I change my .vimrc very often, and I use vim
in many computers. The result is that my changes
are not always updated to all computers.

Is it possible to ask vim to update its
.vimrc from an URL, like an FTP address?

  Thanks,
  Maurício




The vimrc is sourced before the global plugins, in particular before the netrw 
plugin. So I think the short answer is no.


What you could do (maybe) is setup a shell script (aka Batch file on 
Dos/Windows) to synchronize your vimrc from the master online version just 
before starting Vim.


Or else, have the following at the top of the vimrc:

let g:vimrcdate =   4 Jan 2007 22:49 UTC
echo This vimrc was last changed on g:vimrcdate
if input(Do you want to continue? ) !~? y
qall!
endif


Best regards,
Tony.


Re: .vimrc from URL

2007-01-04 Thread Mikolaj Machowski
On pią sty 5 2007, Maurí­cio wrote:

 Or else, have the following at the top of the vimrc:

   let g:vimrcdate =   4 Jan 2007 22:49 UTC
   echo This vimrc was last changed on g:vimrcdate
   if input(Do you want to continue? ) !~? y
   qall!
   endif

Since this requires specific .vimrc OP can explicitly source netrw
at the beginning of .vimrc; open net address; write it to temporary
file; source that file; remove temporary file.

m.




Re: .vimrc from URL

2007-01-04 Thread Mikolaj Machowski
On pią sty 5 2007, Maurí­cio wrote:
 The vimrc is sourced before the global plugins, in particular before the
 netrw plugin. So I think the short answer is no.

BTW - if netrw could directly source files over the net it could open
interesting possibilities for script repositories.

m.



Re: .vimrc from URL

2007-01-04 Thread A.J.Mechelynck

Mikolaj Machowski wrote:

On pią sty 5 2007, Maurí­cio wrote:

Or else, have the following at the top of the vimrc:

let g:vimrcdate =   4 Jan 2007 22:49 UTC
echo This vimrc was last changed on g:vimrcdate
if input(Do you want to continue? ) !~? y
qall!
endif


Since this requires specific .vimrc OP can explicitly source netrw
at the beginning of .vimrc; open net address; write it to temporary
file; source that file; remove temporary file.

m.





I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT YET 
sourced. So if the vimrc tries to issue


:view http://users.example.net/firstname.lastname/vim/vimrc

there will be an error: invalid filename, path not found, file not 
found, whatever. The Net will not be accessed because netrw is not yet available.



Best regards,
Tony.


Re: .vimrc from URL

2007-01-04 Thread Mikolaj Machowski
On pią sty 5 2007, Mikolaj Machowski wrote:
 Mikolaj Machowski wrote:
  On pią sty 5 2007, Maurí­cio wrote:
  Or else, have the following at the top of the vimrc:
 
 let g:vimrcdate =   4 Jan 2007 22:49 UTC
 echo This vimrc was last changed on g:vimrcdate
 if input(Do you want to continue? ) !~? y
 qall!
 endif
 
  Since this requires specific .vimrc OP can explicitly source netrw
   ^^^
  at the beginning of .vimrc; open net address; write it to temporary
  file; source that file; remove temporary file.
 
  m.

 I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT
 YET sourced. So if the vimrc tries to issue

That is why I wrote explicitly source netrw.

m.



Re: .vimrc from URL

2007-01-04 Thread A.J.Mechelynck

Mikolaj Machowski wrote:

On pią sty 5 2007, Mikolaj Machowski wrote:

Mikolaj Machowski wrote:

On pią sty 5 2007, Maurí­cio wrote:

Or else, have the following at the top of the vimrc:

let g:vimrcdate =   4 Jan 2007 22:49 UTC
echo This vimrc was last changed on g:vimrcdate
if input(Do you want to continue? ) !~? y
qall!
endif

Since this requires specific .vimrc OP can explicitly source netrw

   ^^^

at the beginning of .vimrc; open net address; write it to temporary
file; source that file; remove temporary file.

m.

I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT
YET sourced. So if the vimrc tries to issue


That is why I wrote explicitly source netrw.

m.




Oops, I read too fast. Looks like a kludge to me but I guess it would work.


Best regards,
Tony.