Re: strange message when applying a mapping (Vim70g01)

2006-05-03 Thread Bram Moolenaar

Georg Dahn wrote:

 In my vimrc file I have the following mapping:
 
 noremap silent F11 :C-R=matchstr(fo, a)==a ? set fo-=a : 
 set fo+=aCRCR
 
 In the latest build Vim70g01 I get in Normal mode the following message 
 if I press F11:
 
 Type  :quitEnter  to exit Vim
 
 In Vim 70g I don't get this message and I don't see any reason for ir.
 
 I am running gVim 7.0g01 on Windows XP.

I don't see it and I can't think of a recent change that would cause
this.  I suspect something else that changed must cause this.

-- 
For society, it's probably a good thing that engineers value function over
appearance.  For example, you wouldn't want engineers to build nuclear power
plants that only _look_ like they would keep all the radiation inside.
(Scott Adams - The Dilbert principle)

 /// 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: minor thing in spellfile conversion (7.0g)

2006-05-03 Thread Bram Moolenaar

Kyle Wheeler wrote:

 Using vim 7.0g, when I try to run :mkspell on a spell file of mine 
 (containing utf-8 characters), I get this:
 
 Reading word file spellfile.utf-8.add ...
 Conversion in spellfile.utf-8.add not supported: from tf-8 to utf-8
 Compressing word tree...
 Compressed 777 of 1971 nodes; 1194 (60%) remaining
 Compressed 30 of 108 nodes; 78 (72%) remaining
 Writing spell file spellfile.utf-8.add.spl ...
 Done!
 Estimated runtime memory use: 6360 bytes
 
 The command succeeds, and as far as I can tell the spellfile is 
 correct, but the error at the top about converting from tf-8 to utf-8 
 is worrisome. If it helps, the first line of my spellfile is 
 “/encoding=utf-8”. Anyone know if maybe I’m doing something wrong?

This is a bug.  When skipping over /encoding= it skips one character
too much.  I'll fix it.

Oh, your next message has the patch already.  Thanks!

-- 
hundred-and-one symptoms of being an internet addict:
5. You find yourself brainstorming for new subjects to search.

 /// 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: Omni-completion problems

2006-05-03 Thread Aaron Griffin
My 2 cents - I highly dislike the C-p/C-n use omnicompletion thing. 
When I hit C-p or C-n I *know* that I am using standard vim

completion, and that's what I want.  Just like C-x,C-f or C-x,C-o.  I
know exactly what I'm trying to complete.

The argument I don't want to think about the completion I want is
moot.  If you're writing something that requires omni-completion, you
probably should be thinking.


Re: vimgrep with ':hide' command modifier does not keep buffers loaded?

2006-05-03 Thread Yakov Lerner

On 5/2/06, John Player [EMAIL PROTECTED] wrote:

 I did , too. File is in disk cache in both cases. In 1st case,
 file opens imemdiately. In 2nd case, it takes time. I suspect
 that for unlisted+hidden files, vim keeps swapfile open which is
 what helps him open file immediately without using RAM.
 Using :!ls I see that indeed in 1st case, .swp file exists,
 and in 2nd case, there is no swapfile.

You may be right -- I don't use the swapfile so I don't see
the difference.  That still means that the help is incorrect.


Without connection to the original topic, I wonder
what are reasons for you not using swapfile ?

Yakov


^M problems with migrating VIM from WinXP to Linux

2006-05-03 Thread Eric Leenman

Hi,

I'm using VIM on WinXP and want to move my files now also to Linux.
I copied the files and VIM reads in my .vimrc.
It comes up with a bounce of errors all related to ^M.

When I open this file on my WinXP I don't see them.
What do I need to do to make these ^M also visible on my WinXP machine?
Or do I need to change the files in a different way?

I want to remove the ^M on my WinXP machine and then copy them over again to 
my linux machine.


Thanks
Eric

_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/




Re: one input to many lines

2006-05-03 Thread Tim Chase

Thanks a lot Tim. You is right about what I meant. To make it more clear,
here are the rows.
.
.
i1 0 9 180   /*this is the 420 line number*/
.
i2 0 17.1 220   /*430*/
.
i3 + 7.875 365 /*710*/

the numbers in question are 180, 220 and 365.
No tested your code yet. I'll give a try tomorrow.

[cut some of the bottom posting]

where [action] is

s/\%4c\d\+/=submatch(0)+10/e


It looks like your columns are delimiter-based (using 
whitespace), rather than columns based on physical/character 
position.  That would change the previously-mentioned 
[action] so that it becomes something like


s/^\(\S\+\s\+\)\{3\}\zs\(\d\+\)/=submatch(2)+10/e

