Re: Re[2]: vim-display problem?!

2006-12-13 Thread Matthew Winn
On Tue, 12 Dec 2006 17:20:15 +0800, mbbill [EMAIL PROTECTED] wrote:

 Hello Matthew,
 
 Tuesday, December 12, 2006, 5:00:30 PM, you wrote:
 
 ?On Mon, 11 Dec 2006 19:00:27 +0800, [EMAIL PROTECTED] wrote:
 
 ?No, this is not a problem. This is a feature... ;-)
 
 ?It's not even a feature. It's the right way of doing things.
 
 ?The character (or characters, if it's a DOS file) at the end of each
 ?line aren't line _separators_ but line _terminators_. Every line
 ?should end the same way, including the final one. That notepad doesn't
 ?do this is a long-standing bug in notepad, and is just one of the
 ?many, many reasons why nobody should use notepad for anything.
 
 But Emacs does not have the feature either .

Then Emacs is wrong too.

A text file is DEFINED as having lines terminated by a line
termination sequence. On Unix this is a line feed, on DOS it's a
carriage return/line feed pair, and on a Mac it's a carriage return.
But this terminator IS NOT OPTIONAL. It's not All lines must be
terminated by a line terminator except the last one. You can no more
omit the line terminator on the final line than you can on any other
line. If you do omit the final terminator the result is no longer a
text file.

If you really do want to omit the final line terminator then Vim will
allow it if you set binary noendofline, but you should be aware that
many programs that expect to read text files will break when using
such a file as input because they don't contain extra code to deal
with the special case of the last line of the input having no
terminator. (Oracle's SQL*Plus, for example, throws a warning about
truncated input. This is reasonable behaviour because an unterminated
line is exactly what you'd get if the input was truncated.)

-- 
Matthew Winn


RE: I can't make gvim the default application for .txt files in WinXP

2006-12-13 Thread Jeffrey Robertson
 
 Jeffrey Robertson wrote:
 No. That's my problem.  How does gvim tell Windows to make itself an
 option in this list?
 [...]


 A.J.Mechelynck wrote:
 I'm not sure; I think it's something in the registry. Maybe the
install
 program should do it. Have you installed Vim from Steve Hall's
 self-installer 

https://sourceforge.net/project/showfiles.php?group_id=43866package_id=
 39721 
 ? If you haven't, try doing it.


 I've now done this, and it's improved things but not fixed them.

 I get the open with vim option in my right-click menu, and this
 launches
 the file into gvim, so that's good.  But if I simply double click, it
 launches to regular vim.  That is, it opens what looks like a shell
 window and tries to open the file.  It gets confused by spaces in the
 path, so it never actually succeeds in opening the file.

 If it go to Open With... and specify Vi Improved - A Text Editor,
 I get the same results.  How can I make Open With launch to gvim?

 For those joining the discussion late, I'm using Windows XP.

Bill McCarthy wrote:
 Like most of you on Win XP, I build my own Vim and Gvim (for
 Gvim I specify OLE=yes).  From Windows Explorer, when I
 click on a .txt file, Gvim comes up for the file.

 I just tried clicking on a .vim file and received a dialog
 (see ONEofTWO.gif) telling me that Windows cannot open the
 file and asking me to search the web or select the program
 from a list.  I picked select the program and got a second
 dialog.

 That dialog (see TWOofTWO.gif) let me pick Gvim and check
 the box to use Gvim for all .vim files.

 After performing these two tasks, Windows Explorer now opens
 Gvim whenever I click on a .vim file.

 I created a directory name with spaces and put a file in
 there with spaces in its name and ending with .vim - it
 opened fine from explorer.

You say it let you pick Gvim.  I assume you mean you selected
Vi Improved - A Text Editor.  I do the same thing, but
it launches regular vim, not gvim.

If this is not what you meant, please clarify.  If anyone
can explain my problems, please do so.

-- Jeff.


auto complete function of the tab does not work

2006-12-13 Thread Steven Woody

i just installed a 7.0 of vim on windows.  i remembered, in the
previous version, when i need to open a  file using the ':ed' command,
i can press tab after giving first few characters of the file ( or
path ), vim would auto complete the reset.

but after i installed the new vim 7.0. the tab does not work.  can
anyone know why?  i think i might miss some in the .vimrc.

--
woody

then sun rose thinly from the sea and the old man could see the other
boats, low on the water and well in toward the shore, spread out
across the current.


Re: I can't make gvim the default application for .txt files in WinXP

2006-12-13 Thread Bill McCarthy
On Wed 13-Dec-06 9:26am -0600, you wrote:

 Bill McCarthy wrote:
 Like most of you on Win XP, I build my own Vim and Gvim (for
 Gvim I specify OLE=yes).  From Windows Explorer, when I
 click on a .txt file, Gvim comes up for the file.

 I just tried clicking on a .vim file and received a dialog
 (see ONEofTWO.gif) telling me that Windows cannot open the
 file and asking me to search the web or select the program
 from a list.  I picked select the program and got a second
 dialog.

 That dialog (see TWOofTWO.gif) let me pick Gvim and check
 the box to use Gvim for all .vim files.

 After performing these two tasks, Windows Explorer now opens
 Gvim whenever I click on a .vim file.

 I created a directory name with spaces and put a file in
 there with spaces in its name and ending with .vim - it
 opened fine from explorer.

 You say it let you pick Gvim.  I assume you mean you selected
 Vi Improved - A Text Editor.  I do the same thing, but
 it launches regular vim, not gvim.

That's exactly what I mean.

 If this is not what you meant, please clarify.  If anyone
 can explain my problems, please do so.

Looking through my registry tree, Vi Improved - A Text
Editor appears exactly 4 times, 2 each as data in:

  foo\Microsoft\Windows\ShellNoRoam\MUICache

Where foo is either:

  HKEY_CURRENT_USER\Software
  HKEY_USERS\S1-1-5-21- (long Key)

The 2 Values are:

  C:\Vim\vim70\gvim.exe  (where I execute from)
  C:\vim\vim70\src\gvim.exe  (where make puts it)

Searching my registry tree for any key, value or date
containing vim.exe I only find things containing gvim.exe.

Yes, I have and use vim.exe, but there are no references to
it in the registry.

-- 
Best regards,
Bill



Re: vim 7 python completion

2006-12-13 Thread Andrea Spadaccini
Ciao Karl,

  Hello everybody,
  I can't get the python omni-completion to work, can anybody help me?
 
  Are there any special steps to make it work? Can you point me to a
  tutorial?
 
 To cover the basics, is your vim compiled with +python?
 
 vim --version | grep +python

Yes, it is. Maybe my question was a bit too unspecified. :)

Well, if I do

import os
os.C-XC-O

It shows correctly all the members of os. But if I do

self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.win.C-XC-O

It doesn't show anything.
Is it meant to work in this way?

Note that gtk.C-XC-O does work, even if it shows some python
warnings about gtk.TRUE.

TIA,


-- 
[ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ]
[ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.18 ]
[ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ]
[ If it works, don't fix it. ]


signature.asc
Description: PGP signature


Re: vim 7 python completion

2006-12-13 Thread Aaron Griffin

On 12/13/06, Andrea Spadaccini [EMAIL PROTECTED] wrote:

It shows correctly all the members of os. But if I do

self.win = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.win.C-XC-O

It doesn't show anything.
Is it meant to work in this way?


I would recommend upgrading to the latest version from www.vim.org
(here: http://vim.sourceforge.net/scripts/script.php?script_id=1542 )

The following code works fine:
import gtk

class Foo(object):
   def __init__(self):
   self.win = gtk.Window()
   self.win.C-x,C-o


Please note: if you have syntax errors above the code you are working
with the current code may not complete correctly, due to the top-down
nature of python structure.  I have tried to deal with this as
gracefully as possible, but there are cases where it still happens.


Re: vim 7 python completion

2006-12-13 Thread Andrea Spadaccini
Ciao Aaron,

 I would recommend upgrading to the latest version from www.vim.org
 (here: http://vim.sourceforge.net/scripts/script.php?script_id=1542 )
 
 The following code works fine:
 import gtk
 
 class Foo(object):
 def __init__(self):
 self.win = gtk.Window()
 self.win.C-x,C-o
 
 
 Please note: if you have syntax errors above the code you are working
 with the current code may not complete correctly, due to the top-down
 nature of python structure.  I have tried to deal with this as
 gracefully as possible, but there are cases where it still happens.

Thanks a lot, now it works, except for warnings from python:

Errore/i eseguendo function pythoncomplete#Complete:
linea   35:
__main__:157: GtkDeprecationWarning: gtk.FALSE is deprecated, use False
instead
Errore/i eseguendo function pythoncomplete#Complete:
linea   35:
__main__:157: GtkDeprecationWarning: gtk.TRUE is deprecated, use True
instead

Now the code you posted works. :)
Another small question: how can I see the parameters for the current
method? Say that I do

win = gtk.Window(

and I want to know the possible constructors of gtk.Window.. How can I
do that?

Thanks again for the good work. :)

-- 
[ Andrea Spadaccini - a.k.a. Lupino - from Catania - ICQ #: 91528290 ]
[ GPG ID: 5D41ABF0 - key on keyservers - Gentoo GNU / Linux - 2.6.18 ]
[ Linux Registered User 313388 - @: a.spadaccini(at)catania.linux.it ]
[ This is as bad as it can get, but don't bet on it. ]


signature.asc
Description: PGP signature


Re: Cream slow to start up

2006-12-13 Thread Gary Johnson
On 2006-12-03, Yakov Lerner [EMAIL PROTECTED] wrote:

 You can try 'gvim.exe -V20/tmp/log' to identity points of slowness.
 You might need timestamps in the logfile for that. To add timestamps,
 you can try to redirect the logfile to the named pipe and the to
 utility which adds  timestamps.

What utility that adds timestamps?

Regards,
Gary

-- 
Gary Johnson | Agilent Technologies
[EMAIL PROTECTED] | Wireless Division
 | Spokane, Washington, USA


Re: vim70: Dictionaries echo vs echom: Bug?

2006-12-13 Thread Thomas

You can already do quite a lot if you define your own assert function or
command for this.


Ok, I now uploaded a plugin[1] that does this. Maybe somebody finds this 
useful too.


The handling of script local functions is suboptimal though, which is 
why I still think this should be integrated into the interpreter.


Regards,
Thomas.

[1] http://www.vim.org/scripts/script.php?script_id=1730



Re: vim 7 python completion

2006-12-13 Thread Aaron Griffin

On 12/13/06, Andrea Spadaccini [EMAIL PROTECTED] wrote:

Thanks a lot, now it works, except for warnings from python:

Errore/i eseguendo function pythoncomplete#Complete:
linea   35:
__main__:157: GtkDeprecationWarning: gtk.FALSE is deprecated, use False
instead
Errore/i eseguendo function pythoncomplete#Complete:
linea   35:
__main__:157: GtkDeprecationWarning: gtk.TRUE is deprecated, use True
instead


Yeah that one is known, but it's cosmetic really, it doesn't hurt
anything.  I will get rid of that next release.


Another small question: how can I see the parameters for the current
method? Say that I do

win = gtk.Window(

and I want to know the possible constructors of gtk.Window.. How can I
do that?


That mostly works, *except* for the instance you mention
(constructors).  I haven't yet made the mapping from __init__ to the
name of the class.

For example:
  import sys
  sys.C-x,C-o
move to excepthook which will contain the parameters in the popup
window (for convenience).  When you accept that entry, it completes
to:
  sys.excepthook(
Allowing you to enter the parameters themselves.  Hitting C-x,C-o at
this point will complete the parameters as named in the original
popup, leaving you with:
  sys.excepthook(exctype, value, traceback)


Re: Vim Regexes and Mac Newlines

2006-12-13 Thread Brian McKee

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 13-Dec-06, at 4:36 PM, jeffthewookiee wrote:

I'm currently working with vi on OS X machines.
when I run something like this command:
:%s/,/,\n/
I end up with output like this:
  CourtDismissedCount3,^@


Use \r not \n
e.g. :%s/,/,\r/

Similarly you can convert the old CR only Mac files using :%s/\r/\r/g
I'm not sure I can explain why clearly, so I'll just leave it at that...

Brian
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (Darwin)
Comment: Verify this email or encrypt your email for free - see gnupg.org

iD8DBQFFgHUeGnOmb9xIQHQRAszUAJ4pFcmUnTK1o66uv1p+97hyd6DrHgCfSs3y
JFKVdx7L8oTfLePAYNqcth4=
=umrO
-END PGP SIGNATURE-


Making C-] do something different

2006-12-13 Thread Chuck Mason
 
In source code, C-] follows a tags file.  In :help it follows links
(Maybe there's a helptags file?).  But I've created a new temp buffer
from some vim code and I want C-] to do something different for only
this buffer. For instance I have a line that looks like:
 
... sometext somenumber1 someothertext2
 
And if the user presses C-] anywhere on the line I would like to take
somenumber1 and do something with it (follow it by replacing the current
buffer with another file referenced by the number). If the line doesn't
start with ... Then ignore the keypress.  I think I can handle all that
but I want to know if its possible to:
 
either set up a handler for C-] or must I just :map it?
If I must :map it, I can :map so it only affects the current buffer?
 
:bmap?
 
Any help would surely help!
 
Chuck


Re: Cream slow to start up

2006-12-13 Thread Yakov Lerner

On 12/13/06, Gary Johnson [EMAIL PROTECTED] wrote:

On 2006-12-03, Yakov Lerner [EMAIL PROTECTED] wrote:

 You can try 'gvim.exe -V20/tmp/log' to identity points of slowness.
 You might need timestamps in the logfile for that. To add timestamps,
 you can try to redirect the logfile to the named pipe and the to
 utility which adds  timestamps.

What utility that adds timestamps?


I don't know if you can call the [1] and [2] below 'utilities', but
they copy standard input to standard output, adding
the timestamp to microsecond resolution to each line.
[1] is in perl, [2] is in C. Worksforme.

Good luck,
Yakov

[1] - timestamp.pl ---
#!/usr/bin/perl -w
# timestamp.pl  --  copy standard input to standard output, adding
#   timestamps with microsecond resolution.

use POSIX qw(strftime);
use Time::HiRes qw(gettimeofday);

my ($seconds, $microseconds, $formatted_time );

while(STDIN) {
   ($seconds, $microseconds) = gettimeofday;
   $formatted_time = strftime( %H:%M:%S, localtime($seconds));
   printf %s.%06d %s,  $formatted_time, $microseconds, $_;
}

[2] timestamp.c
--
/* timestamp.c  - copy standard input to standard output, adding */
/*timestamps with microsecond resolution */

#include stdio.h
#include time.h
#include sys/time.h

char *timestamp(char *buf, int max, time_t _time) {
   struct tm tm_;

   localtime_r(_time, tm_);
   strftime(buf, max, %H:%M:%S, tm_);
   return buf;
}


int main() {
   char buf[1024];
   char timebuf[30];
   struct timeval tv;

   while(fgets(buf, sizeof(buf), stdin) != NULL) {
   gettimeofday(tv, NULL);
   printf(%s.%06ld %s,
  timestamp(timebuf, sizeof(timebuf), tv.tv_sec),
(long)tv.tv_usec, buf);
   }
   return 0;
}
---


Re: auto complete function of the tab does not work

2006-12-13 Thread A.J.Mechelynck

Steven Woody wrote:

i just installed a 7.0 of vim on windows.  i remembered, in the
previous version, when i need to open a  file using the ':ed' command,
i can press tab after giving first few characters of the file ( or
path ), vim would auto complete the reset.

but after i installed the new vim 7.0. the tab does not work.  can
anyone know why?  i think i might miss some in the .vimrc.



If you have a .vimrc, and Vim finds it, it should set 'nocompatible' at 
startup. This would set up Tab as the wild key. So:


:verbose set cp? wc?

It should answer

nocompatible
  wildchar=Tab

and, if these options were set (e.g. in your vimrc) it should tell you where. 
(If it doesn't tell you where an option was set, it means it either was left 
at its default, or set from the keyboard.)


To see if Vim finds your vimrc, look at the top of the output of the

:scriptnames

command. To see _where_ it looks for a vimrc, use (on [g]vim for Windows)

:echo $HOME
:echo $VIM

Note: Which patchlevel did you install (as shown near the top of the splash 
screen, which can be recalled by using


:intro

)? Bram's latest official build is 7.0.000. More recent builds of Vim for 
Windows (currently up to 7.0.178 which includes all the latest published bug 
fixes) are available from 
https://sourceforge.net/project/showfiles.php?group_id=43866package_id=39721


Note that this is a plain-vanilla Vim and gvim distribution (with up-to-date 
runtime files, but without Cream) even though it is hosted with the Cream project.



Best regards,
Tony.


Re: Making C-] do something different

2006-12-13 Thread A.J.Mechelynck

Chuck Mason wrote:
 
In source code, C-] follows a tags file.  In :help it follows links

(Maybe there's a helptags file?).  But I've created a new temp buffer
from some vim code and I want C-] to do something different for only
this buffer. For instance I have a line that looks like:
 
... sometext somenumber1 someothertext2
 
And if the user presses C-] anywhere on the line I would like to take

