Re: regex @vim, negating a group

2006-05-04 Thread Matthew Winn
On Thu, May 04, 2006 at 08:56:41AM +0300, Yakov Lerner wrote:
> 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\)\>

Not much fun if you want to match all words not ending in "ification". :-)
This is where negative lookahead and negative lookbehind really come into
their own.

-- 
Matthew Winn ([EMAIL PROTECTED])


Re: trap changes in 'modified' state

2006-05-04 Thread Eric Arnold

I'm not sure if it's what you're looking for, but the tabline is
triggered on the 'modified' setting.

Just for the helluvit, I added pre- and post-proc function hooks to
TabLineSet.vim.

You can also add a check inside a CursorMoved[I} autocommand, which
might have a little more overhead, but maybe not noticeable.

In either case, my idea would be to set up a status dict:


let s:modified_table = {}
function! Tst_postproc_modified( tabline )
let updated = []
for bufnr in range( 1, bufnr("$") )
if !bufexists( bufnr ) | continue | endif
let modded = getbufvar( bufnr, '&modified' )
if !has_key( s:modified_table, bufnr )
let s:modified_table[ bufnr ] = modded
endif
if s:modified_table[ bufnr ] != modded
let s:modified_table[ bufnr ] = modded
call add( updated, [ bufnr, modded ] )
endif
endfor

for elem in updated
let bufnr = elem[0]
let modded = elem[1]
echomsg 'bufnr#' . bufnr . ', ' . bufname( bufnr ) . ' is now ' 
. (
modded ? '' : 'no' ) . 'modified'
endfor

" call somefunction( updated )

endfunction



On 5/3/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:

I want to trap changes in the value of 'modified'  (execute
my  commands when first change is done to the
buffer, and when undo reverts buffer to unmodified state).
How can I achieve this ?

Note that this is not necessarity connected to Insert mode.
Buffer can easily become modified without entering insert mode.

Yakov



Re: trap changes in 'modified' state

2006-05-04 Thread Gerald Lai

On Thu, 4 May 2006, Eric Arnold wrote:


On 5/3/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:

I want to trap changes in the value of 'modified'  (execute
my  commands when first change is done to the
buffer, and when undo reverts buffer to unmodified state).
How can I achieve this ?

Note that this is not necessarity connected to Insert mode.
Buffer can easily become modified without entering insert mode.

Yakov



I'm not sure if it's what you're looking for, but the tabline is
triggered on the 'modified' setting.

[snip]

You can also use the statusline. A simple test:

  fun Test()
return &modified
  endf

  :set laststatus=2 statusline=%{Test()}

HTH :)
--
Gerald


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

2006-05-04 Thread Eric Arnold

As for nulls as line breaks, you're not out of the woods yet.  Try:

:let @a='[EMAIL PROTECTED]@c'

which should set @a to 'a<00>b<00>c'.  Now put reg a,   "apinto a
buffer.  The nulls will be treated as newlines.

Now yank back all the lines into reg b, and try

:echo strtrans(@b)


Getting mappings working again on Linux machine

2006-05-04 Thread Eric Leenman

Hi,

On my WinXP machine in gvim 6.3.0 my mapping works
On my Linux machine it partly works.

One of the things that doesn't work is the windows behaviour.
Like CTRL-C, CTRL-V , CTRL-X, ect

But also my own mappings work partly.
For example; i have a mapping like this which works on WinXP

 noremap   b
 inoremap  

 noremap  w
 inoremap  

But under Linux it doesn't
b and w itself does work.
Are C-Left and C-right special keys under Linux?

Best Regards
Eric

_
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




Re: Getting mappings working again on Linux machine

2006-05-04 Thread Eddy Petrişor

On 5/4/06, Eric Leenman <[EMAIL PROTECTED]> wrote:

Hi,

On my WinXP machine in gvim 6.3.0 my mapping works
On my Linux machine it partly works.

One of the things that doesn't work is the windows behaviour.
Like CTRL-C, CTRL-V , CTRL-X, ect

But also my own mappings work partly.
For example; i have a mapping like this which works on WinXP

  noremap   b
  inoremap  

  noremap  w
  inoremap  

But under Linux it doesn't
b and w itself does work.
Are C-Left and C-right special keys under Linux?