You might have to tweak it a bit, but it *should* do the trick.

If you want some help deciphering it, it's easy enough to 
explain any of the process, if you'd like.


-tim

PS:  Your reply came only to me.  It's best to Reply to 
All in your mailer so that the whole list gets copied in on 
the reply.  That way, you access the collective brain which 
is a whole lot smarter than my solitary brain.  You also 
have their time.  Fortunately, I check my email fairly 
regularly, but in the event I was on holiday, you'd be 
waiting for just me rather than getting a reply from anybody 
on the list that had an answer.








Re: ^M problems with migrating VIM from WinXP to Linux

2006-05-03 Thread Tim Chase

I want to remove the ^M on my WinXP machine and then copy
them over again to my linux machine.


This is the ever-popular line-break-delimiter problem.

If you do

:set ff?

Vim will likely currently come back with dos.

You should be able to solve it by executing

:set ff=unix

on either box, and then writing the file.  This file should 
be recognized on both sides of matters.


-tim






Re: ^M problems with migrating VIM from WinXP to Linux

2006-05-03 Thread John Love-Jensen
Hi Eric,

Do this to see which line-endings the buffer is associated with...

:set ff?

Do this to change them...

:set ff=unix
:wq

For info...

:help 'fileformat

On WinXP, I strictly use the unix (0A) line endings, I do not use mac (0D)
or dos (0D 0A).  I wish Vim internally supported nul (00) line endings, but
alas.  Note: if you transfer files to/fro Unix and Windows with FTP, you can
transfer text files as ASCII to do the end-of-line conversion for you.

Note, mac (0D) line endings are found on Apple DOS, ProDOS, GS/OS, and
System 9 and earlier OS's.  OS X is unix (0A) line endings, mostly, these
days.

Note, dos (0D 0A) line endings are CP/M, QDOS, PC-DOS, MS-DOS, DR-DOS,
Win16, Win32, WinNT (3.1, 3.5, 4.0, 2000, XP), WinNT64, OS/2 1.x (16-bit),
OS/2 2.x (32-bit) and later.  (There were some feeble, short-lived, unviable
attempts by IBM to make OS/2 use unix line endings.  Likewise, there were
some feeble, short-lived, unviable attempts by Microsoft to make WinNT use
unix line endings.)

Note, unix (0A) line endings are on Unix and Unix-like OS's (including OS
X), Amiga OS, and are an option as default for the Cygwin environment on
Windows.

Vim doesn't internally support backwards lf+cr (0A 0D), which was sometime
seen back in the 70's on teletype machines and preferentially used by some
printers and as the communication protocol by some dial-up BBS's.  I don't
know of any OS that utilizes lf+cr as the convention for end-of-line marker.

Vim doesn't internally support nel (85) next line, from ECMA-048 (approved
as ISO 6429).  I don't know of anyone that uses nel for encoding
end-of-line.  Even the Amiga OS, which supported nel (85), did not use it
for end-of-line in files, and only rarely seen as an operational control
character in certain data streams.  Besides, since Windows code pages have
usurped this (80 - 9F) range of encoding code points, and MacRoman puts
glyphs there too, I don't expect there will be much of a revival for them.

HTH,
--Eljay



Re: ^M problems with migrating VIM from WinXP to Linux

2006-05-03 Thread Tim Chase

I wish Vim internally supported nul (00) line endings,
but alas.


You might be able to set up a before/after filter, much like 
the gzip example (:help gzip-example), using tr, of the form


tr '\000\012' '\012\000'

This will swap all NUL characters in the file and 0x0A 
(octal 012) characters.  Vim can then interpret the file 
normally with the NUL characters as the line-breaks.  Then, 
before writing the file, pipe it through the same tr 
command to reswap your null bytes and your place-holder 
character.


You don't have to use a LF/0x0A as your alternate byte...as 
a matter of fact, it might be best to use a character that 
doesn't occur anywhere in your source file, and that Vim 
isn't likely to have conniptions about.  I'd adjust accordingly.


Just a few ideas for how to make Vim use NUL characters as 
line delimiters :)


-tim







Re: ^M problems with migrating VIM from WinXP to Linux + VIMs difference prblem

2006-05-03 Thread Eric Leenman

Thank you all I got it working.

One thing that seems to be broken is the VIM tip
On http://www.vim.org/tips/tip.php?tip_id=892

fun! InitBex()
let myvar = strftime((%y%m%d)[%Hh%M])
let myvar = set backupext=_. myvar
execute myvar
echo myvar
endfun
map ESC :call InitBex()CR

On my WinXP I use gvim 6.3
On my Linux I use vim 6.3.86

What do I need to change so that this works on both versions?

Best Regards,
Eric