somenumber1 and do something with it (follow it by replacing the current
buffer with another file referenced by the number). If the line doesn't
start with ... Then ignore the keypress.  I think I can handle all that
but I want to know if its possible to:
 
either set up a handler for C-] or must I just :map it?

If I must :map it, I can :map so it only affects the current buffer?
 
:bmap?
 
Any help would surely help!
 
Chuck





Yes there is a tags file for help, $VIMRUNTIME/doc/tags (and similarly 
$VIM/vimfiles/doc/tags and/or [on Windows] $HOME/vimfiles/doc/tags if you have 
installed nonstandard help files locally).


Here is (untested) an example of how to map Ctrl-] for only one particular file:

function s:ControlBracketHandler()
...
endfunction
autocmd BufRead C:/path/to/filename.ext
\ map buffer C-] :call SIDControlBracketHandler()CR


see :help :map-buffer


Best regards,
Tony.


Re: auto complete function of the tab does not work

2006-12-13 Thread A.J.Mechelynck

Steven Woody wrote:

On 12/14/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Steven Woody wrote:
 i just installed a 7.0 of vim on windows.  i remembered, in the
 previous version, when i need to open a  file using the ':ed' command,
 i can press tab after giving first few characters of the file ( or
 path ), vim would auto complete the reset.

 but after i installed the new vim 7.0. the tab does not work.  can
 anyone know why?  i think i might miss some in the .vimrc.


