Re: :global problem [bug confirmed?]

2009-07-07 Thread Efraim Yawitz
On Mon, Jul 6, 2009 at 8:07 PM, Andy Wokula  wrote:

> Anyway:
> :insert is an old Vi thing -- as help states, it can also confuse :if
> statements etc, so I'd only use it in very "simple" situations.
>
>
Agreed, but it seemed like it could be useful in those simple situations,
i.e., adding a blank line before or after every occurrence of 'foo'.  (Of
course, I could do it just as well with :pu)

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



syntax highlight problem

2009-07-07 Thread xun chen

Hello everyone!

I have a file which has the following patterns:

1 12  2   3   3   4  4
5 56  6   7   7   8  8
9 9  10 10 11 11 12 12

and I want to write a vim syntax file to highlight the above pattern,
in the following way:

1. each two numbers forms a group. for example, 1 1 is a group, 2 2 is
another group

2. adjacent groups have different colors.

For example, for the first line, 1 1  and 3 3  is red, while 2 2 and 4 4 is blue

I find it hard to accomplish it with simple pattern match, can you
give some suggestions?

Thank you !

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: syntax highlight problem

2009-07-07 Thread Charles Campbell

xun chen wrote:
> Hello everyone!
>
> I have a file which has the following patterns:
>
> 1 12  2   3   3   4  4
> 5 56  6   7   7   8  8
> 9 9  10 10 11 11 12 12
>
> and I want to write a vim syntax file to highlight the above pattern,
> in the following way:
>
> 1. each two numbers forms a group. for example, 1 1 is a group, 2 2 is
> another group
>
> 2. adjacent groups have different colors.
>
> For example, for the first line, 1 1  and 3 3  is red, while 2 2 and 4 4 is 
> blue
>
> I find it hard to accomplish it with simple pattern match, can you
> give some suggestions?
>   
Probably the nextgroup specifier will help  (see  :help syn-nextgroup).

Regards,
Chip Campbell


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: syntax highlight problem

2009-07-07 Thread xun chen

It works, thank you very much!

2009/7/7 Charles Campbell :
>
> xun chen wrote:
>> Hello everyone!
>>
>> I have a file which has the following patterns:
>>
>> 1 1    2  2   3   3   4  4
>> 5 5    6  6   7   7   8  8
>> 9 9  10 10 11 11 12 12
>>
>> and I want to write a vim syntax file to highlight the above pattern,
>> in the following way:
>>
>> 1. each two numbers forms a group. for example, 1 1 is a group, 2 2 is
>> another group
>>
>> 2. adjacent groups have different colors.
>>
>> For example, for the first line, 1 1  and 3 3  is red, while 2 2 and 4 4 is 
>> blue
>>
>> I find it hard to accomplish it with simple pattern match, can you
>> give some suggestions?
>>
> Probably the nextgroup specifier will help  (see  :help syn-nextgroup).
>
> Regards,
> Chip Campbell
>
>
> >
>

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Highlighting matching angle brackets <>

2009-07-07 Thread Benct Philip Jonsson