:behaviour mswin

--
Regards,
EddyP
=
"Imagination is more important than knowledge" A.Einstein


Re: Getting mappings working again on Linux machine

2006-05-04 Thread Eddy Petrişor

On 5/4/06, Eddy Petrişor <[EMAIL PROTECTED]> wrote:

On 5/4/06, Eric Leenman <[EMAIL PROTECTED]> wrote:
> Hi,
>
> On my WinXP machine in gvim 6.3.0 my mapping works
> On my Linux machine it partly works.
>
> One of the things that doesn't work is the windows behaviour.
> Like CTRL-C, CTRL-V , CTRL-X, ect
>
> But also my own mappings work partly.
> For example; i have a mapping like this which works on WinXP
>
>   noremap   b
>   inoremap  
>
>   noremap  w
>   inoremap  
>
> But under Linux it doesn't
> b and w itself does work.
> Are C-Left and C-right special keys under Linux?

:behaviour mswin


err, :behave mswin

and load the mswin.vim script

--
Regards,
EddyP
=
"Imagination is more important than knowledge" A.Einstein


Re: Getting mappings working again on Linux machine

2006-05-04 Thread Georg Dahn
Hi!

--- Eric Leenman <[EMAIL PROTECTED]> wrote:
> On my WinXP machine in gvim 6.3.0 my mapping works
> On my Linux machine it partly works.
> 
> One of the things that doesn't work is the windows behaviour.
> Like CTRL-C, CTRL-V , CTRL-X, ect

Just add

source $VIMRUNTIME/mswin.vim

Best wishes,
Georg










___ 
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for 
FREE! http://uk.mail.yahoo.com


scripted :isearch?

2006-05-04 Thread Neil Bird


  Is there a script function version of :isearch (akin to taglist)?

--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit


Re: scripted :isearch?

2006-05-04 Thread Yakov Lerner

On 5/4/06, Neil Bird <[EMAIL PROTECTED]> wrote:


   Is there a script function version of :isearch (akin to taglist)?


I don't know about builtin function. But it's possible to write such
a function by redirecting the output of :ilist.

Do you mean function a-la :ilist that returns list of matches instead of
printing them on the screen ?

Yakov


GVim Win32 - mouse cursor

2006-05-04 Thread Dominic Evans

Just a minor bug. It may not be fixable I am not sure. But I run GVim
with 'set mouse=' (i.e. mouse completely disabled). However, if the
mouse hovers over the statusline of a split window it still changes to
the <--> resize cursor.

As I said it is a very minor thing but thought I would mention it.

Regards,
Dominic


Re: GVim Win32 - mouse cursor

2006-05-04 Thread Bram Moolenaar

Dominic Evans wrote:

> Just a minor bug. It may not be fixable I am not sure. But I run GVim
> with 'set mouse=' (i.e. mouse completely disabled). However, if the
> mouse hovers over the statusline of a split window it still changes to
> the <--> resize cursor.
> 
> As I said it is a very minor thing but thought I would mention it.

Also happens for GTK on Unix.  I'll put it on my todo list.

-- 
hundred-and-one symptoms of being an internet addict:
21. Your dog has its own home page.

 /// 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: scripted :isearch?

2006-05-04 Thread Neil Bird

Around about 04/05/06 10:07, Yakov Lerner typed ...

Do you mean function a-la :ilist that returns list of matches instead of
printing them on the screen ?


  Actually, I finally sussed how ballooneval works and I thought that it 
might be cool to show the '[i' output there.


--
[EMAIL PROTECTED] ~]# rm -f .signature
[EMAIL PROTECTED] ~]# ls -l .signature
ls: .signature: No such file or directory
[EMAIL PROTECTED] ~]# exit


File Extenstions

2006-05-04 Thread Adrian Walls

Folks,

I am using gvim and when I edit a file it makes a copy of the file on my 
disk with a ~ appendend to the new file created.  How can I switch this 
off as I do not want this file being created.  I assume that is this 
some kind of back up copy of the file.


Thanks in advance,
Adrian.


Re: File Extenstions

