Re: vim 7 python completion

2006-12-12 Thread Karl Guertin

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

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"


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

2006-12-12 Thread Bill McCarthy
On Tue 12-Dec-06 4:43pm -0600, Jeffrey Robertson wrote:

> 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=43866&package_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.

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.

[Without the attached GIFs]

-- 
Best regards,
Bill



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

2006-12-12 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=43866&package_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.

Thanks for all the help so far...

-- Jeff ([EMAIL PROTECTED])


vim 7 python completion

2006-12-12 Thread Andrea Spadaccini
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?

Thanks in advance,

-- 
[ 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 ]
[  Make everything as simple as possible, but not simpler.   ]


signature.asc
Description: PGP signature


Re: regexp substitution problem

2006-12-12 Thread Bill McCarthy
On Tue 12-Dec-06 2:26pm -0600, Bram Kuijper wrote:

> I am quite new to vim and just started to use regular expressions to
> replace certain amounts of text. For example, in the following piece of
> text I would like to keep only the first column and delete the rest:
>
>   optimal_value_viability   | real| default 0.0
>   number_generations| integer | default 0
>   output_per_number_generations | integer | default 0
>   number_trait_loci | integer | default 0
>   number_pref_loci  | integer | default 0
>   number_viability_loci | integer | default 0
>   random_seed   | bigint  | default 0
>
> so I execute the following regexp as a vim command:
>
> :%s/\s+\|.*//
>
> however, to my surprise all text is gone, instead of just anything
> besides the first column.
>
> if I carry out exactly the same regular expression in a Perl script, it
> works: I keep the text in the first column. Same for doing this regexp
> in jEdit. What's different in vim / What am I doing wrong here?

You're very close.  Your '+' needs to be escaped (or it is
treated as the '+' character).  Your '\|' shouldn't be
escaped (or it is treated like a logical 'OR').

:%s/\s\+|.*//

Alternately, you could make the regex very magic (with '\v')
and it will work, in this case, just like Perl.

:%s/\v\s+\|.*//

-- 
Best regards,
Bill



RE: vim-display problem?!

2006-12-12 Thread Dan Mergens
I've always held the belief that emacs was devised to maintain a steady flow of 
carpul tunnel syndrome patients. 
 
Of course there is always the option of an "all visual" editor, like Microsoft 
Visual Studio which encourages the minimal typing in the hopes of global 
assimilation. 
 
Dan Mergens
Senior Software Engineer
Raytheon/PRA
619.596.8058



From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
Sent: Tue 12/12/2006 12:51 PM
To: mbbill
Cc: Matthew Winn; vim@vim.org
Subject: Re: vim-display problem?!



mbbill 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 .
>

If it doesn't, then "it's a long-standing bug in Emacs, and just one more
reason why nobody should use Emacs for anything". So what else is new?


Best regards,
Tony.




Re: regexp substitution problem

2006-12-12 Thread zzapper
zzapper <[EMAIL PROTECTED]> wrote in news:Xns9897D2B986F7zzappergmailcom@
80.91.229.5:

>:%s/\s\+|.*
> 
> You need to backslash the +, but not the |
> 
> or simpler but possibly morally inferior
> 
:%s/\s*|.*
 
-- 
zzapper
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips



Re: vim-display problem?!

2006-12-12 Thread A.J.Mechelynck

mbbill 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 .



If it doesn't, then "it's a long-standing bug in Emacs, and just one more 
reason why nobody should use Emacs for anything". So what else is new?



Best regards,
Tony.


Re: regexp substitution problem

2006-12-12 Thread Charles E Campbell Jr

Bram Kuijper wrote:

I am quite new to vim and just started to use regular expressions to 
replace certain amounts of text. For example, in the following piece 
of text I ...



Whoops!  Looks like I removed the first column, but you wanted to keep 
just the first column.


Try

:%s/\s*|.*$//

which matches any amount of whitespace followed by a bar, followed by 
anything to end-of-line.  Replace with nothing.