_
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement




Re: regex @vim, negating a group

2006-05-03 Thread Daniel Einspanjer

On Tue, May 02, 2006 at 08:27:49PM +0300, Yakov Lerner wrote:

BTW, can anyone explain why this pattern does *not*
work, does not match words that do not end with 'ion' :
   /\i\+\(ion\)[EMAIL PROTECTED]/
I thought this pattern would match words not ending with
'ion'. But it matches all words, including words ending
with 'ion'. Why ?


The docs in :help /[EMAIL PROTECTED] answer this query pretty well.  The issue is that 
there are many places where a pattern doesn't match.

take the word zion.
\i\+ can match either z or zi or zio or zion.  It is greedy so it will first 
attempt to match zion.
Now, the \(ion\)[EMAIL PROTECTED] is applied.  The current match position is just before 
the EOL and EOL != ion so the entire pattern matches.


On Tue, May 02, 2006 at 02:03:47PM -0400, James Vega wrote:

   /\i\+\(ion\)[EMAIL PROTECTED]
This one is trying to get past the match position limitation in the wrong 
way.. any time you try to describe what should be in the place of a zero 
width match you must be extremely careful that you are only dealing with 
terms that are important to you.  In this case, the \i\{3\} isn't important 
to you and it causes problems.  This isn't a steadfast rule, but it can be a 
useful guideline.



Matthew Winn [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]

That won't match words of fewer than four characters.  To match all
words that don't end in ion it's better to do:

/\\(\i*\(ion\)[EMAIL PROTECTED]|\i\i\=\)\
   ^^^
This one attempts to correct the problems of the \i\{3\} by adding even more 
inspection of tokens that aren't important to you. This is an example that 
proves why it is bad to try to dictate what exists in the place of a zero 
width match. :)


On Tue, May 02, 2006 at 08:27:49PM +0300, Yakov Lerner wrote:

Pattern
   /\i\+\(ion\)\@!\/
matches words that do not end with 'ion'


This one is the best way of solving the presented problem (words not ending 
in 'ion'). To break it down:

   1. Match as many identifier chars as possible ( \i\+ )
   2. Make sure the last three characters behind the current match point 
are not 'ion' ( \(ion\)\@! )

   3. Make sure the current match point is a word boundary ( \ )
This regex will consume the whole word then back up on any words that do 
contain ion but fail to match because of the \ requirement. 





console vim on win - double CR's

2006-05-03 Thread Hugo Ahlenius
Hi,

I have vim 6.4 (non cygwin) installed on a couple of Win2k3 servers, running
the built in MS telnet server.

When I connect using the built-in WinXP/Win2k telnet client I am able to get
color in vim console sessions without any problems, and everything seems to
be working very well.

Except for one (minor) annoyance -- every time I press enter in insert mode
I get two line-fees (as if it was pressed twice). This also happens when I
start up vim without my _vimrc customizations. It does not happen, though,
if I open a remote desktop console to the server and run vim in that
session.

I'd love to compare and test if this appears in putty (to identy if it is
the telnet client that is the problem), but I can't get vim to run through a
putty session... :(

Any tips?


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




Re: regex @vim, negating a group

2006-05-03 Thread Yakov Lerner

Daniel Einspanjer [EMAIL PROTECTED] wrote:

The docs in :help /[EMAIL PROTECTED] answer this query pretty well.


Reminds me.  Professor gives a lecture in mathematics.
At some point he says From this it obviously follows .. and writes
long something that does not resemble anything he's written before.
Then he falls silent, looks at this formula and runs out of the room.
Half an hour passes. He returns and  says All right. I checked it.
It's really obvious.

Daniel Einspanjer [EMAIL PROTECTED] wrote:

Yakov Lerner wrote:
 Pattern
/\i\+\(ion\)\@!\/
 matches words that do not end with 'ion'

This one is the best way of solving the presented problem (words not ending
in 'ion').


Mmmm, good. Where do I claim the prize ?

Yakov


Re: console vim on win - double CR's

2006-05-03 Thread Yakov Lerner

On 5/3/06, Hugo Ahlenius [EMAIL PROTECTED] wrote:

Hi,

I have vim 6.4 (non cygwin) installed on a couple of Win2k3 servers, running
the built in MS telnet server.

When I connect using the built-in WinXP/Win2k telnet client I am able to get
color in vim console sessions without any problems, and everything seems to
be working very well.

Except for one (minor) annoyance -- every time I press enter in insert mode
I get two line-fees (as if it was pressed twice). This also happens when I
start up vim without my _vimrc customizations. It does not happen, though,
if I open a remote desktop console to the server and run vim in that
session.

I'd love to compare and test if this appears in putty (to identy if it is
the telnet client that is the problem), but I can't get vim to run through a
putty session... :(

Any tips?


Can be caused by some options of telnet client, especially
option 'crlf'.  Try to toggle the option to see it if makes difference:

   telnet  HOST
   ^]  Press Ctrl-] to client command mode