Tony Mechelynck skrev:
> On 24/06/09 17:32, Benct Philip Jonsson wrote:
>> How can I get vim to highlight matching angle brackets<  >
>> the same way it highlights matching ( ) [ ] { } ?
>>
>> /BP
> 
> for all buffers: in your vimrc
> 
>   set matchpairs+=<:>
> 
> 
> 
> for all files of a given filetype (e.g. html): in (on Linux) 
> ~/.vim/after/ftplugin/html.vim
> 
>   setlocal matchpairs+=<:>
> 
> (replace html in the filename by whatever filetype you want to apply it 
> to. Create the file and/or directories if they don't yet exist.)
> 
> 
> 
> for the current buffer: at the keyoard
> 
>   :setl mps+=<:>
> 
> 
> 
> see :help 'matchpairs'

Can this be done form a syntax definition file?

/BP

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Highlighting matching angle brackets <>

2009-07-07 Thread Ben Fritz



On Jul 7, 12:17 pm, Benct Philip Jonsson  wrote:
> Tony Mechelynck skrev:
> > for all buffers: in your vimrc
>
> >    set matchpairs+=<:>
>
> > for all files of a given filetype (e.g. html): in (on Linux)
> > ~/.vim/after/ftplugin/html.vim
>
> >    setlocal matchpairs+=<:>
>
> > (replace html in the filename by whatever filetype you want to apply it
> > to. Create the file and/or directories if they don't yet exist.)
>
> Can this be done form a syntax definition file?
>

Technically, yes. But why would you want to? The syntax definition
file is meant to provide syntax highlighting rules, nothing more. The
CORRECT place for this is in an ftplugin directory, as Tony suggests.
Is there any reason you don't want to do it this way?
--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Highlighting matching angle brackets <>

2009-07-07 Thread Benct Philip Jonsson

Ben Fritz skrev:
> 
> 
> On Jul 7, 12:17 pm, Benct Philip Jonsson  wrote:
>> Tony Mechelynck skrev:
>>> for all buffers: in your vimrc
>>>set matchpairs+=<:>
>>> for all files of a given filetype (e.g. html): in (on Linux)
>>> ~/.vim/after/ftplugin/html.vim
>>>setlocal matchpairs+=<:>
>>> (replace html in the filename by whatever filetype you want to apply it
>>> to. Create the file and/or directories if they don't yet exist.)
>> Can this be done form a syntax definition file?
>>
> 
> Technically, yes. But why would you want to? The syntax definition
> file is meant to provide syntax highlighting rules, nothing more. The
> CORRECT place for this is in an ftplugin directory, as Tony suggests.
> Is there any reason you don't want to do it this way?

Only to avoid having two files when I can have one.

/BP

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: execute a script only if first line contains more then one word

2009-07-07 Thread Tony Mechelynck

On 04/07/09 09:03, Jeri Raye wrote:
>
> Hi,
>
> I'm using vim in a dos-batch file
> Something like this
> ++
> [...]
> vim myscript.vim memfile.psm
> [...]
> +---+
>
> I want to let vim execute this myscript.vim only when the first line
> of the memfile.psm file contains more then one word.
> Otherwise it should do nothing, because it has already done this time
> the last ime.
> How do I do that?
>
> Rgds
> Jeri


In addition to all what other people have sid, you could also make the 
script itself decide what to do:

-8<-8<- myscript.vim -8<-8<-
if getline(1) !~ '\w\W\+\w'
" there are not even two word characters
" separated by one or more non-word characters
" anywhere in the first line, so we do nothing
finish
endif
"
" do your stuff
"
" save the editfile if modified
update
->8->8->8->8->8->8->8-

vim -S myscript.vim +q memfile.psm


Best regards,
Tony.
-- 
The temperature of Heaven can be rather accurately computed.  Our
authority is Isaiah 30:26, "Moreover, the light of the Moon shall be as
the light of the Sun and the light of the Sun shall be sevenfold, as
the light of seven days."  Thus Heaven receives from the Moon as much
radiation as we do from the Sun, and in addition 7*7 (49) times as much
as the Earth does from the Sun, or 50 times in all.  The light we
receive from the Moon is one 1/10,000 of the light we receive from the
Sun, so we can ignore that ... The radiation falling on Heaven will
heat it to the point where the heat lost by radiation is just equal to
the heat received by radiation, i.e., Heaven loses 50 times as much
heat as the Earth by radiation.  Using the Stefan-Boltzmann law for
radiation, (H/E)^4 = 50, where E is the absolute temperature of the
earth (-300K), gives H as 798K (525C).  The exact temperature of Hell
cannot be computed ... [However] Revelations 21:8 says "But the
fearful, and unbelieving ... shall have their part in the lake which
burneth with fire and brimstone."  A lake of molten brimstone means
that its temperature must be at or below the boiling point, 444.6C.  We
have, then, that Heaven, at 525C is hotter than Hell at 445C.
-- From "Applied Optics" vol. 11, A14, 1972

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



matchstr pattern question...

2009-07-07 Thread Edward Beach

Hi all,

I'm trying to return a string filtered from output generated by an
external application. The string in question is proceeded by "Label:
\t" so here's my attempt:

:echo matchstr(system(""), '\nLabel:\s\+\(\S\+\)\n')

but it returns the entire line; how can I isolate the unknown string
in \( \) ?

Thanks!






--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: File info disappears in vim status line after startup from command line

2009-07-07 Thread Ben

> As you remarked, the message appears, but it gets overwritten. However,
> you can get it back by means of the |:messages| command.

Actually, that doesn't seem to work for this particular message (in
vim or gvim).

> One possible way to make messages "stay longer" at the bottom of the Vim
> screen is to add the following snippet to your vimrc:
> if &cmdheight < 2
>set cmdheight=2
> endif

The message still disappears as soon as vim starts up.

> Try adding "set laststatus=2" to your _vimrc file. This will force display
> of the status line in every window.

I'm already using "set laststatus=2", and it doesn't seem to affect
this problem.

Thanks for all your suggestions. This is a really weird problem...

Ben

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



RE: matchstr pattern question...

2009-07-07 Thread John Beckett

Edward Beach wrote:
> I'm trying to return a string filtered from output generated
> by an external application. The string in question is
> proceeded by "Label:\t" so here's my attempt:
>
> :echo matchstr(system(""), '\nLabel:\s\+\(\S\+\)\n')
>
> but it returns the entire line; how can I isolate the unknown
> string in \( \) ?

Using \zs to start the search is easiest. Assuming the string is
restricted to one line, the following pattern should work:

^Label:\s\+\zs.*

John


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: File info disappears in vim status line after startup from command line

2009-07-07 Thread Jay Heyl

> I'm already using "set laststatus=2", and it doesn't seem to affect
> this problem.

What is the value of 'statusline' when you're in vim? I'm wondering if
it's outputting more than will fit on one line.

  -- Jay

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: matchstr pattern question...

2009-07-07 Thread Edward Beach

On Jul 7, 8:04 pm, "John Beckett"  wrote:
> Edward Beach wrote:
> > I'm trying to return a string filtered from output generated
> > by an external application. The string in question is
> > proceeded by "Label:\t" so here's my attempt:
>
> > :echo matchstr(system(""), '\nLabel:\s\+\(\S\+\)\n')
>
> > but it returns the entire line; how can I isolate the unknown
> > string in \( \) ?
>
> Using \zs to start the search is easiest. Assuming the string is
> restricted to one line, the following pattern should work:
>
>     ^Label:\s\+\zs.*
>
> John

The \zs and the \ze seem to be the trick here.

Thanks!


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Diff changes against original?

2009-07-07 Thread Rich Healey

Hi List,

I've done some googling on this but can't seem to find out if it
exists already.

Basically what I'm looking for is to have vim diff whatever's in my
current buffer against what was in there when I opened it. I'm
assuming this shouldn't be too hard, but I spent a while playing with
the diff function and the docs and got nowhere, aside from bringing up
an extra column on the left where I presume the +'s and -'s would go.

Thanks in advance

Rich Healey
--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



RE: Diff changes against original?

2009-07-07 Thread John Beckett

Rich Healey wrote:
> Basically what I'm looking for is to have vim diff whatever's
> in my current buffer against what was in there when I opened
> it.

I use :DiffOrig which is created by copying the two lines given
in help to your vimrc file. :help :DiffOrig

John


--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: File info disappears in vim status line after startup from command line

2009-07-07 Thread Ben

'statusline' is unset, so I don't think that's it. Another interesting
piece of information is that the welcome display disappears as well
when I run vim without any arguments. If you don't know what I mean by
the welcome display, here is what it should say:

  VIM - Vi IMproved

 version 7.2
   by Bram Moolenaar et al.
 Vim is open source and freely distributable

Help poor children in Uganda!
type  :help iccf   for information

type  :q   to exit
type  :help  orfor on-line help
type  :help version7   for version info

Running in Vi compatible mode
type  :set nocpfor Vim defaults
type  :help cp-default for info on this

Just to reiterate an important point, I'm not running cygwin's vim
(which apparently doesn't have this problem), I'm running the vim that
came with the "Self-installing executable" from . I think it may be a bug in that particular version of
vim, but I'm not sure.

Ben

On Jul 7, 9:08 pm, Jay Heyl  wrote:
> > I'm already using "set laststatus=2", and it doesn't seem to affect
> > this problem.
>
> What is the value of 'statusline' when you're in vim? I'm wondering if
> it's outputting more than will fit on one line.
>
>   -- Jay
--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: File info disappears in vim status line after startup from command line

2009-07-07 Thread Jay Heyl

On Tue, Jul 7, 2009 at 9:02 PM, Ben  wrote:

> Just to reiterate an important point, I'm not running cygwin's vim
> (which apparently doesn't have this problem), I'm running the vim that
> came with the "Self-installing executable" from  download.php>. I think it may be a bug in that particular version of
> vim, but I'm not sure.

I'm using the same version as you on two different computers and have
not seen the problem you're having. I just installed the latest
version on this computer a couple days ago. When I run vim from a
console window I see the standard screen you described.

Maybe you should try reinstalling.

  -- Jay

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: File info disappears in vim status line after startup from command line

2009-07-07 Thread Dennis Benzinger

Am 08.07.2009 06:02, Ben schrieb:
> 'statusline' is unset, so I don't think that's it. Another interesting
> piece of information is that the welcome display disappears as well
> when I run vim without any arguments.
> [...]

Did you set showtabline? I've set it to 2 and that causes the welcome
screen to disappear in the GUI version. The console version still
displays the welcome screen.


Regards,
Dennis Benzinger

--~--~-~--~~~---~--~~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---