Regards,
Chip Campbell






Re: regexp substitution problem

2006-12-12 Thread Charles E Campbell Jr

Bram Kuijper wrote:

I am quite new to vim and just started to use regular expressions to 
replace certain amounts of text. For example, in the following piece 
of text I would like to keep only the first column and delete the rest:


 optimal_value_viability   | real| default 0.0
 number_generations| integer | default 0
 output_per_number_generations | integer | default 0
 number_trait_loci | integer | default 0
 number_pref_loci  | integer | default 0
 number_viability_loci | integer | default 0
 random_seed   | bigint  | default 0

so I execute the following regexp as a vim command:

:%s/\s+\|.*//

however, to my surprise all text is gone, instead of just anything 
besides the first column.


(comments about perl deleted)

Let's look at what you've asked vim to do:

:%  <-- range, all lines
 s/   <-- substitute
   \s+  <-- a single whitespace character followed by a + sign
   \|  <--  OR (as in   regexp OR regexp  )
  .*  <--  anything
 //  <--  replace with nothing

So, your first pattern \s+ , doesn't match any line at all, and hence is 
wasted effort.


Your second pattern, .* , says to greedily match any character, and so 
matches the entirety of all lines.


The "replace with nothing" seems to be understood.

OK, presumably this isn't what you had in mind!  Vim doesn't accept Perl 
regexps, it accepts Vim regexps.

I suggest reading   :help regexp  .

So, let's construct a pattern that will do what I think you want:

:%s/^\s*.\{-}|\s*//

which says:  any amount of whitespaces, followed by a minimal amount of 
anything up to a |, followed by any amount of whitespace, replace it 
with nothing.  Since whitespace is clearly matched by ".", in fact


:%s/^.\{-}|\s*//

will also do the trick.

That said; if I were doing this, I'd use visual-blocks:

move cursor to upper left hand corner
ctrl-v
move cursor to bottom right hand corner of region to be removed
x

Regards,
Chip Campbell







Re: regexp substitution problem

2006-12-12 Thread zzapper
Bram Kuijper <[EMAIL PROTECTED]> wrote in news:457F106C.6060207
@rug.nl:

> Hi,
> 
> I am quite new to vim and just started to use regular expressions to 
> replace certain amounts of text. For example, in the following piece of 
> text I would like to keep only the first column and delete the rest:
> 
>   optimal_value_viability   | real| default 0.0
>   number_generations| integer | default 0
>   output_per_number_generations | integer | default 0
>   number_trait_loci | integer | default 0
>   number_pref_loci  | integer | default 0
>   number_viability_loci | integer | default 0
>   random_seed   | bigint  | default 0
> 
> so I execute the following regexp as a vim command:
> 
>:%s/\s+\|.*//
> 
> 
:%s/\s\+|.*

You need to backslash the +, but not the |

or simpler

:%s/\s\+|.*

With your name you should become very good at Vim!



-- 
zzapper
http://successtheory.com/tips/ Vim, Zsh, MySQL Tips



regexp substitution problem

2006-12-12 Thread Bram Kuijper

Hi,

I am quite new to vim and just started to use regular expressions to 
replace certain amounts of text. For example, in the following piece of 
text I would like to keep only the first column and delete the rest:


 optimal_value_viability   | real| default 0.0
 number_generations| integer | default 0
 output_per_number_generations | integer | default 0
 number_trait_loci | integer | default 0
 number_pref_loci  | integer | default 0
 number_viability_loci | integer | default 0
 random_seed   | bigint  | default 0

so I execute the following regexp as a vim command:

:%s/\s+\|.*//

however, to my surprise all text is gone, instead of just anything 
besides the first column.


if I carry out exactly the same regular expression in a Perl script, it 
works: I keep the text in the first column. Same for doing this regexp 
in jEdit. What's different in vim / What am I doing wrong here?


any help is appreciated,

Bram