If you have a .vimrc, and Vim finds it, it should set 'nocompatible' at
startup. This would set up Tab as the wild key. So:

:verbose set cp? wc?


i got E488: Trainning characters: cp?wc?



Make sure you have a space between the first question mark and the rest.


Best regards,
Tony.


Re: auto complete function of the tab does not work

2006-12-13 Thread A.J.Mechelynck

Steven Woody wrote:

On 12/14/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Steven Woody wrote:
 On 12/14/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:
 Steven Woody wrote:
  i just installed a 7.0 of vim on windows.  i remembered, in the
  previous version, when i need to open a  file using the ':ed' 
command,

  i can press tab after giving first few characters of the file ( or
  path ), vim would auto complete the reset.
 
  but after i installed the new vim 7.0. the tab does not work.  can
  anyone know why?  i think i might miss some in the .vimrc.
 

 If you have a .vimrc, and Vim finds it, it should set 
'nocompatible' at

 startup. This would set up Tab as the wild key. So:

 :verbose set cp? wc?

 i got E488: Trainning characters: cp?wc?


Make sure you have a space between the first question mark and the rest.




after inserted the space, the command executed succesfully.  but the
tab is still not functionable. when i press 'tab', it only pops up
'^I' in the command edit line :-(




Sure, that command doesn't change anything, it just asks Vim for info. What is 
the reply?


And, please, use Reply to List (if your mailer offers it) or Reply to All 
but not Reply to Sender because the latter won't show your reply to all 
other users on the list. (I'm just a plain user like you, not a professional 
field-support emploee: Vim doesn't have any of those.)



Best regards,
Tony.