2006-05-04 Thread Anton
On Thu, May 04, 2006 at 14:36 +0100, Adrian Walls wrote:
> Folks,
> 
> I am using gvim and when I edit a file it makes a copy of the file on my 
> disk with a ~ appendend to the new file created.  How can I switch this 
> off as I do not want this file being created.  I assume that is this 
> some kind of back up copy of the file.
> 
> Thanks in advance,
> Adrian.

If you don't want to make this copies at all:

:set nobackup nowritebackup

If you want to delete theese files after they are written to disk
succesfully:

:set nobackup writebackup



Re: File Extenstions

2006-05-04 Thread Yakov Lerner

On 5/4/06, Adrian Walls <[EMAIL PROTECTED]> wrote:

I am using gvim and when I edit a file it makes a copy of the file on my
disk with a ~ appendend to the new file created.  How can I switch this
off as I do not want this file being created.  I assume that is this
some kind of back up copy of the file.


:set nobackup

Yakov


Re: deleting repeated blocks of text

2006-05-04 Thread Vim Visual

Hey!

Thanks! This worked out perfectly


Now I have another question to you...

The final file, which I got thanks to the help of all of you, is to be
embedded into another web page...

Which command should I add in the script to tell vi to embed it in the
correct place?

At the moment I do it by telling vi something like "go to line XXX,
delete everything, insert text":

:386,$d
o 
:r /tmp/arXiV_2.txt
:w! ~pau/WWW/arXiV.html

But the inconvinient is that I have to modify the vim script whenever
I add something to the web page, the number line 386 is wrong... and
it is very tedious

The place of the web page to embed it looks like this (without blank
lines) : Between
  and  

-
.
.
.
.




http://xxx.lanl.gov/pdf/astro-ph/0605080";>   astro-ph/0605080
  Títol/Title: Populating the Galaxy
with low-mass X-ray binaries
  Autors/Authors: Paul D. Kiel, Jarrod R. Hurley

  Comentaris/Comments: 17 pages and 9
figures; accepted by MNRAS

  We perform binary population synthesis calculations to investigate
  the incidence of low-mass X-ray binaries and their birth rate in
  the Galaxy. We use a binary evolution algorithm that models all
  the relevant processes including tidal circularization and
  synchronization. Parameters in the evolution algorithm that are

  uncertain and may affect X-ray binary formation are allowed to
  vary during the investigation. We agree with previous studies that
  under standard assumptions of binary evolution the formation rate
  and number of black-hole low-mass X-ray binaries predicted by the
  model are more than an order of magnitude less than what is
  indicated by observations. We find that the common-envelope
  process cannot be manipulated to produce significant numbers of
  black-hole low-mass X-ray binaries. However, by simply reducing
  the mass-loss rate from helium stars adopted in the standard

  model, to a rate that agrees with the latest data, we produce a
  good match to the observations. Including low-mass X-ray binaries
  that evolve from intermediate-mass systems also leads to
  favourable results. We stress that constraints on the X-ray binary
  population provided by observations are used here merely as a
  guide as surveys suffer from incompleteness and much uncertainty
  is involved in the interpretation of results.




http://xxx.lanl.gov/pdf/astro-ph/0605093";>   astro-ph/0605093
  Títol/Title: Toroidal LNRF-velocity
profiles in thick accretion discs
  orbiting rapidly rotating Kerr black holes
  Autors/Authors: Zdenek Stuchlik, Petr
Slany, Gabriel Torok

  Comentaris/Comments: Updated version of