Re: vim70: Dictionaries & echo vs echom: Bug?

2006-12-12 Thread Bram Moolenaar

Sanoblast wrote:

> >>> Looking back, now that Vim script has become much more complex, a bit
> >>> more type checking would be good.
> >>>   
> >> A valid point. Mabye this could be done by an assert command/function 
> >> that checks its arguments or does nothing depending on an option (maybe 
> >> 'debug')/flag/variable?
> >> 
> >
> > Problem is the syntax of type declarations.  Would require function
> > prototypes, for example.  Vim script follows Python here: no type
> > declarations.
>
> I'm not sure if I can follow you here. I was thinking of something 
> really simple in the line of:
> 
> fun! Foo(a, b)
> assert a:a >= 0 && a:a <= 10
> assert type(a:b) == 0, "Not a string"
> return a:a + a:b
> endf
> 
> assert Foo(1, 2) == 3
> assert Foo(1, -2) == -1
> 
> and maybe
> 
> assert_raise Foo(1, "bla")
> 
> Similar commands are used in some other languages. The idea is that vim 
> scripts could run in some sort of debug mode where these assertions are 
> evaluated and in "normal" mode where they are ignored/stripped at 
> read/compile-time (if this is possible with the current interpreter) and 
> thus don't result in a speed penalty. That's probably not quite what you 
> meant but I think it would help (IMHO sufficiently) when writing 
> slightly non-trivial functions.

This would help a little bit, but not much.  At least it requires
executing the lines of code in various ways to detect the problems.  You
won't get any warnings when a script is loaded and functions are
defined without being executed.

You can already do quite a lot if you define your own assert function or
command for this.  The eval() function helps a lot here.  To avoid the
overhead you can comment-out the lines.  Charles Campbell does this in
his scripts.

-- 
Biting someone with your natural teeth is "simple assault," while biting
someone with your false teeth is "aggravated assault."
[real standing law in Louisana, United States of America]

 /// 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///


Re: I wonder if can I display the current date time at the bottom of Vim ?

2006-12-12 Thread Yakov Lerner

On 12/12/06, KLEIN Stéphane <[EMAIL PROTECTED]> wrote:

I wonder if can I display the current date time at the bottom of Vim
like in emacs status bar ?


On one hand, you can use strftime() inside %{...} in statusline
 :he 'statusline'
 :he strftime
 :helpgrep %{
and 'set laststatus=2'

On the other hand, I'm not sure how to make time updated
when you don't touch the keyboard for a long time. Can't you
buy a cheap digital desk clock anyway ? I can sell you one btw.

Yakov


Re[2]: vim-display problem?!

2006-12-12 Thread mbbill
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 .

-- 
Best regards,
 mbbillmailto:[EMAIL PROTECTED]



I wonder if can I display the current date time at the bottom of Vim ?

2006-12-12 Thread KLEIN Stéphane

Hi,

I wonder if can I display the current date time at the bottom of Vim
like in emacs status bar ?

Thanks for your help,
Stephane


Re: vim-display problem?!

2006-12-12 Thread Yakov Lerner

On 12/11/06, dong wang <[EMAIL PROTECTED]> wrote:

I found a problem ( sorry , here i just call it problem ) when i edit
a csv file.
That is the vim don't display the last line as a seperate line when i
do " set nu"

For exmaple ,
use Notepad.exe (or some other Editor) to create a file  , and do input :

abc
abc

save the  file.

After that , use vim to open the file and "set nu"
Well , i found that , the vim just displays the line number as this

 1 abc
 2 abc

which i thought it should be :

 1 abc
 2 abc
 3


Your reasoning is wrong. For example, if you think that
one-liner file line of text should consists of 'abc' and no \n, then
you cannot distinguish between file consisting of one empty
line vs empty file. Line of text always ends with \n,
that's how lines of text were created and happily lived ever after.

Yakov


Re: vim-display problem?!

2006-12-12 Thread Matthew Winn
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.

-- 
Matthew Winn