Re: Pattern questions

2006-05-23 Thread A.J.Mechelynck

Zdenek Sekera wrote:

I have this:

if (char =~ '\m[;|?:[EMAIL PROTECTED]*(){}\\_+-[\]/\]')
  do something
endif

Basically it is checking for all non-alphanumeric chars
(expect '=').

1. how do I include the ' char?.
   I can't seem to find a proper way.
   (I'd like to keep the patter in enclosed in '...')

2. why when the pattern ends with '+' or '\+' do I get
   an error?

---Zdenek


1. Starting with version 7, you can have a single quote in a 
single-quoted string by doubling the single quote. Thus,  (four 
single quotes) represents one single quote and 'a''b' (quote a quote 
quote b quote) is a string consisting of the letters a and b with a 
single quote between them.


In all versions, you can concatenate strings, and a single quote can be 
enclosed in a double-quoted string. Thus, '' . ' (single double 
single space dot space double single double) is an expression whose 
value is a String consisting of a double quote followed by a single quote.


2. I don't know, but I think it's either a bug, or documented under 
:help pattern.txt somewhere.



Best regards,
Tony.


RE: Pattern questions

2006-05-23 Thread Zdenek Sekera
 -Original Message-
 From: A.J.Mechelynck [mailto:[EMAIL PROTECTED] 
 Sent: 23 May 2006 14:22
 To: Zdenek Sekera
 Cc: vim-dev@vim.org
 Subject: Re: Pattern questions
 
 Zdenek Sekera wrote:
  I have this:
 
  if (char =~ '\m[;|?:[EMAIL PROTECTED]*(){}\\_+-[\]/\]')
do something
  endif
 
  Basically it is checking for all non-alphanumeric chars
  (expect '=').
 
  1. how do I include the ' char?.
 I can't seem to find a proper way.
 (I'd like to keep the patter in enclosed in '...')
 
  2. why when the pattern ends with '+' or '\+' do I get
 an error?
 
  ---Zdenek
 
 
 1. Starting with version 7, you can have a single quote in a 
 single-quoted string by doubling the single quote. Thus,  (four 
 single quotes) represents one single quote and 'a''b' (quote a quote 
 quote b quote) is a string consisting of the letters a and b with a 
 single quote between them.
 

Arrrgh, missed that in the doc somewhere, I'm running vim7 
(I forgot to say so)

 In all versions, you can concatenate strings, and a single 
 quote can be 
 enclosed in a double-quoted string. Thus, '' . ' (single double 
 single space dot space double single double) is an expression whose 
 value is a String consisting of a double quote followed by a 
 single quote.
 

Arrrgh :-), that I new but didn't think of.

 2. I don't know, but I think it's either a bug, or documented under 
 :help pattern.txt somewhere.

My feelings, too, but I can't find it anywhere in the pattern.txt
(and I printer the newest on purpose :-)!

Thanks, Tony, for help.

---Zdenek


set readonly - strange?

2006-05-23 Thread Zdenek Sekera

create a file ~/.vimtest as follows:

cat  .vimtest
set nocompatible
set readonly
C-D

and execute (g)vim:

vim .vimtest -u .vimtest

try :set readonly? and you'll get 'noreadonly'.

Looks strange at the minimum, bug?

---Zdenek



Re: set readonly - strange?

2006-05-23 Thread Eric Arnold

I wouldn't expect that to work.  There is no defined loaded buffer
when the -u vimrc is run.  'readonly' is local to buffers only, so in
your example, it has no buffer to be applied to.

If you want everything to be readonly, try setting a BufEnter autocommand.

If you want just one file to be readonly, try setting the mode line.

Also consider:

gvimd -c 'so .vimtest' .vimtest

On 5/23/06, Zdenek Sekera [EMAIL PROTECTED] wrote:

create a file ~/.vimtest as follows:

cat  .vimtest
set nocompatible
set readonly
C-D

and execute (g)vim:

vim .vimtest -u .vimtest

try :set readonly? and you'll get 'noreadonly'.

Looks strange at the minimum, bug?

---Zdenek




Re: set readonly - strange?

2006-05-23 Thread Eric Arnold

As far as I can tell, there are several instances where there are
transitory buffers as vim is starting, opening a new tab, probably
some in closing op.s.

I don't know if I used the right word by saying the buffer is
undefined, but I don't think it it's guaranteed to be usable until a
certain point, which is after -u, and at the first file loaded, i.e.
-c

If you open a buffer explicitly from inside .vimtest , then that's a
different story.

It's kinda bug-ish, but it's not a bug unless it's contrary to stated
behavior.  It'll be interesting to see how Bram addresses it.

On 5/23/06, Yakov Lerner [EMAIL PROTECTED] wrote:

 On 5/23/06, Zdenek Sekera [EMAIL PROTECTED] wrote:
  create a file ~/.vimtest as follows:
 
  cat  .vimtest
  set nocompatible
  set readonly
  C-D
 
  and execute (g)vim:
 
  vim .vimtest -u .vimtest
 
  try :set readonly? and you'll get 'noreadonly'.

The buffer does exist when initfile is executed. The ':ls' in initfile shows it.
Adding more printouts to initfile shows interesting results:

vim -u 1 1
- file called 1 ---
set nocompatible
ls
call input('before set readonly 111')
set readonly
set readonly?
ls
set readonly?
set readonly?
echo readonly=.readonly
call input('after set readonly 222')
-
In vim, ':verb set readonly?' shows that readonly is misteriously reset.
The output differs between vim6 and vim7.
--- vim7 output --
  1 %1line 1
before set readonly 111
  1 % =  1line 1


readonly=1
after set readonly 222

Note the missing output of ':set readonly?'!!! It prints neither
'readonly' nor 'noreadonly'.
- vim6 output 

  1 %1line 1
before set readonly 111
 before set readonly 111
  1 % =  1line 1
  readonly
  readonly
readonly=1
after set readonly 222
-

Looks like a bug to me.

Yakov



Re: netrw, winxp, and a problem...

2006-05-23 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Hello, Tony!

I've had several folks having a problem with WinXP and netrw.  The 
problems seem to involve temporary files during attempts to use ftp; 
since temporary filenames are produced by tempname(), they're o/s 
dependent.  Admittedly without having searched the source, I figure 
that these temporary files are in fact produced by the C function 
tmpnam() -- hmm, I did just do that search, and tmpnam() is used.  
Since that's a C-library function, these temporary files are 
presumably not only o/s dependent but compiler dependent.


I generally compile my own vim using cygwin+gcc for Windows.  I've 
never seen the problems these folks are having.  So, last night I 
downloaded a copy of your compiled vim (7.0aa, perhaps patched to 213? 
- I don't recall exactly).  I also installed my latest netrw, and used 
it in a dos (cmd.exe)
window, and furthermore used vim -u NONE  (also, set nocp and :so 
..path-to-netrwPlugin.vim).  I was hoping to finally see these 
problems, but I still was able to do remote browsing, readwrite and 
NreadNwrite without any problems.


So, have you had any issues with remote browsing/ftp with netrw?  Do 
you have any suspicions as to what the problem might be?  What 
compiler do you use?


Thank you,
Chip Campbell



Sorry, Dr. Chip, I can't help you there so I'm referring you to the 
vim-dev list:


1. As a rule, I don't edit over ftp, I edit my files locally and, when 
I'm satisfied with the result, I upload them with any available ftp 
client. If I want to make sure that my files look all right, I browse 
them with my favourite web browser (both locally with file: and 
remotely with http: or ftp; )


2. At the moment, my Windows computer is in the Netherlands for repairs 
(which will cost me almost 250 € including postage and handling), I'm on 
Linux at the moment. This also explains why my Vim builds for Windows 
have been temporarily discontinued -- no ETA when (if ever) I'll be 
able to resume them.


About the computer I use: my (now broken-down) Windows computer was a 
laptop with WinXP 5.1.2600 SP2 and the same vim  gvim as those I used 
to distribute; I compiled my latest Vim versions for native-Windows 
using Cygwin gcc and src/Make_cyg.mak. Before that I had used Borland 
BCC32 but it proved inadequate for UTF-8 operation (even if only the 
data, not the filenames, were in UTF-8). My current computer is a 
desktop with Novell-SuSE Linux Professional 9.3 and (currently) gvim 
7.0.017, huge version for GTK+2 and static perl, ruby and TCL, compiled 
with gcc 3.3.5 20050117 (prerelease) (SuSE Linux). I don't feel that 
this vim executable is good enough for public distribution but I will 
readily help other Unix Vimmers to compile their own if they need help: 
it's even easier than on Windows. (For Windows, there is a HowTo on my 
web site.)


Creation and opening of a temporary zero-length file with a unique name 
in a given directory is a well-documented system call on Dos-like 
systems; I wouldn't expect it to be compiler-dependent since the OS 
explicitly provides it. (I'm not familiar with specific Windows calls 
but there is a Dos system call for it since Dos 3 or maybe earlier.)


If it works OK with your latest version of netrw, then maybe the trouble 
is that the version of netrw distributed with Vim 7.0 is _not_ the 
latest one? The 7.0 release version I have here consists of:


$VIMRUNTIME/plugin/netrwPlugin.vim dated Oct. 27, 2005

$VIMRUNTIME/autoload/netrw.vim, version 98 dated May 02, 2006

$VIMRUNTIME/autoload/netrwFileHandlers.vim, version 8 dated May 01, 2006

$VIMRUNTIME/autoload/netrwSettings.vim, version 6 dated Mar 22, 2006.

I got my sources and runtimes over FTP (all 3 archives, unix+extra+lang 
-- so even patches for modules I don't need won't complain -- and 17 
patches). For Vim 7.0aa, I used to download the snapshot zipfiles 
whenever I noticed a new one -- until my laptop ceased to work.



Best regards,
Tony.


Using py commands to evaluate text for balloon commands..

2006-05-23 Thread Mohsin

I am trying to use the  ':py' interface to evaluate text under cursor and show
the result in a balloon text.  I got the python and vim code to work easily,
however I have problem communicating between the two (py and vim):

1. How do I access vim variables in py commands
  (like text under cursor, all the 'let variables', 'set options')?

2. In the Balloon vim function, how do I access py variables.
   Note that I am not  happy with just printing the py result on the
message line -
   I want the py output (ot data structures
   in a vim variable to display it in a balloon.

A transparent clean py/vim interface will allow us to
reuse a large part of python library inside vim scripts.

Any help appreciated.
thanks,
Mohsin