the Section talk at Albert Einstein
  Century International Conference at Palais de l'Unesco, Paris,
  France, 18-23 July, 2005; to appear in the Proceedings; AIP style
  files included; 8 pages

  We show that in the equatorial plane of marginally stable thick
  discs (with uniformly distributed specific angular momentum the

  orbital velocity relative to the locally non-rotating frames
  (LNRF) has a positive radial gradient in the vicinity of black
  holes with spin a>0.99979. The change of sign of the velocity
  gradient occurs just above the center of the thick toroidal discs,
  in the region where stable circular geodesics of the Kerr
  spacetime are allowed. The global character of the phenomenon is
  given in terms of topology changes of the von Zeipel surfaces
  (equivalent to the equivelocity surfaces in the tori with constant
  specific angular momentum distribution). Toroidal von Zeipel

  surfaces exist around the circle corresponding to the minimum of
  the equatorial LNRF velocity profile, indicating a possibility of
  development of some vertical instabilities in those parts of
  marginally stable tori with positive gradient of the LNRF
  velocity. Eventual oscillatory frequencies connected with the
  phenomenon are given in a coordinate-independent form.



http://xxx.lanl.gov/pdf/astro-ph/0605094";>   astro-ph/0605094

  Títol/Title: Basic properties of
toroidal structures in Kerr--de Sitter
  backgrounds
  Autors/Authors: Zdenek Stuchlik, Petr Slany
  Comentaris/Comments: Updated version of
the Section talk at Albert Einstein

  Century International Conference at Palais de l'Unesco, Paris,
  France, 18-23 July, 2005; to appear in the Proceedings; AIP style
  files included; 8 pages

  Perfect fluid tori with uniform distribution of the specific
  angular momentum o

Re: deleting repeated blocks of text

2006-05-04 Thread Tim Chase

Which command should I add in the script to tell vi to embed it in the
correct place?

At the moment I do it by telling vi something like "go to line XXX,
delete everything, insert text":

:386,$d
o 
:r /tmp/arXiV_2.txt
:w! ~pau/WWW/arXiV.html

But the inconvinient is that I have to modify the vim script whenever
I add something to the web page, the number line 386 is wrong... and
it is very tedious


Well, rather than a fixed line number, you can have some 
unique token in your file.  E.g., you can have a unique 
comment to mark the start of the content...something like




Then, instead of ":386,$d", you can do

:/CONTENT GOES HERE/+,$d

That finds the line containing that text ("/CONTENT GOES 
HERE/"), and then deletes ("d") from the following line 
("+") to the end of the file ("$").


More details can be found at

:help :range

HTH,

-tim







Re: hiding lines

2006-05-04 Thread Jack Donohue

:v (and :g) made my day..!


Yes, I use this a lot if I just want to filter out a set of lines, or see 
only lines containing some text (like the old XEDIT command).  But what I'd 
really like to to is continue editing in this view and not lose all the 
hidden lines, more like folding.  I expect folding can do this, but I've 
never gotten it to work and it seems pretty cumbersome.  I'm looking for a 
simple solution involving maybe a couple of command I can make a map for.


I guess I'm looking for a g or v command that folds the lines instead of 
actually deleting them.


Thanks,


Jack 



lines folding by pattern ; was Re: hiding lines

2006-05-04 Thread Yakov Lerner

On 5/4/06, Jack Donohue <[EMAIL PROTECTED]> wrote:

> :v (and :g) made my day..!

Yes, I use this a lot if I just want to filter out a set of lines, or see
only lines containing some text (like the old XEDIT command).  But what I'd
really like to to is continue editing in this view and not lose all the
hidden lines, more like folding.  I expect folding can do this, but I've
never gotten it to work and it seems pretty cumbersome.  I'm looking for a
simple solution involving maybe a couple of command I can make a map for.

I guess I'm looking for a g or v command that folds the lines instead of
actually deleting them.


I guess the mappings below are simple enough. If you prefer
to keep it to just couple of lines, you can remove mapping for 
and whole function TogglePatternBasedFolding(). What remains is
just 3 lines (maps for f2, f3, and f3). But I find tri-state toggle
(f5) also useful.

" Simple pattern-based folding.
" How to use: (1) perform searh (so that vim remebers search pattern),
"   (2) press f2, f3 f4, or press f5 repeatedly.
"
" F2 - fold lines that match current-search-pattern (cf :v//p)
" F3 - fold lines that do not match current-search-pattern (cf :g//p)
" F4 - open all folds
" F5 - tri-state toggle between f2-f3-f4

map  :set foldexpr=getline(v:lnum)=~@/ foldmethod=expr
foldenablezM
map  :set foldexpr=!(getline(v:lnum)=~@/) foldmethod=expr
foldenablezM
map  :set nofoldenable
map  :call TogglePatternBasedFolding()

function! TogglePatternBasedFolding()
   if &foldenable && &foldmethod=='expr' && &foldexpr[0] == '!'
   :set nofoldenable | redraw | echo "all folds opened"
   elseif &foldenable && &foldmethod=='expr' && &foldexpr[0] == 'g'
   :set foldexpr=!(getline(v:lnum)=~@/) foldmethod=expr foldenable
   normal zM
   redraw | echo "lines not matching /".@/."/ folded"
   else " &foldenable && &foldmethod=='expr' && &foldexpr[0] == 'g'
   :set foldexpr=getline(v:lnum)=~@/ foldmethod=expr foldenable
   normal zM
   redraw | echo "lines matching /".@/."/ folded"
   endif
endfun


Yakov


Re: hiding lines

2006-05-04 Thread Gerald Lai

On Thu, 4 May 2006, Jack Donohue wrote:


:v (and :g) made my day..!


Yes, I use this a lot if I just want to filter out a set of lines, or see 
only lines containing some text (like the old XEDIT command).  But what I'd 
really like to to is continue editing in this view and not lose all the 
hidden lines, more like folding.  I expect folding can do this, but I've 
never gotten it to work and it seems pretty cumbersome.  I'm looking for a 
simple solution involving maybe a couple of command I can make a map for.


I guess I'm looking for a g or v command that folds the lines instead of 
actually deleting them.


Perhaps this would do:

  :set foldenable foldexpr=getline(v:lnum)=~@/

To fold consecutive lines that start with the word "fold", first search

  /^fold

or

  :let @/ = "^fold"

Then do

  :set foldmethod=expr foldlevel=0

to fold every search match.

HTH.
--
Gerald


RE: hiding lines

2006-05-04 Thread Suresh Govindachar

Jack Donohue wrote: 

  >> :v (and :g) made my day..!
  >
  > Yes, I use this a lot if I just want to filter out a set of
  > lines, or see only lines containing some text (like the old
  > XEDIT command).  But what I'd really like to to is continue
  > editing in this view and not lose all the hidden lines, more
  > like folding.  I expect folding can do this, but I've never
  > gotten it to work and it seems pretty cumbersome.  I'm looking
  > for a simple solution involving maybe a couple of command I can
  > make a map for.
  > 
  > I guess I'm looking for a g or v command that folds the lines
  > instead of actually deleting them.

  The original post specifically asked for a non-fold based solution
  to "hiding lines".

  The first step toward finding a non-"cumbersome" solution that can
  be mapped and which results in folding away certain lines is to
  define what needs to be hidden (with everything else displayed or
  what needs to be displayed with everything else hidden).
  
  --Suresh



Re: deleting repeated blocks of text

2006-05-04 Thread Gerald Lai

On Thu, 4 May 2006, Tim Chase wrote:


Which command should I add in the script to tell vi to embed it in the
correct place?

At the moment I do it by telling vi something like "go to line XXX,
delete everything, insert text":

:386,$d
o 
:r /tmp/arXiV_2.txt
:w! ~pau/WWW/arXiV.html

But the inconvinient is that I have to modify the vim script whenever
I add something to the web page, the number line 386 is wrong... and
it is very tedious


Well, rather than a fixed line number, you can have some unique token in your 
file.  E.g., you can have a unique comment to mark the start of the 
content...something like




Then, instead of ":386,$d", you can do

:/CONTENT GOES HERE/+,$d

That finds the line containing that text ("/CONTENT GOES HERE/"), and then 
deletes ("d") from the following line ("+") to the end of the file ("$").

[snip]

Yes, Tim has explained everything. In the OP's case, "CONTENT GOES HERE"
is "". The OP can also shorten :d and :r to

  ://+,$!cat /tmp/arXiV_2.txt

or for a Windows system

  ://+,$!type /tmp/arXiV_2.txt

--
Gerald


Re: scripted :isearch?

2006-05-04 Thread Gerald Lai

On Thu, 4 May 2006, Neil Bird wrote:


Around about 04/05/06 10:07, Yakov Lerner typed ...

Do you mean function a-la :ilist that returns list of matches instead of
printing them on the screen ?


 Actually, I finally sussed how ballooneval works and I thought that it 
might be cool to show the '[i' output there.


It would be cool to show the "[I" output in a balloon. A first attempt:

  fun! Test()
redir => output
silent! exe "ilist! /".v:beval_text."/"
redir END
return output
  endf

  :set ballooneval balloonexpr=Test()

--
Gerald


Re: hiding lines

2006-05-04 Thread Gary Johnson
On 2006-05-04, Jack Donohue <[EMAIL PROTECTED]> wrote:
> > :v (and :g) made my day..!
> 
> Yes, I use this a lot if I just want to filter out a set of lines, or see 
> only lines containing some text (like the old XEDIT command).  But what I'd 
> really like to to is continue editing in this view and not lose all the 
> hidden lines, more like folding.  I expect folding can do this, but I've 
> never gotten it to work and it seems pretty cumbersome.  I'm looking for a 
> simple solution involving maybe a couple of command I can make a map for.
> 
> I guess I'm looking for a g or v command that folds the lines instead of 
> actually deleting them.

The basic technique of using folding for this is this:

set foldmethod=expr
set foldexpr=getline(v:lnum)=~'text to be folded'

To close all the folds, you can

set foldlevel=0

but I usually use zM to close all folds and zR to open all folds.

You could wrap that in a mapping and maybe a function to make it 
easier to use.  I usually type it out once, then use the command 
line history and editing features to modify the pattern as needed.

See

:help fold-expr

HTH,
Gary

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


LiveJournal S2 Syntax Highlighting - Strings

2006-05-04 Thread Max Cantor

Hi all,

I'm slapping together a quick syntax highlighting plugin for
LiveJournal's S2 code.  S2 has a special type of string that is
delimited by three quotes, which allows you to include quotes and
double quotes in the string, unescaped.  (This is useful for
quote-heavy stuff like HTML.)  It looks like this:

"""this is a "cool string" in which quotes - "" need not be escaped"""

Anyway, I'm trying to figure out how to fit this into my syntax
highlighting.  I guess my biggest problem is that I do not understand
the canonical string region declaration; this one is from c.vim:

syn regions2Stringstart=+L\="+ skip=+\|\\"+ end=+"+

What in the world do those pluses mean?  And that queue of
backslashes?  I don't understand how those specifications follow
pattern syntax.

So anyway, I just want to make it parse everything between triple
quotes as a String.  How do I do it?

Thanks.

Max



--
Max Cantor
516-639-1807 (cell)
802-447-4273 (school Sep - Jun)
http://nopoblopt.com


Re: lines folding by pattern ; was Re: hiding lines

2006-05-04 Thread Hari Krishna Dara

On Thu, 4 May 2006 at 8:54pm, Yakov Lerner wrote:

> On 5/4/06, Jack Donohue <[EMAIL PROTECTED]> wrote:
> > > :v (and :g) made my day..!
> >
> > Yes, I use this a lot if I just want to filter out a set of lines, or see
> > only lines containing some text (like the old XEDIT command).  But what I'd
> > really like to to is continue editing in this view and not lose all the
> > hidden lines, more like folding.  I expect folding can do this, but I've
> > never gotten it to work and it seems pretty cumbersome.  I'm looking for a
> > simple solution involving maybe a couple of command I can make a map for.
> >
> > I guess I'm looking for a g or v command that folds the lines instead of
> > actually deleting them.
>
> I guess the mappings below are simple enough. If you prefer
> to keep it to just couple of lines, you can remove mapping for 
> and whole function TogglePatternBasedFolding(). What remains is
> just 3 lines (maps for f2, f3, and f3). But I find tri-state toggle
> (f5) also useful.
>
> " Simple pattern-based folding.
> " How to use: (1) perform searh (so that vim remebers search pattern),
> "   (2) press f2, f3 f4, or press f5 repeatedly.
> "
> " F2 - fold lines that match current-search-pattern (cf :v//p)
> " F3 - fold lines that do not match current-search-pattern (cf :g//p)
> " F4 - open all folds
> " F5 - tri-state toggle between f2-f3-f4
>
> map  :set foldexpr=getline(v:lnum)=~@/ foldmethod=expr
> foldenablezM
> map  :set foldexpr=!(getline(v:lnum)=~@/) foldmethod=expr
> foldenablezM
> map  :set nofoldenable
> map  :call TogglePatternBasedFolding()
>
> function! TogglePatternBasedFolding()
> if &foldenable && &foldmethod=='expr' && &foldexpr[0] == '!'
> :set nofoldenable | redraw | echo "all folds opened"
> elseif &foldenable && &foldmethod=='expr' && &foldexpr[0] == 'g'
> :set foldexpr=!(getline(v:lnum)=~@/) foldmethod=expr foldenable
> normal zM
> redraw | echo "lines not matching /".@/."/ folded"
> else " &foldenable && &foldmethod=='expr' && &foldexpr[0] == 'g'
> :set foldexpr=getline(v:lnum)=~@/ foldmethod=expr foldenable
> normal zM
> redraw | echo "lines matching /".@/."/ folded"
> endif
> endfun
>
>
> Yakov

May I suggest that you take a look at my foldutil.vim? It allows folding
by matching lines as well as other criterion, and also gives you the
flexibility of specifying a context.

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

-- 
Thanks,
Hari

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


Highlighting cursor in a color terminal

2006-05-04 Thread Alexander Klink
Hey,

I am currently on a Linux console on a HP Jornada where the cursor is
barely visible. When editing, I use visual mode as a workaround to
quickly find out where I am in the file. But this is not the solution I
would like to use in the long term. I ran into :highlight Cursor in the
documentation, but something like :highlight Cursor ctermbg=Red does not
seem to work for me. Any ideas why this is not working or any ideas for
a workaround (I guess it should be possible to write a script that
highlights the cursor without using highlight Cursor anyways)?

Greetings,
Alex


avoid "Press Enter..." with new z= from function

2006-05-04 Thread Steve Hall

Is there a way to avoid the "Press ENTER or type command to continue"
when requesting spelling suggestions from a :normal z= call in a
function?

I'm not able to make any of the usual tricks (&shm, raising the
command height) work, and this statement blocks user input.


-- 
Steve Hall  [ digitect mindspring com ]




Network problem

2006-05-04 Thread Edward L. Fox

Hi VIMmers,

I'm sorry that I'm not able to sync the SVN repository with the CVS
repository on time today, because the network is suffering some
problems. I had tried different routes but all failed. Maybe there is
something wrong with the main gateways of the whole country. :-(

I'll sync the code as soon as the network recovers. Please wait for my
notice. Best wishes~


Regards,


Edward Leap Fox


Re: LiveJournal S2 Syntax Highlighting - Strings

2006-05-04 Thread Yakov Lerner

On 5/5/06, Max Cantor <[EMAIL PROTECTED]> wrote:

S2 has a special type of string that is
delimited by three quotes, which allows you to include quotes and
double quotes in the string, unescaped.  (This is useful for
quote-heavy stuff like HTML.)  It looks like this:

"""this is a "cool string" in which quotes - "" need not be escaped"""

Anyway, I'm trying to figure out how to fit this into my syntax
highlighting.  I guess my biggest problem is that I do not understand
the canonical string region declaration; this one is from c.vim:

syn regions2Stringstart=+L\="+ skip=+\|\\"+ end=+"+

What in the world do those pluses mean?  And that queue of
backslashes?  I don't understand how those specifications follow
pattern syntax.


It's just equivalent to
   ... start=/L\="/ skip=/\|\\"/ end=/"/
   ... [EMAIL PROTECTED]"@ [EMAIL PROTECTED]|\\"@ end=@"@
   ... start=;L\="; skip=;\|\\"; end=;";
Any delimiter can be used in place of  '/' to delimit regexp!
BTW it's also true about :s/// command; all of the following mean the same:
   :s;from;to;
   :[EMAIL PROTECTED]@to@
   :s+from+to+
(except when separattor occurs inside the regexp and replacement).

Backslashes mean to handle the "\n\\\"" C notation. Maybe you don't need it,
depending of whether S2 handlesh backslas inside quoted sring
specially or not.

Yakov


Using vim to keep a todo list

2006-05-04 Thread Yi Qiang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,
I've looked all over the net for a simple console based todo list
manager and I always eventually come back to just using vim to edit a
plain text file.  I imagine there are other people who use vim to manage
a todo list so I'd like to know what kind of tips&tricks you might have.

Thanks in advance,
Yi
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEWt7LtXlIMrUVVksRAiYBAJ4t1OlUVIqDFDqnENp1/DlRhiXR+gCfZH5E
uri7p8l1s8rUMUa9KP21lp4=
=RDSB
-END PGP SIGNATURE-