unset crlf
   Enter  Press Enter

More info at 'man telnet'

Yakov


RE: Highlighting lines of text

2006-05-03 Thread Max Dyckhoff
Hah, I actually run across that in my searches, but was put off by the
description. Upon further reading it appears to be exactly what I want.

Thanks!

Max

-Original Message-
From: Gerald Lai [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 03, 2006 4:44 PM
To: Max Dyckhoff
Cc: vim@vim.org
Subject: Re: Highlighting lines of text

On Wed, 3 May 2006, Max Dyckhoff wrote:

 I've Googled and Yahooed my way around the web trying to find the
answer
 to this to no avail, so I thought I would query this potential gold
mine
 of information.

 I would really love a way to be able to select a line, or a range of
 lines, press a button and have them highlighted in a different manner,
 perhaps with a yellow bg instead of black. I'm not new to scripting
vim
 by any means, but I really can't figure out a way to do this. I
suspect
 it is going to require a per-buffer variable to store the line numbers
 that I want highlighted, and then some :highlight command, but I can't
 for the life of me work it out. Or is there some way to make it
 highlight marked lines differently, I imagine that would work too.
[snip]

Max,

Give mark.vim a try:

   http://www.vim.org/scripts/script.php?script_id=1238

HTH.
--
Gerald


Re: deleting repeated blocks of text

2006-05-03 Thread Gerald Lai

On Wed, 3 May 2006, Gerald Lai wrote:


On Wed, 3 May 2006, Vim Visual wrote:


Hi,

this is the continuation of a post... The point is that I have a file
where blocks of text appear sometimes once, sometimes twice or even
three times etc...
I would like to find out how to delete the blocks that are repeated,
so that in the end I am left with a text file in which the blocks
appear only ONCE

The text file looks like this, for instance:(please note that there
are NOT blank lines in my text file, it's just after pasting here)

What a call a block is a paragraph starting with a bra
href=http://xxx.lanl.gov/...; until the next bra
href=http://xxx.lanl.gov/...;

[snip]

One possibility of what you're asking for is a uniq of custom defined
blocks. Blocks that are repeated in a row will be reduced to a unique
one block.

The other possibility, where getting rid of duplicate blocks that are
sandwiched between one another, is extremely complicated, and would
require storage for every unique block in the text for comparison. Some
might argue that if you did manage to store every unique block, then you
would have done the work of uniq-ing already.

For blocks uniq, the following commands should perform what you want.

First, place block delimiters so the start of a block != end of another
block. I chose #end# on its own line as the end delimiter.

 :g/xxx\.lanl\.gov\|!-- acaba --/put!='#end#'

Then the uniq command is a simple

 :g/^\(.*www\.lanl\.gov\_.\{-}\_^#end#\)\n\1$/.,/^#end#$/d A

[snip]

Another way of doing this is:

  :%s/^\(.*www\.lanl\.gov\_.\{-}\_^#end#\)\%(\n\1\)\+$/\1


After that, you just need to clean up the end delimiters:

 :%s/^#end#$//


It would probably be better to do

  :g/^#end#$/d

HTH :)
--
Gerald



Vim7: Jumping to a particular line in the filename under cursor

2006-05-03 Thread Yegappan Lakshmanan

Hi all,

Check out the gF command in Vim7. This normal-mode command
jumps to the filename under cursor and if a line number follows the
file name, positions the cursor on that line.

For example, consider the following lines:

  /path/to/file:10
  /path/to/file @ 20
  /path/to/file (30)
  /path/to/file 40

If you use the gF command, when the cursor is on a character in one
of the above file names, then the /path/to/file will be edited and the
cursor will be positioned at the line number following the file name.

You can also use the CTRL-W_F command to edit the file in a new
window and jump to the line number following the file name.
Similarly, the CTRL-W_gF command to open the file in a new tab.

- Yegappan


Re: regex @vim, negating a group

2006-05-03 Thread Yakov Lerner

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

Pattern
   /\i\+\(ion\)\@!\/
matches words that do not end with 'ion'


Two more ways to match words not ending with 'ion':

2)  This pattern also matches words not not ending with 'ion':

   \\(\w*ion\\)[EMAIL PROTECTED]

3) The 'old' way. That's what I'd use before the \@ stuff to match
words not ending with 'ion':

   /\\(\w*[^n]\|\w*[^o]n\|\w*[^i]on\)\

Tricky

Yakov