Re: OT: Vi in a browser...

2007-06-01 Thread Yakov Lerner

On 5/30/07, Tim Chase [EMAIL PROTECTED] wrote:

Just stumbled across this link:

http://gpl.internetconnection.net/vi/

for a basic implementation of Vi, authored in JavaScript.  Sick,
sick, sick.  So just in case you're on a foreign computer that
doesn't have vi/vim installed, and you need a fix, you can get it
via the web. :)


But you can't read/save disk files out of javascript, can you ?
I thought javascript can't.

Yakov


Re: breakindent, take 2

2007-05-29 Thread Yakov Lerner

On 5/29/07, Nico Weber [EMAIL PROTECTED] wrote:

 What do you think? I prefer (c) from implementation, efficiency and
 intuitivity perspective.

I agree. Strongly.


Yes, I agree with (c) , too. I suggested once new type of options to vim that
behaved both like boolean, and numeric. But Bram rejected this. It's a pity
because this would make for lesser number of options. Actually, the
options that would be three-way boolean, and string, and numeric would be
even better.

Yakov


Re: breakindent, take 2

2007-05-29 Thread Yakov Lerner

On 5/29/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 5/29/07, Nico Weber [EMAIL PROTECTED] wrote:
  What do you think? I prefer (c) from implementation, efficiency and
  intuitivity perspective.

 I agree. Strongly.

Yes, I agree with (c) , too. I suggested once new type of options to vim that
behaved both like boolean, and numeric. But Bram rejected this. It's a pity
because this would make for lesser number of options. Actually, the
options that would be three-way boolean, and string, and numeric would be
even better.


An afterthought.
A string-typed  'breakindent' option could work, too. Empty value=off,
0=on, +n, -n.
Another advantage of string option is that you can add
additional flags to it later, without multiplying number of new options
( a-la 'compatible', 'viminfo', 'giooptions' bag-of-flags ). Bram
is always reluctant to add new options, so this can be a consideration.

Yakov


Re: Why bottom-posting is prefered on Vim Mainling List?

2007-05-29 Thread Yakov Lerner

On 5/28/07, Dave Land [EMAIL PROTECTED] wrote:

Folks,

In the spirit contrarianism, I'm going to top-post now.

Actually, both parts of Mark's post below were of a _third_ variety:
interlinear comments.


I disagree. Interlinear is not third variety, but a subcategory of
either top-posting, or of bottom-posting. To make it clearer:
If someone  A places his  comment *below* the quote he is
commenting on, this is bottom-posting, essentially -- although
split in pieces. If B places his comments right *above* quotes he is
commenting on, this is variant of bottom-posting.

When you are commenting on a single quote of somebody,
then what you call intelineated reduces to pure top-posting or bottom
posting.

There is yet another schol of responding, which is
to erase all previous material completely and include only
the response in the body. It can be summarised as you
remember what you wrote, didn't you ? If you don't remember,
it's not *my* problem

BTW since nobody interlineates his comments *above*
the quotes he's commenting on, I think this makes another
argument for bottom-posting.


Yakov


Re: Why bottom-posting is prefered on Vim Mainling List?

2007-05-29 Thread Yakov Lerner

On 5/28/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

As far as I know, most e-mail clients defaults to top-posting


some email clients have an option. But it does not help much.
Top-vs-bottom depends on the specific mailing list.
If I am on mailing list X which has convention of bottom-posting
and also on mailing list Y which has convention of top-posting,
then single option in mail client is not much helpful. gmail doesn't
have this option at all, but I dont feel invonvenienced.

Yakov


Re: VimWiki - First Beta

2007-05-29 Thread Yakov Lerner

On 5/29/07, Sebastian Menge [EMAIL PROTECTED] wrote:

Hi all

Access the first beta here: http://tinyurl.com/34kfj5


Where can I see the recently posted/by recency view ?
In other words, what's used for RSS ?

Yakov


Re: Why bottom-posting is prefered on Vim Mainling List?

2007-05-29 Thread Yakov Lerner

On 5/29/07, Ben Kim [EMAIL PROTECTED] wrote:


Sounds very archaic, but if I read mails with dumb terminals (baud rate
2400 bps), and if I am not familiar with the subject of the thread, top
posting would be painful.

It would especially be so to whoever has the honor of answering most of
the questions on the list...

But other than that, most of the times, I find bottom posting more
inefficient.

It feels like when I grade a student's report where the questions are
mixed with answers and they are not quite visually separated. (On pine,
they are not...) When I know what the question was, I come to wish that I
had answers at the top, rather than having to page down several times to
read the whole.

At the same time, sometimes a nicely matched q  a sorted in order saves
me time... especially when I search old archives.


You just illustrated the 3rd posting style, the clear-posting style.
It has certain advantage over top-posting and bottom-posting.
Clear-posting is fundamentally clean, space-efficient and free
of top/bottom biases.

But wrt top-posting vs bottom-posting. There is additional parameter
that affect readabiltiy even more than top/bottom. It's number of past
accumulated tails that you leave in the quotes. Some people do not
cut away any past tails. After 4-5 levels of nesed quoting, this becomes
unreadable both in top-style and in bottom-style.

I cut away all but last 3 level of past quotes, and then I shorten them
by dropping the greetings, the  signature and irrelevant part.
Shortness of quotes
makes for for readabilty of the response. Multiple levels of fossilization
make replies less readable, not the top/bottom difference.

Yakov


Re: breakindent, take 2

2007-05-28 Thread Yakov Lerner

On 5/14/07, Václav Šmilauer [EMAIL PROTECTED] wrote:

Hello,

I submit patch that implements the 'breakindent' feature. It is on vim todo
list, since the moment I tried a few years ago (see e.g.
http://marc.info/?l=vim-devm=109921292009721w=1). Picture says what it's
about (showbreak is aligned with first non-whitespace):

http://beta.arcig.cz/~eudoxos/vim7/breakindent1.png
http://beta.arcig.cz/~eudoxos/vim7/breakindent2.png

I tried to address all Bram's comments he had to the original patch, like
coding style, functionality in diff mode, selections etc. I had to change a
few prototypes to pass line number.

There is one bug and some (easily fixable) limitations:

* BUG: there is some weird interaction with quickfix window, where very
rarely there is the ml_get(): invalid line number error. I think it is
caused by passing wrong line number thgouth the *chartabsize*  family
routines (line in the main buffer interpreted as line in the quickfix window
or something like that), but I am not sure.

* No test case. This will be added once there is enough interest from
developers (there _is_ documentation).

* The bri_min variable is not exposed to userspace yet, is set to 20 in the
code. If the rest is considered ready for inclusion, I will add a
user-serrable variable for that.

The patch is against current svn (vim7, rev. 288). Any comments are welcome.


Nice feature. I hope Bram includes it.

Yakov


Re: breakindent, take 2

2007-05-28 Thread Yakov Lerner

On 5/14/07, Václav Šmilauer [EMAIL PROTECTED] wrote:

Hello,

I submit patch that implements the 'breakindent' feature. It is on vim todo
list, since the moment I tried a few years ago (see e.g.
http://marc.info/?l=vim-devm=109921292009721w=1). Picture says what it's
about (showbreak is aligned with first non-whitespace):

http://beta.arcig.cz/~eudoxos/vim7/breakindent1.png
http://beta.arcig.cz/~eudoxos/vim7/breakindent2.png

I tried to address all Bram's comments he had to the original patch, like
coding style, functionality in diff mode, selections etc. I had to change a
few prototypes to pass line number.

There is one bug and some (easily fixable) limitations:

* BUG: there is some weird interaction with quickfix window, where very
rarely there is the ml_get(): invalid line number error. I think it is
caused by passing wrong line number thgouth the *chartabsize*  family
routines (line in the main buffer interpreted as line in the quickfix window
or something like that), but I am not sure.

* No test case. This will be added once there is enough interest from
developers (there _is_ documentation).

* The bri_min variable is not exposed to userspace yet, is set to 20 in the
code. If the rest is considered ready for inclusion, I will add a
user-serrable variable for that.

The patch is against current svn (vim7, rev. 288). Any comments are welcome.


I played with the patch. Works smoothly, I did not find any deficiencies.

I have one wish though.

It would be nice if I could specificy additional indent for continuation lines.
You make indent for continuation line *EQUAL* to indent of the 1st screen line.
Let's say  you have 3 consequitive long lines with same indent, and
each lines wrapped into 4 screen lines. With current 'breakindent'
patch, you see 8 lines
with *same* indent. It's not that easy to see beginning of each long lines.
If breakindent would be numeric value N which meant assign indent K+N
to continuation indent, where K is indent of the line itself. Current
breakindent corresponds to N==0. But I'd probably prefer N=1 or N==2.

Just my 2 cents
Thanks
Yakov
** nobreakindent
 line1line1line1line1
line1line1line1line
 line2line2line2line2
line2line2line2line
** breakindent=0
 line1line1line1line1
 line1line1line1line
 line2line2line2line2
 line2line2line2line
** breakindent=2
 line1line1line1line1
   line1line1line1line
 line2line2line2line2
   line2line2line2line
**


Re: Proposal: adding an extra hook into vim's search

2007-05-28 Thread Yakov Lerner

On 5/28/07, Iain Murray [EMAIL PROTECTED] wrote:

On 26/05/07, Iain Murray [EMAIL PROTECTED] wrote:
 On 26/05/07, Yakov Lerner [EMAIL PROTECTED] wrote:
  I believe you can achieve what you want using 'cmap expr' cleverly.
...
 I might still attempt a patch. Having the space replacement actually
 appear is visually distracting  and makes the resulting search string
 hard to read.

Having had a more detailed look at the code I'm bailing out of
attempting this for now. Making the search history still work and be
uncluttered of '\_s\+' seems fiddly. The natural way to do this seems
to be making the magic types more flexible. The changes would be
somewhat further reaching than I had initially anticipated and I
wouldn't be happy doing it without there being consensus out there on
a specification.

Thanks again Yakov for the partial fix.


I believe you can have uncluttered view of the regex AND
incremental search at the same time using getchar()
in vimscript, but that would be tons of vimscript programming.

Yakov


Re: VimWiki - Page Titles

2007-05-28 Thread Yakov Lerner

On 5/27/07, Sebastian Menge [EMAIL PROTECTED] wrote:

Hi

I have prepared a list with problematic page titles. Especially titles
with chars like [/#{}[]*] and the like are problematic since mediawiki
doesnt allow them


Strange. Are you sure? I just created a page on wikia.com, page
titled '/hello/' and it created it without problems. Maybe ...;
encoding is needed ?
With slashes both in title and in summary and in category. You can see it here-
  http://scratchpad.wikia.com/wiki//hello/
  Page titled '/hello/'
You can try to create such manually and intercept what browser sends in
and the mimic this in the script maybe ? Because with manual submission, wikia
does seem to allow slashes in the title.
If you upload scripts using script, then did you try the ...; encoding ?

Yakov


Re: A performance question (patch included)

2007-05-26 Thread Yakov Lerner

On 5/25/07, Charles E Campbell Jr [EMAIL PROTECTED] wrote:

John Beckett wrote:

 A.J.Mechelynck wrote:

 What about a different function to return, say, the number of
 1K blocks (or the number of times 2^n bytes, with a parameter
 passed to the function) that a file uses?


 Yes, that's a much more general and better idea.

 Since there's probably not much need for this, I think that
 simplicity would be good. That is, have the function work in a
 fixed way with no options.

 Re Dr.Chip's LargeFile script: It occurs to me that another
 workaround would be to use system() to capture the output of
 'ls -l file' or 'dir file' (need an option for which).

 Then do some funky editing to calculate the number of digits in
 the file length. If more than 9, treat file as large.

 I'm playing with a tiny utility to help the LargeFile script.
 Bluesky: Its code (64-bit file size) could potentially be
 incorporated in Vim. I'll post results in vim-dev.


(I've moved this over to vim-dev)

I've attached a patch to vim 7.1 which extends getfsize(); with the
patch, getfsize() takes an optional
second parameter which gives one the ability to specify a unitsize.
In other words,

getfsize(eval.c)  - 478347 (after the patch)

getfsize(eval.c,1000)  - 479   (truncated upwards)

I'll be awaiting Bram's input before making use of this in LargeFile.vim !

Regards,
Chip Campbell




*** src/o_eval.c2007-05-25 08:52:12.0 -0400
--- src/eval.c  2007-05-25 09:04:43.0 -0400
***
*** 7094,7100 
  {getcwd,0, 0, f_getcwd},
  {getfontname,   0, 1, f_getfontname},
  {getfperm,  1, 1, f_getfperm},
! {getfsize,  1, 1, f_getfsize},
  {getftime,  1, 1, f_getftime},
  {getftype,  1, 1, f_getftype},
  {getline,   1, 2, f_getline},
--- 7094,7100 
  {getcwd,0, 0, f_getcwd},
  {getfontname,   0, 1, f_getfontname},
  {getfperm,  1, 1, f_getfperm},
! {getfsize,  1, 2, f_getfsize},
  {getftime,  1, 1, f_getftime},
  {getftype,  1, 1, f_getftype},
  {getline,   1, 2, f_getline},
***
*** 10135,10142 
  {
if (mch_isdir(fname))
rettv-vval.v_number = 0;
!   else
rettv-vval.v_number = (varnumber_T)st.st_size;
  }
  else
  rettv-vval.v_number = -1;
--- 10135,10151 
  {
if (mch_isdir(fname))
rettv-vval.v_number = 0;
!   else if (argvars[1].v_type == VAR_UNKNOWN)
rettv-vval.v_number = (varnumber_T)st.st_size;
+   else
+   {
+   unsigned long unitsize;
+   unsigned long stsize;
+   unitsize= get_tv_number(argvars[1]);
+   stsize= st.st_size/unitsize;
+   if(stsize*unitsize  st.st_size) ++stsize;
+   rettv-vval.v_number = (varnumber_T) stsize;
+   }
  }
  else
  rettv-vval.v_number = -1;
*** runtime/doc/o_eval.txt  2007-05-25 09:00:08.0 -0400
--- runtime/doc/eval.txt2007-05-25 09:06:19.0 -0400
***
*** 1615,1621 
  getcmdtype()  String  return the current command-line type
  getcwd()  String  the current working directory
  getfperm( {fname})String  file permissions of file {fname}
! getfsize( {fname})Number  size in bytes of file {fname}
  getfontname( [{name}])String  name of font being used
  getftime( {fname})Number  last modification time of file
  getftype( {fname})String  description of type of file {fname}
--- 1615,1621 
  getcmdtype()  String  return the current command-line type
  getcwd()  String  the current working directory
  getfperm( {fname})String  file permissions of file {fname}
! getfsize( {fname} [,unitsize])Number  size in bytes of file {fname}
  getfontname( [{name}])String  name of font being used
  getftime( {fname})Number  last modification time of file
  getftype( {fname})String  description of type of file {fname}
***
*** 2819,2827 
  getcwd()  The result is a String, which is the name of the current
working directory.

! getfsize({fname}) *getfsize()*
The result is a Number, which is the size in bytes of the
given file {fname}.
If {fname} is a directory, 0 is returned.
If the file {fname} can't be found, -1 is returned.

--- 2819,2829 
  getcwd()  The result is a String, which is the name of the current
working directory.

! getfsize({fname} [,unitsize]) *getfsize()*
The result is a Number, which is the size in bytes of the
given file {fname}.
+   If unitsize is given, then the file {fname}'s 

Re: Proposal: adding an extra hook into vim's search

2007-05-26 Thread Yakov Lerner

On 5/26/07, Iain Murray [EMAIL PROTECTED] wrote:

Hi,

Searching for hello world in vim doesn't match hello\nworld.
This is annoying when editing documents. The solution is to
search for hello\_sworld. But it is frustrating to type \_s
instead of a space in every search.

I have been getting around this by calling my own search function
(appended at the very end of this email). This issue has also
been discussed before:
http://bugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=256743
and the solution then was to use a vim-script function too.

The problem with vim-script hacks is that they do not provide
incremental searching. I often find myself doing an incsearch,
having it fail and then having to try again with my own search
function. It might be possible to re-implement incsearch in
vim-script, but why reinvent the wheel? I think it would be
better if I could hook into vim's existing interactive search
mechanisms. For reference, emacs has an option to change the
meaning of ' ' in its incremental regex search (obtained with
M-C-s), the option is set in .emacs with
(setq search-whitespace-regexp [ \t\r\n]+)

I intend to write a patch for vim, if only for my own use. It
seems that I could do one of a few things:
- add an option to allow search strings to be filtered
  through an arbitrary user function before being used
- add a string option that would replace ' ' in searches.
- add a Boolean option which offers one specific line-break
  ignoring behaviour.
- extend the behaviour of the magic option (how?)
Which (if any) of these is likely to be adopted?

Perhaps these lines in doc/todo.txt are relevant? I don't really
understand them:
From xvim: Allow a newline in search patterns (also for :s,
can delete newline).  Add BOW, EOW, NEWL, NLORANY, NLBUTANY,
magic 'n' and 'r', etc. [not in xvim:] Add option to switch
on matches crossing ONE line boundary.
Can anyone tell me what xvim is, what the acronyms stand for and
what the reference to magic options means?

Thanks for your time,
Iain.


 This is the search function I have been using:
function! MySearch()
let l:str = input('/')
let l:str = substitute(l:str, ,'\\_s\\+',g)
let @/ = l:str
call histadd('/',l:str)
call search(l:str)
endfunction



I believe you can achieve what you want using 'cmap expr' cleverly.
Does this following do what you want ? You toggle special behaviour
of space in searching with F2, and you have incsearch, too.
Special-space is off in the following example, you can make it on
by inclugint this line: call ToggleSpecialSpaceSearch()

 to set ;special space in search' on by default, do this:
 call ToggleSpecialSpaceSearch()
nnoremap silentf2 :call ToggleSpecialSpaceSearch()cr
cnoremap exprf2 (ToggleSpecialSpaceSearch())
func! ToggleSpecialSpaceSearch()
   if exists('g:my_search')  g:my_search
   cunmap space
   let g:my_search=0
   echo 'space in search normal'
   else
   cnoremap exprspace
(getcmdtype()=='/'\|\|getcmdtype()=='?'?'\_s\+':' ')
   let g:my_search=1
   echo 'space in search special'
   endif
   return ''
endfun


Yakov


Re: A performance question

2007-05-25 Thread Yakov Lerner

On 5/25/07, John Beckett [EMAIL PROTECTED] wrote:

A.J.Mechelynck wrote:
 What about a different function to return, say, the number of
 1K blocks (or the number of times 2^n bytes, with a parameter
 passed to the function) that a file uses?

Yes, that's a much more general and better idea.

Since there's probably not much need for this, I think that
simplicity would be good. That is, have the function work in a
fixed way with no options.

Re Dr.Chip's LargeFile script: It occurs to me that another
workaround would be to use system() to capture the output of
'ls -l file' or 'dir file' (need an option for which).

Then do some funky editing to calculate the number of digits in
the file length. If more than 9, treat file as large.


9-digit number can still be larger than 2^32-1, or than 2^31-1. It's
possible to compare large numbers safely with the following method:
(1) right-align them to fixed with (say, to width 20 to be on the
safe side), then
(2) prepend non-ditit  character on the left to prevent vim from terating them
 as string and getting numeric overflow, then
(3) compare them as strings.
Like this:

bignum1=987654321
bignum2=876543210
x=printf(x%20s, bignum1)  do not use %d to avoid overflow, use %s
y=printf(x%20s, bignum2)  do not use %d to avoid overflow, use %s
if x  y
  bignum1 is bigger than bignum2
endif

Yakov


Re: A performance question

2007-05-25 Thread Yakov Lerner

On 5/25/07, Yongwei Wu [EMAIL PROTECTED] wrote:

On 24/05/07, Robert M Robinson [EMAIL PROTECTED] wrote:

 On Wed, 23 May 2007, fREW wrote:
 |Someone recently was emailing the list about looking at a small
 |section of DNA with vim as text and it was a number of gigs.  I think
 |he ended up using other unix tools (sed and grep I think), but
 |nontheless, text files can be big too ;-)
 |
 |-fREW
 |

 A maxim that comes up here is A lack of imagination doesn't prove anything.
 The fact that Condoleeza Rice couldn't imagine the degree of chaos that would
 ensue if we invaded Iraq does not prove that Iraq is not currently in chaos!

 I use vim for _structured_ text files, largely because regular expression
 search is much more useful than word search when the text is structured.
 Whether those files are large or not usually depends on whether I'm editing
 programs (small) or viewing/editing their output (often quite large).  Emacs
 also provides regular expression search, but I find vim's commands simpler
 and easier to type--and therefore faster to use.

I do not understand your statements: what's your problem of using
regular expressions in grep and sed?


I think Robert implied that it takes lot of imagination
to use vim on multi-gigabyte size. I might be wrong.

I don't exactly understand the connection size of one's
imagination and size of the file on which one applies vim.
But the connection is perfectly possible. For example, I never tried to
run vim on anything bigger than 0.5GB and I do indeed have
average or lesser than average imagination.

Hell starting tomorrow, I am going to vim the 2+0.2*day_count sized
files, every day,
It only remains to buy imagine-o-meter, and apply it daily.

Yakov average-sized imagination Lerner


Re: VimWiki - referring to vimdoc

2007-05-23 Thread Yakov Lerner

On 5/23/07, Sebastian Menge [EMAIL PROTECTED] wrote:

Im tweaking the import script right now, and noticed that there are many
references to the :help.

I would like to replace all the occurrences of sth. like (:help
some-text) by a reference to vimdoc.

Does someone know how what URL could be used instead of :help
sometext ??

I found the link
http://vimdoc.sourceforge.net/htmldoc/tags.html#help-tags but the page
is not available. (404)


You can use following URL to find tags matching SOMETEXT:

  http://vimdoc.sourceforge.net/search.php?docs=helpsearch=SOMETEXT

Yakov


Re: Is it possible to do spelling check for comments only?

2007-05-22 Thread Yakov Lerner

On 5/22/07, Edward L. Fox [EMAIL PROTECTED] wrote:

On 5/21/07, Swaroop C H [EMAIL PROTECTED] wrote:
  When programming, I have to turn the spelling check off. Or it will
  show a lot of spelling mistakes in the code. I'd like to apply
  spelling check for sentences within the comment blocks only. Is it
  possible to configure VIM to do this?


 See :help spell-syntax

Hmmm, so that means that I could only define which regions to be
spelling checked in the syntax highlight plugins.


It's expected that syntax file would enable/allow spelling in comments.
But it's added by synatx file maintainers, no ?
Is it a problem of a specific language you are using  ?
Which language specifically are you talking about ?
I think most-used languages do have spelling enabled in the comments.
The less used languages might not yet have this added by their
respective maintainer.
not all, because this is relatively new feature and
I do not think all syntax maintainers added this.
But maybe I am wrong and I'm missing something.
Which language are you talking about ?


Yakov


Re: How to get value of ~ (last used replace-to string) in script

2007-05-21 Thread Yakov Lerner

On 5/21/07, Antony Scriven [EMAIL PROTECTED] wrote:

On 5/20/07, Yakov Lerner [EMAIL PROTECTED] wrote:

  In a script, how do I get the value of ~ -- the last used
  replace-to string, as used in s//~/ ?
 
  Yakov
 

Quick hack. --Antony

fun! EchoTilde()
   $ put=''
   s/^/~/
   let tilde = getline('.')
   d
   echo tilde
endfun



~ can be multiline. Then d would not work correctly.
u would be better. but even then, buffer can be marked nonmodifiable.

Yakov


Re: How to compile graphical Vim on Mandriva 2007?

2007-05-21 Thread Yakov Lerner

On 5/21/07, Steve Litt [EMAIL PROTECTED] wrote:

On Sunday 20 May 2007 15:51, you wrote:
 On 5/20/07, Steve Litt [EMAIL PROTECTED] wrote:
  Hi all,
 
  I tried to compile graphical Vim 7.1 on Mandriva 2007. I downloaded
  vim-7.1.tar.bz2, untarred it, and did the following from the top level
  directory created (vim71):
 
  ./configure --enable-gui
  make
  src/vim -g
 
  The following error message appeared:
 
  E25: GUI cannot be used: Not enabled at compile time
 
 
  I retried, after make distclean, with the following configure options:
 
  enable-gui=gtk
  enable-gui=gtk2
  enable-gui=auto
 
  All produced the same error:
 
  E25: GUI cannot be used: Not enabled at compile time
 
  I chose not to perform make install in order to preserve the integrity of
  my existing Vim 7.0 that came with Mandriva 2007.
 
  Anyone know how to compile graphical Vim on Mandriva 2007, or at least
  some diagnostic tests I can use to narrow down the problem?

 You need to install gtk2-devel package. Also, the x11-devel package if
 it's not installed.
 The exact names of packages may vary between distributions. But the
 idea is, you are
 missing development packages (*-devel or *-dev) needed to compile GUI
 functionality of vim.

Thanks Yakov,

I can't find them anywhere in the distribution packages. Funny thing is, Gnome
works, and Mandriva managed to get a working 7.0 version of gvim installed on
the machine as a package.


Yes, this is expected. Because build-dependencies of vim-gtk
are bigger than run-dependencies. If your packaging system is apt-get, then
you can see names of packages to install with
this command:

apt-get build-dep vim-gtk # install all devel packages
# needed to rebuild vim-gtk

If your packaging system is rpm or some else, then it's not that
straightforward to find names of the missing packages, those
packages that are needed to rebuild vim-gtk. Use rpmfind.net if your
packaging system is rpm.

Yakov


undo replace in multiple files

2007-05-21 Thread Yakov Lerner

Let's say I do multi-file replace like 'argdo %s/foo/bar/g',
and I 'autowrite' and 'nohidden' options are  set.
So the argdo will replace and write files, because of 'autowrite' is on.
My question is, is there any trick to do 'undo' after that that
would undo all changed files in this situation ?

Thanks
Yakov


Re: Vim 7.1 errors

2007-05-21 Thread Yakov Lerner

On 5/21/07, Robert Hicks [EMAIL PROTECTED] wrote:

Robert Hicks wrote:
 This could be just something I am doing wrong.

 I am creating my .vimrc file and once I put:

 set laststatus=2

 in and save and then open Vim I get the following error:

  sccs: command not found
 tr: at least one string must be given when squeezing repeats

 Any ideas?

 This is what I compiled with:

 :version
 VIM - Vi IMproved 7.1 (2007 May 12, compiled May 21 2007 15:18:20)
 Huge version without GUI.  Features included (+) or not (-):
 +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset
 +cindent -clientserver
 -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv
 +cscope +cursorshape
 +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra
 +extra_search +farsi
 +file_in_path +find_in_path +folding -footer +fork() -gettext
 -hangul_input +iconv +insert_expand
 +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds
 +localmap +menu +mksession
 +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm
 +mouse_netterm +mouse_xterm
 +multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra
 +perl +postscript +printer
  +profile -python +quickfix +reltime +rightleft -ruby +scrollbind +signs
 +smartindent -sniff
 +statusline -sun_workshop +syntax +tag_binary +tag_old_static
 -tag_any_white -tcl +terminfo
 +termresponse +textobjects +title -toolbar +user_commands +vertsplit
 +virtualedit +visual
 +visualextra +viminfo +vreplace +wildignore +wildmenu +windows
 +writebackup -X11 -xfontset -xim
 -xsmp -xterm_clipboard -xterm_save
system vimrc file: $VIM/vimrc
  user vimrc file: $HOME/.vimrc
   user exrc file: $HOME/.exrc
   fall-back for $VIM: /usr/local/share/vim
 Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT
 -D_GNU_SOURCE -DDEBUGGING
   -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 -I/usr/include/gdbm  -I/usr/lib/pe
 rl5/5.8.5/ia64-linux-thread-multi/CORE
 Linking: gcc   -Wl,-E
 -Wl,-rpath,/usr/lib/perl5/5.8.5/ia64-linux-thread-multi/CORE
 -L/usr/local/li
 b -o vim   -lncurses -lacl -lgpm -Wl,-E
 -Wl,-rpath,/usr/lib/perl5/5.8.5/ia64-linux-thread-multi/
 CORE  -L/usr/local/lib
 /usr/lib/perl5/5.8.5/ia64-linux-thread-multi/auto/DynaLoader/DynaLoader.a
 -L/
 usr/lib/perl5/5.8.5/ia64-linux-thread-multi/CORE -lperl -lresolv -lm
 -lutil -lc
 Press ENTER or type command to continue


 Help?

 Robert


I also tried the latest CVS version and I get the same error.


Any plugins in ~/.vim/plugin ? What does :scriptnames show ?

Yakov


Re: remote editing and spell list sync

2007-05-20 Thread Yakov Lerner

On 5/19/07, Eric Smith [EMAIL PROTECTED] wrote:

I use remote editing a lot (rsync protocol) and want to keep the spelling lists
on both machines always synchromised.

Is the best way with unison(1) or suchlike or is there a better way?


I tried unison, but then I found that personal svn/hg/git/cvs is much better.
For many years, I have been using personal svn. Then I switched to git.
It's matter of taste which VCS to use. But it beats unison, to my opinion.
One problem of VCS is that there are many any choices.
hg and svn are both good choices.

Yakov


How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread Yakov Lerner

In a script, how do I get the value of ~ -- the last used
replace-to string, as used in s//~/ ?

Yakov


Re: How to compile graphical Vim on Mandriva 2007?

2007-05-20 Thread Yakov Lerner

On 5/20/07, Steve Litt [EMAIL PROTECTED] wrote:

Hi all,

I tried to compile graphical Vim 7.1 on Mandriva 2007. I downloaded
vim-7.1.tar.bz2, untarred it, and did the following from the top level
directory created (vim71):

./configure --enable-gui
make
src/vim -g

The following error message appeared:

E25: GUI cannot be used: Not enabled at compile time


I retried, after make distclean, with the following configure options:

enable-gui=gtk
enable-gui=gtk2
enable-gui=auto

All produced the same error:

E25: GUI cannot be used: Not enabled at compile time

I chose not to perform make install in order to preserve the integrity of my
existing Vim 7.0 that came with Mandriva 2007.

Anyone know how to compile graphical Vim on Mandriva 2007, or at least some
diagnostic tests I can use to narrow down the problem?


You need to install gtk2-devel package. Also, the x11-devel package if
it's not installed.
The exact names of packages may vary between distributions. But the
idea is, you are
missing development packages (*-devel or *-dev) needed to compile GUI
functionality of vim.

Yakov


Re: C-X C-F completion and paths with spaces

2007-05-20 Thread Yakov Lerner

On 5/20/07, Matthew Winn [EMAIL PROTECTED] wrote:

I can't begin to imagine why Microsoft thought it would be
a good idea to put spaces in the names of system directories


I have two theories about this.
1) MS lifted the idea from Macintosh
2) MS, long humiliated by inferiority complex of the 8+3 FAT16 filenames,
did it to subvert the idea of unix shell scripting powers. To create,
that is, the
files that break unix shell scripts  (remember samba ? ).

Yakov


Re: How to get value of ~ (last used replace-to string) in script

2007-05-20 Thread Yakov Lerner

On 5/21/07, Tim Chase [EMAIL PROTECTED] wrote:

 In a script, how do I get the value of ~ -- the last used
 replace-to string, as used in s//~/ ?

While I've wondered this in the past, and don't have an answer at
the moment,


It seems natural to patch expand() function to return this.
The question which argument to use. expand('~') ?
This is home directory. expand('s~') maybe ?

Yakov


Re: how to display a column line at righ margin?

2007-05-19 Thread Yakov Lerner

On 5/19/07, Ken YANG [EMAIL PROTECTED] wrote:


hi all,

can you guide me how to display a column line at right margin, e.g.
80, as gedit and eclipse do.

i find this thread in mails archive:

http://tech.groups.yahoo.com/group/vim/message/33159

but the method told in this thread is useless, it has some erros when
i start vim in gnome-terminal.


1. this command shall not have problems in gvim or vim:
  :match Error /\%79v/
You probably used different command if you get errors.

2. Another method is to vsplit, and make width of left pane 80 chars,
and work in it.

Yakov


Re: C-X C-F completion and paths with spaces

2007-05-19 Thread Yakov Lerner

On 5/19/07, Maciej Kalisiak [EMAIL PROTECTED] wrote:

Hello fellow Vimmers,

Can any of you that work on Windows tell me how you handle filename
completion (C-X C-F) for paths that contain spaces?  I love this
completion method, but as soon as I get to C:\Document and Settings\,
it stops working, because of course a space character is not in
'isfname' (so it tries to complete just Settings), and putting it in
makes no sense (Vim won't know where the path starts).  How do you
deal with it?  Or is there simply no hope?


I think you can add space to isfname, but then you need
to make sure your pathnames are all either (1) double-quoted, or
(2) surrounded by some other char that can't be in the pathname, like '|',
or (3) are on the line by themselves. Maybe there are other solutions.

Yakov


Re: Re-trigger modelines

2007-05-12 Thread Yakov Lerner

On 5/12/07, Steve Hall [EMAIL PROTECTED] wrote:


Is there a way to re-trigger the read/execution of modelines? My
autocommands are overriding my modelines but I want the reverse.


Maybe you add global flag check to your autocommands;
the flag that when set, suppresses your suppression, and then you
set this flag:
   :let g:my_nomodelines=0
and then
  :e
?
Yakov


Re: [Announcement] Subversion repository location changed

2007-05-09 Thread Yakov Lerner

On 5/9/07, Edward L. Fox [EMAIL PROTECTED] wrote:

If you had checked out a copy of the sources before, please run this
command in your source root directory to switch into the current
branch:

svn switch https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.1


This switch command gives me error:

$ cd vim7
$ svn info
Path: .
URL: https://svn.sourceforge.net/svnroot/vim/vim7
Repository Root: https://svn.sourceforge.net/svnroot/vim
Repository UUID: 2a77ed30-b011-0410-a7ad-c7884a0aa172
Revision: 263
Node Kind: directory
Schedule: normal
Last Changed Author: edyfox
Last Changed Rev: 263
Last Changed Date: 2007-05-06 23:13:56 -0400 (Sun, 06 May 2007)
$ svn switch https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.1
svn: 'https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.1'
is not the same repository as
'https://svn.sourceforge.net/svnroot/vim'

What am I doign wrong ?

Yakov


Re: what feature is required to return to last editing position?

2007-05-09 Thread Yakov Lerner

On 5/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:



When opening a file in vim, the cursor will move to the last position when
the file was saved.

The feature is enabled by some autocommands in vimrc_example.vim, I
copied the code into my .vimrc and use it in all platform.

It really does work in my WindowsXP gvim, cygwin vim, MacOSX vim, and
Ubuntu Dapper vim.

Recently I installed Ubuntu Feisty and the feature seems to have gone (I
installed vim-gnome version 7.0.135). Since I use the same .vimrc in all
platform, it is unlikely to be the fault of my .vimrc script, the problem
is I do not know how to debug vim script, and I don't know why that
autocommand does not work.

Any idea where is the problem, or any hint on how to find where the problem
is?


The simplest way to fix this is to add this line to your .vimrc:

  $VIMRUNTIME/vimrc_example.vim

Another, more difficult method is documented under

:help restore-cursor

Yakov


Re: [Announcement] Subversion repository location changed

2007-05-09 Thread Yakov Lerner

On 5/9/07, Edward L. Fox [EMAIL PROTECTED] wrote:

If you had checked out a copy of the sources before, please run this
command in your source root directory to switch into the current
branch:

svn switch https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.1


This switch command gives me error:

$ cd vim7
$ svn info
Path: .
URL: https://svn.sourceforge.net/svnroot/vim/vim7
Repository Root: https://svn.sourceforge.net/svnroot/vim
Repository UUID: 2a77ed30-b011-0410-a7ad-c7884a0aa172
Revision: 263
Node Kind: directory
Schedule: normal
Last Changed Author: edyfox
Last Changed Rev: 263
Last Changed Date: 2007-05-06 23:13:56 -0400 (Sun, 06 May 2007)
$ svn switch https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.1
svn: 'https://vim.svn.sourceforge.net/svnroot/vim/branches/vim7.1'
is not the same repository as
'https://svn.sourceforge.net/svnroot/vim'

What am I doign wrong ?

Yakov


Vim version 7.1a BETA -- runtime files ?

2007-05-07 Thread Yakov Lerner

On 5/5/07, Bram Moolenaar [EMAIL PROTECTED] wrote:

Announcing:  Vim (Vi IMproved) version 7.1a BETA


I compared runtime files form ftp [1] and from svn [2].
Both vims are labeled vim71a. But many runtimes are different.
In svn, many files are labeled 2007. In ftp, they are 2006 versions.
Why this difference in runtimes ?

Yakov
[1] ftp://ftp.vim.org/pub/vim/unstable/unix/vim-7.1a.tar.bz2
[2] https://svn.sourceforge.net/svnroot/vim/vim7


Re: Vim version 7.1a BETA -- runtime files ?

2007-05-07 Thread Yakov Lerner

On 5/8/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


Yakov Lerner wrote:

 On 5/5/07, Bram Moolenaar [EMAIL PROTECTED] wrote:
  Announcing:  Vim (Vi IMproved) version 7.1a BETA

 I compared runtime files form ftp [1] and from svn [2].
 Both vims are labeled vim71a. But many runtimes are different.
 In svn, many files are labeled 2007. In ftp, they are 2006 versions.
 Why this difference in runtimes ?

 Yakov
 [1] ftp://ftp.vim.org/pub/vim/unstable/unix/vim-7.1a.tar.bz2
 [2] https://svn.sourceforge.net/svnroot/vim/vim7

Do I need to hunt down the differences?  Please give a specific example.
What label are you talking about?


At closer examination, differences turned out to be in $Id..$, $Revision..$
$Date...$ lines only, except for one file which has read differences:
runtime/autoload/spellfile.vim -- see diffs below.
By labels I meant the cvs  $Id...$ keywords and other $..$ keywords.
Full diffs are attached. Diffs are produced by the script diff-vim-ftp-svn.sh,
also attached.


diff -r --exclude=.svn
/var/tmp/vim-untar/vim71a/runtime/autoload/spellfile.vim
/var/tmp/vim-svn/vim7/runtime/autoload/spellfile.vim
3c3
  Last Change:2006 Aug 29
---

 Last Change:2007 May 06

60a61

 Remember the buffer number, we check it below.

61a63

let newbufnr = winbufnr(0)

67c69,88
   g/^/d
---

   Careful: Nread() may have opened a new window for the error message,
   we need to go back to our own buffer and window.
  if newbufnr != winbufnr(0)
  let winnr = bufwinnr(newbufnr)
  if winnr == -1
 Our buffer has vanished!?  Open a new window.
echomsg download buffer disappeared, opening a new one
new
setlocal bin
  else
exe winnr . wincmd w
  endif
  endif
  if newbufnr == winbufnr(0)
   We are back the old buffer, remove any (half-finished) download.
g/^/d
  else
  let newbufnr = winbufnr(0)
  endif


73c94
   bwipe!
---

  exe newbufnr . bwipe!

99,101c120
   if getline(2) !~ 'VIMsug'
 echo 'Sorry, downloading failed'
   else
---

  if getline(2) =~ 'VIMsug'

103a123,136

set nomod
  else
echo 'Sorry, downloading failed'
 Go back to our own buffer/window, Nread() may have taken us to
 another window.
if newbufnr != winbufnr(0)
  let winnr = bufwinnr(newbufnr)
  if winnr != -1
exe winnr . wincmd w
  endif
endif
if newbufnr == winbufnr(0)
  set nomod
endif

105d137
   set nomod
109c141,142
 bwipe
---

 Wipe out the buffer we used.
exe newbufnr . bwipe


diffs
Description: Binary data


diff-vim-ftp-svn.sh
Description: Bourne shell script


Re: Vim version 7.1a BETA -- runtime files ?

2007-05-07 Thread Yakov Lerner

On 5/8/07, Yakov Lerner [EMAIL PROTECTED] wrote:

Full diffs are attached. Diffs are produced by the script diff-vim-ftp-svn.sh,
also attached.


Re-sending attachments which came out zero-length in previous email.

Yakov


diffs
Description: Binary data


diff-vim-ftp-svn.sh
Description: Bourne shell script


filename completion

2007-05-07 Thread Yakov Lerner

Let's say I want to see which files end with t. When I do
 :e *ttab
vim shows not only files anding with t but all files
containing t, as if I did :e *t*Tab.
How can I limit the filename completion only to files ending with t ?

Yakov


Re: Vim version 7.1a BETA -- svn ?

2007-05-06 Thread Yakov Lerner

On 5/6/07, Martin Krischik [EMAIL PROTECTED] wrote:

Am Sonntag 06 Mai 2007 schrieb Yakov Lerner:

 On 2007-05-05, Bram Moolenaar [EMAIL PROTECTED] wrote:
  Announcing:  Vim (Vi IMproved) version 7.1a BETA

 I tried to build vim7.1 from svn. But all I get from usual
 svn location (https://svn.sourceforge.net/svnroot/vim/vim7), is
 vim 7.0.236. Will vim7.1 be served at this localtion eventually ?

That is probalby because the svn server is a mess.


I have to disagree. The svn maintainer does valuable service
to the community. The svn service is really stable, unlike the cvs server.
I'd like to really thank the svn updater for keeping the svn updated.

The reason why updates did not make it to svn was that cvs
server was down, as Bram explained above.

Yakov


Re: how to enable mouse in vim of cygwin

2007-05-04 Thread Yakov Lerner

On 5/4/07, sun [EMAIL PROTECTED] wrote:

 I'm using cygwin and rxvt. It works quite well, since you don't need to
 start an X server for the application - it just runs.

 Put the following in your cygwin launcher (cygwin_rxvt.bat for me):

   @echo off
   C:
   chdir C:\cygwin\bin
   set SHELL=/bin/bash
   rxvt -ls -sr -sl 1500 -fn Lucida ConsoleP-12 -bg black -fg grey

 and in your .bashrc:

   export TERM=rxvt-cygwin-native

 your mouse should work fine with rxvt (mine does!)

 Cheers

yes, I like this way. But when I open the vim, it is extremely slow,
it needs about half minute to open a file, what is the problem?


try 'vim -X'

Yakov


[patch] search() flag to not use smartcase

2007-05-03 Thread Yakov Lerner

The patch adds flag to search() flag to not use smartcase.
'*' and '#' do not use smartcase, but search() always uses smartcase
(cannot be turned off).
When we use search() with @/ pattern that comes from * or #,
search() fails because of discrepancy in smartcase handling.

Yakov

--- runtime/doc/eval.txt.0002007-05-03 09:35:19.0 -0400
+++ runtime/doc/eval.txt2007-05-03 09:36:21.0 -0400
@@ -4086,6 +4086,7 @@
   'n' do Not move the cursor
   'p' return number of matching sub-pattern (see below)
   's' set the ' mark at the previous location of the cursor
+   'S' do not use smartcase
   'w' wrap around the end of the file
   'W' don't wrap around the end of the file
   If neither 'w' or 'W' is given, the 'wrapscan' option applies.
--- src/eval.c.000  2007-05-03 09:07:52.0 -0400
+++ src/eval.c  2007-05-03 09:34:50.0 -0400
@@ -13813,6 +13813,7 @@
   case 'b': dir = BACKWARD; break;
   case 'w': p_ws = TRUE; break;
   case 'W': p_ws = FALSE; break;
+   case 'S': no_smartcase = TRUE; break;
   default:  mask = 0;
 if (flagsp != NULL)
switch (*flags)


Re: [patch] search() flag to not use smartcase

2007-05-03 Thread Yakov Lerner

On 5/3/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


Yakov Lerner wrote:

 The patch adds flag to search() flag to not use smartcase.
 '*' and '#' do not use smartcase, but search() always uses smartcase
 (cannot be turned off).
 When we use search() with @/ pattern that comes from * or #,
 search() fails because of discrepancy in smartcase handling.

 Yakov

 --- runtime/doc/eval.txt.0002007-05-03 09:35:19.0 -0400
 +++ runtime/doc/eval.txt2007-05-03 09:36:21.0 -0400
 @@ -4086,6 +4086,7 @@
 'n' do Not move the cursor
 'p' return number of matching sub-pattern (see below)
 's' set the ' mark at the previous location of the cursor
 +   'S' do not use smartcase
 'w' wrap around the end of the file
 'W' don't wrap around the end of the file
 If neither 'w' or 'W' is given, the 'wrapscan' option applies.

Looks a bit inconsistent.  Why not also add a flag to ignore
'ignorecase' and 'magic'?


Yes. After I sent out a patch, I realized I can fix my problem
by saving,clearing, and restoring the 'smartcase' option. Sorry.

Yakov


Re: wish: show search progress on slow searches

2007-05-03 Thread Yakov Lerner

On 5/1/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/30/07, Bram Moolenaar [EMAIL PROTECTED] wrote:

 [This is development, removed the Vim maillist]

 Yakov Lerner wrote:

  On 4/29/07, Yakov Lerner [EMAIL PROTECTED] wrote:
   On 4/29/07, Bram Moolenaar [EMAIL PROTECTED] wrote:
   
Yakov Lerner wrote:
   
 Wish: when search is slow, show the progress line number
 every second on the bottom line (like, 12345 of 9).
   
What is slow?
   To my taste, when something takes longer than 1-2 sec,
   I'd prefer some visual feedback on the progress.
  
Checking if the second passed will make the search even slower.
Checking time is quite slow on some systems (the check for CTRL-C
suffers from this).
  
   Checking for time every several hundred (N) lines will probably not slow
   the search perceptibly. N can be configurable, a parameter.
   Some value between 10 and 1000 will probaby be reasonable.
 
  I think it's possibe to check for time, which searching, not too
  often and not too seldom, even without user-defined parameter.
  Adaptive algorithm with two counters will find the right rate or
  time-checking:
 
  - as we start search, we check time every 50 lines
  (N=50 is initial value of N). We maintain counter M. M is how
  many times we called time() between the seconds changed.
  M is checked and reset every second. M is checked as folllows:
 
  - If M is too high (M10), then we adjust N by increasing it.
  If M is too low(M10), then we adjust N by decreasing it. Ideally,
  we want to check time() ~10 times per second. (overhead of 10
  calls to time() per second cannot he high, right ?)
 
  - if search progresses for several seconds, then N quickly converges
  to the ideal value (~10 checks/sec).
 
  - we start every search with same value of N (say, 50). If search
  is slow, then N will quickly converge to the ideal value for this regex,
  the value in which where time() is checked ~10 times per second.

 It will help for differences in speed for various patterns, but it won't
 help for lines differing in length.  Quite a few patterns with wildcards
 depend on the line length a lot.

 It might work better to adjust to the delay caused by the time
 function.  This varies greatly between systems.  When it's fast we can
 check the time often, when it's slow it delays the search more and
 should be called less often.

How about using SIGALRM when search is progressing, every second ?
SIGALRM handler would store time() into global var (and reload alarm(1)).
The search would check the global var for changes, every line.
It is cheap to check global integer (time_t) var, no ?


What do you think about SIGALRM, Bram ?

Yakov


Re: undo line numbers wrong

2007-05-03 Thread Yakov Lerner

On 5/2/07, Robert Cussons [EMAIL PROTECTED] wrote:

Yakov Lerner wrote:
 On 5/2/07, Robert Cussons [EMAIL PROTECTED] wrote:

 Yakov Lerner wrote:
  On 4/27/07, Robert Cussons [EMAIL PROTECTED] wrote:
 
  Thanks Tony, doubt he'll be that interested as he's an emacs user! But
  anyway some time next week I will try and convince him.
 
 
  You can install latest vim under your $HOME -- this does not
  require any root privileges -- with a single command, a script
  'vim7-install.sh'.
 
  Script vim7-install.sh is at
 
 http://www.vim.org/scripts/script.php?script_id=1473
 vim7-install.sh : {download + build + install} latest vim7 [from
  svn sources] in 1 command
 
  Yakov
 

 Thanks very much Yakov, just done that and it seems to have worked fine,
 there's just a couple of curious things:

 1) below is the first part of the output, what are the errors right at
 the bottom of this part?

 [EMAIL PROTECTED]:~$ sh ./vim7-install.sh
 This will download, build and install vim7 (using svn).
 Select one of the following:
 1) You know root password and you want to install
 vim globally for all users on this computer
 (into /usr/local/bin)
 2) You do not know root password or you want to
 install vim under your $HOME/bin directory
 2
 # previously downloaded source found.
  * checking for locally modified files ...
  Found locally modified files
 (dir=/var/tmp/user4046/vim7_from_svn/vim7) *
 M  src/auto/config.mk
  Found locally modified files
 (dir=/var/tmp/user4046/vim7_from_svn/vim7) *
 Select (1) Discard local changes (2) Keep local changes [1] ?
 2
 + cd /var/tmp/user4046/vim7_from_svn/vim7
 + svn up
 Error validating server certificate for
 'https://svn.sourceforge.net:443':
   - The certificate is not issued by a trusted authority. Use the
 fingerprint to validate the certificate manually!
 Certificate information:
   - Hostname: *.sourceforge.net
   - Valid: from Jan 17 18:17:01 2007 GMT until Mar 18 18:17:01 2008 GMT
   - Issuer: Equifax Secure Certificate Authority, Equifax, US
   - Fingerprint:
 a1:3a:51:83:60:5e:81:07:be:6c:06:d1:db:34:9b:d8:b9:40:b5:d0
 (R)eject, accept (t)emporarily or accept (p)ermanently? p
 svn: PROPFIND request failed on '/svnroot/vim/vim7'
 svn: PROPFIND of '/svnroot/vim/vim7': Could not read status line: Secure
 connection truncated (https://svn.sourceforge.net)
 svn returned error(s). Press Enter to continue, Ctrl-C to stop

 2) it says I should validate the certificate manually, but how do you
 actually go about doing that?

 3) the final part of the output is as follows:

 make[1]: Leaving directory `/var/tmp/user4046/vim7_from_svn/vim7/src'
 Build and install successful

 ***
 ***
  Warning: directory $HOME/bin is not in you PATH!
  You need to add directory $HOME/bin to your PATH to run new vim


 but if I do the following:
 [EMAIL PROTECTED]:~/bin$ echo $HOME
 /the/cussons
 [EMAIL PROTECTED]:~/bin$ echo $PATH
 
/usr/the_local/bin/:/usr/bin/:/the/cussons/bin/:/usr/local/bin:/bin:/usr/bin/X11:/usr/games:/the/cussons/bin/clewn/:/the/cussons/LeoScript/crudeleo-1.9/


 you can see that $HOME/bin is in my PATH, therefore, does your error
 message actually mean that as there is a version of vim in /usr/bin/
 that this one will be loaded first and therefore, I should place
 /the/cussons/bin/ before it in the PATH to give it preference?


 1. Just answer 'p' to accept the certificate permanently.
 2. The check for $HOME/bin in the path is not comlpete indeed.

 a) Type 'type vim' in bash to see which vim is taken, one from
 your /usr/bin or from $HOME/bin.

 b) Put $HOME/bin to the *front* of your path, before /usr/bin and before
 /usr/local/bin and before all other dirs that might contain other
 version of vim.

 c) Additionally,  put this in your .bashrc:
  alias vim=$HOME/bin/vim'

 d) I recommend that you do both (b) and (c), and then check 'type vim'
 again.


 I will need to fix vim7-install.sh to fix that $HOME/bin in the end.
 I need to check that $HOME/bin is before other /usr/* dirs,
 not only *somewhere* in the PATH. Somewhere in the PATH
 is not good check. In your case, script was confused by the trailing
 slash in $HOME/bin/, it expects $HOME/bin. I'll fix that, too. Thanks
 for reporting.

 Yakov


Thanks for the utility, had already resolved the problems with the PATH
just thought I should let you know.

Is the part below in the error just to do with the certificate, or
something else?

svn: PROPFIND request failed on '/svnroot/vim/vim7'
svn: PROPFIND of '/svnroot/vim/vim7': Could not read status line: Secure
connection truncated (https://svn.sourceforge.net)
svn returned error(s). Press Enter to continue, Ctrl-C to stop


Also what does it mean by manually validating the certificate, it is not
relevant to this install, but just wondering if anyone out there knows
what it means?

Error validating server certificate for
'https

Re: savevers plugin

2007-05-03 Thread Yakov Lerner

On 5/3/07, Waters, Bill [EMAIL PROTECTED] wrote:

I am looking at using the savevers plugin.  I don't think it does
exactly what I am looking for.


Why don't you set savevers_max to 9 ?
Do you plan to have more than 9 versions ? (if I underdtand
your request right).

Otherwise, your request sounds strange. It sounds like this:
I want to set savevers_max to 3, and I want savevers to ignore this.

It's like I want vim to go to line 10 when I tell him to go to line 5.

Why would you want to set savevers_max to wrong value instead of
desired value (999) in the first place ?

Yakov


I want the old version of my file to be
saved regardless of what savevers_max is set to.  If I set savevers_max
to three and I save for the fourth time, I want the oldest, saved
version of the file to be deleted and I want my latest last-version to
be saved.

My files would go from this...

-rw-r- 1 eralston admin  226 Sep 20 11:43 test.txt
-rw-r- 1 eralston admin  102 Sep 20 11:12 test.txt.0001.clean
-rw-r- 1 eralston admin  106 Sep 20 11:14 test.txt.0002.clean
-rw-r- 1 eralston admin  132 Sep 20 11:22 test.txt.0003.clean

To this...

-rw-r- 1 eralston admin  226 Sep 20 11:43 test.txt
-rw-r- 1 eralston admin  106 Sep 20 11:14 test.txt.0002.clean
-rw-r- 1 eralston admin  132 Sep 20 11:22 test.txt.0003.clean
-rw-r- 1 eralston admin  148 Sep 20 11:34 test.txt.0004.clean

Anyway to do this?  Anybody already hacked savevers to do this?  Or have
some clever mappings to handle this?

A related question... is there a way to use a single backup directory
for all files?  I think it would need to have a way to make all file
names unique.  So that saving /dir1/a.txt wouldn't clobber over
/dir2/a.txt.

Thanks,
Bill



Re: how to enable mouse in vim of cygwin

2007-05-03 Thread Yakov Lerner

On 4/18/07, sun [EMAIL PROTECTED] wrote:

hello,

I know that both vim and gvim can jump from one window to another by
clicking the mouse, also many other easy facilities.
Here I am using cygwin under XP and my gvim works fine with mouse, but
the vim doesn't in both cmd.ext environment and xterm cases.


You need to set ':set mouse=all'. Then your vim-in-xterm will
reacti to the mouse.

The cmd box is different case, I beleive that mouse events are
not passed to vim in cmd box.

Yakov


Re: wish: show search progress on slow searches

2007-05-01 Thread Yakov Lerner

On 4/30/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


[This is development, removed the Vim maillist]

Yakov Lerner wrote:

 On 4/29/07, Yakov Lerner [EMAIL PROTECTED] wrote:
  On 4/29/07, Bram Moolenaar [EMAIL PROTECTED] wrote:
  
   Yakov Lerner wrote:
  
Wish: when search is slow, show the progress line number
every second on the bottom line (like, 12345 of 9).
  
   What is slow?
  To my taste, when something takes longer than 1-2 sec,
  I'd prefer some visual feedback on the progress.
 
   Checking if the second passed will make the search even slower.
   Checking time is quite slow on some systems (the check for CTRL-C
   suffers from this).
 
  Checking for time every several hundred (N) lines will probably not slow
  the search perceptibly. N can be configurable, a parameter.
  Some value between 10 and 1000 will probaby be reasonable.

 I think it's possibe to check for time, which searching, not too
 often and not too seldom, even without user-defined parameter.
 Adaptive algorithm with two counters will find the right rate or
 time-checking:

 - as we start search, we check time every 50 lines
 (N=50 is initial value of N). We maintain counter M. M is how
 many times we called time() between the seconds changed.
 M is checked and reset every second. M is checked as folllows:

 - If M is too high (M10), then we adjust N by increasing it.
 If M is too low(M10), then we adjust N by decreasing it. Ideally,
 we want to check time() ~10 times per second. (overhead of 10
 calls to time() per second cannot he high, right ?)

 - if search progresses for several seconds, then N quickly converges
 to the ideal value (~10 checks/sec).

 - we start every search with same value of N (say, 50). If search
 is slow, then N will quickly converge to the ideal value for this regex,
 the value in which where time() is checked ~10 times per second.

It will help for differences in speed for various patterns, but it won't
help for lines differing in length.  Quite a few patterns with wildcards
depend on the line length a lot.

It might work better to adjust to the delay caused by the time
function.  This varies greatly between systems.  When it's fast we can
check the time often, when it's slow it delays the search more and
should be called less often.


How about using SIGALRM when search is progressing, every second ?
SIGALRM handler would store time() into global var (and reload alarm(1)).
The search would check the global var for changes, every line.
It is cheap to check global integer (time_t) var, no ?

Yakov


Re: determining if buffer is modified.. etc

2007-05-01 Thread Yakov Lerner

On 4/30/07, Normandie Azucena [EMAIL PROTECTED] wrote:

-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED]
Sent: Monday, April 30, 2007 1:53 PM
To: Normandie Azucena
Cc: vim@vim.org
Subject: Re: determining if buffer is modified.. etc

On 4/30/07, Normandie Azucena [EMAIL PROTECTED] wrote:
 hi all!

 I need to know if a certain buffer is modified. how can I do this?

if modified | echo buffer is modified | endif

 also can I disable the prompt that says that buffer or file has
changed
 and gives me an option to load the new file or not? because I want vim
 to automatically load changed files at certain times(i.e. when I
invoke
 a certain function that automatically change the contents of the
files)

Add exclamation mark to the command

Yakov

hi yakov!
tnx for the info.

however about my 2nd question, what I wanted to know is this scenario

I have a file lets say myfile.
its currently open to a buffer.
but then I input this file to a perl script then save the results
what vim will do is prompt me that my file changed and make me choose to
load it or not (because it is open in a buffer).
This scenario is what I don't want to happen because obviously it was
really my intention to change the file in the first place.

can I disable this prompt somehow?


:set autoread

Yakov


Re: wish: show search progress on slow searches

2007-04-30 Thread Yakov Lerner

On 4/29/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/29/07, Bram Moolenaar [EMAIL PROTECTED] wrote:

 Yakov Lerner wrote:

  Wish: when search is slow, show the progress line number
  every second on the bottom line (like, 12345 of 9).

 What is slow?
To my taste, when something takes longer than 1-2 sec,
I'd prefer some visual feedback on the progress.

 Checking if the second passed will make the search even slower.
 Checking time is quite slow on some systems (the check for CTRL-C
 suffers from this).

Checking for time every several hundred (N) lines will probably not slow
the search perceptibly. N can be configurable, a parameter.
Some value between 10 and 1000 will probaby be reasonable.

Yakov



I think it's possibe to check for time, which searching, not too
often and not too seldom, even without user-defined parameter.
Adaptive algorithm with two counters will find the right rate or
time-checking:

- as we start search, we check time every 50 lines
(N=50 is initial value of N). We maintain counter M. M is how
many times we called time() between the seconds changed.
M is checked and reset every second. M is checked as folllows:

- If M is too high (M10), then we adjust N by increasing it.
If M is too low(M10), then we adjust N by decreasing it. Ideally,
we want to check time() ~10 times per second. (overhead of 10
calls to time() per second cannot he high, right ?)

- if search progresses for several seconds, then N quickly converges
to the ideal value (~10 checks/sec).

- we start every search with same value of N (say, 50). If search
is slow, then N will quickly converge to the ideal value for this regex,
the value in which where time() is checked ~10 times per second.

Yakov


Re: wish: show search progress on slow searches

2007-04-30 Thread Yakov Lerner

On 4/29/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/29/07, Bram Moolenaar [EMAIL PROTECTED] wrote:

 Yakov Lerner wrote:

  Wish: when search is slow, show the progress line number
  every second on the bottom line (like, 12345 of 9).

 What is slow?
To my taste, when something takes longer than 1-2 sec,
I'd prefer some visual feedback on the progress.

 Checking if the second passed will make the search even slower.
 Checking time is quite slow on some systems (the check for CTRL-C
 suffers from this).

Checking for time every several hundred (N) lines will probably not slow
the search perceptibly. N can be configurable, a parameter.
Some value between 10 and 1000 will probaby be reasonable.

Yakov



I think it's possibe to check for time, which searching, not too
often and not too seldom, even without user-defined parameter.
Adaptive algorithm with two counters will find the right rate or
time-checking:

- as we start search, we check time every 50 lines
(N=50 is initial value of N). We maintain counter M. M is how
many times we called time() between the seconds changed.
M is checked and reset every second. M is checked as folllows:

- If M is too high (M10), then we adjust N by increasing it.
If M is too low(M10), then we adjust N by decreasing it. Ideally,
we want to check time() ~10 times per second. (overhead of 10
calls to time() per second cannot he high, right ?)

- if search progresses for several seconds, then N quickly converges
to the ideal value (~10 checks/sec).

- we start every search with same value of N (say, 50). If search
is slow, then N will quickly converge to the ideal value for this regex,
the value in which where time() is checked ~10 times per second.

Yakov


Re: wish: show search progress on slow searches

2007-04-29 Thread Yakov Lerner

On 4/29/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


Yakov Lerner wrote:

 Wish: when search is slow, show the progress line number
 every second on the bottom line (like, 12345 of 9).

What is slow?

To my taste, when something takes longer than 1-2 sec,
I'd prefer some visual feedback on the progress.


Checking if the second passed will make the search even slower.
Checking time is quite slow on some systems (the check for CTRL-C
suffers from this).


Checking for time every several hundred (N) lines will probably not slow
the search perceptibly. N can be configurable, a parameter.
Some value between 10 and 1000 will probaby be reasonable.

Yakov


moving virual rectange about in virtualedit mode

2007-04-29 Thread Yakov Lerner

I 'set ve=all' and selected a rectangle with Ctrl-V.
How can I move this rectangle up/down left/right with arrows ?

Thanks
Yakov


Re: wish: show search progress on slow searches

2007-04-29 Thread Yakov Lerner

On 4/29/07, Bram Moolenaar [EMAIL PROTECTED] wrote:


Yakov Lerner wrote:

 Wish: when search is slow, show the progress line number
 every second on the bottom line (like, 12345 of 9).

What is slow?

To my taste, when something takes longer than 1-2 sec,
I'd prefer some visual feedback on the progress.


Checking if the second passed will make the search even slower.
Checking time is quite slow on some systems (the check for CTRL-C
suffers from this).


Checking for time every several hundred (N) lines will probably not slow
the search perceptibly. N can be configurable, a parameter.
Some value between 10 and 1000 will probaby be reasonable.

Yakov


Re: moving virual rectange about in virtualedit mode

2007-04-29 Thread Yakov Lerner

On 4/30/07, Sartak [EMAIL PROTECTED] wrote:

On 4/29/07, Yakov Lerner [EMAIL PROTECTED] wrote:
 I 'set ve=all' and selected a rectangle with Ctrl-V.
 How can I move this rectangle up/down left/right with arrows ?

 Thanks
 Yakov


I assume you're asking how you can move the other sides of a visual
block. When you're using visual block you usually have control of only
one corner (southwest for me most of the time, but it could be any of
the four). You can use the o and O commands to start moving different
corners. Note that the o command also works in the other two visual
modes, and so is very handy.


No, I meant move as in, erase in old place and paint in new place.

Yakov


Re: Backup - always

2007-04-29 Thread Yakov Lerner

On 4/30/07, Fredrik Gustafsson [EMAIL PROTECTED] wrote:

Hi,
I'm looking for a way to always backup certain filetypes. The backup and
writebackup options only works if the file exist. I need a backup even
if I create a new file (i.e. the new file should be saved at two
locations).

how do I do that?


Try using the autocommand:
au BufWrite *.abc,*.def :exe :w! /my/other/dir/.expand(%:t)
(untested).

Alternatively, you can try the 'savevers' plugin:
 http://www.vim.org/scripts/script.php

Yakov


Re: vim 7.1?

2007-04-27 Thread Yakov Lerner

The svn tree has all patches already inside, it does not matter
how many patches are there. You just checkout and build.
It's not that you need to download baseline and then 222 patches, no.

Yakov

On 4/27/07, Jonathan Smith [EMAIL PROTECTED] wrote:

With the insane number of patches collecting against 7.0, and presumably the new
features accumulating in the devel tree, is anyone thinking about when a 7.1
release might be made?

-smithj



change background for range of lines

2007-04-25 Thread Yakov Lerner

Is is possible to change background for range of lines
without suppressing the other syntax highlighting in the range ?

   (I tried something simpler and less useful - match
   by range of lines (:match Search /\%123l\_.*\%999l/ which
   suppresses highlighting in the region) but even this did
   not work when the range if bigger than 1-2 screens (this
   is by design as Bram explained)

Yakov


Re: Mapping to c-q and c-s doesn't work

2007-04-25 Thread Yakov Lerner

On 4/25/07, Mike Mazur [EMAIL PROTECTED] wrote:

Hi,

I'm running vim in a console using gnome-terminal. I put these
mappings in my .vimrc file:

map c-q :mksession! ~/.vim/.session cr
map c-s :source ~/.vim/.session cr

Pressing those buttons (CTRL+Q or CTRL+S) doesn't work. When I map as
below instead:

map F9 :mksession! ~/.vim/.session cr
map F10 :source ~/.vim/.session cr

the commands work.

What is causing this behavior? Is it the terminal capturing the CTRL+Q
and CTRL+S keystrokes before they reach VIM?


Yes. You can try kde konsole. In konsole, ^Q and ^S and not
treated specially by default. You can remap them in vim.
Your terminal emulator, if it has menus, then the option that affects
^Q and ^S will be named something like flow control or XON/XOFF.

Yakov


Re: replace VimScript (was: wish: allow a: in the function def)

2007-04-24 Thread Yakov Lerner

On 4/24/07, Ilya Sher [EMAIL PROTECTED] wrote:

Robert Lee wrote:
 [snip]

 Counterwish #2: Dump VimScript and replace it with EMCAScript (maybe
 using SpiderMonkey) so that people don't need to learn a new language


As a sarcastic joke, this sounds average. But seriously, vim
having supprt for embedded perl,python,ruby, tcl and scheme
interpreters, it is realistically to expect javascript interpreter added
one day.

Yakov


Re: replace VimScript (was: wish: allow a: in the function def)

2007-04-24 Thread Yakov Lerner

On 4/24/07, Gregory Seidman [EMAIL PROTECTED] wrote:

On Tue, Apr 24, 2007 at 05:49:19PM +0200, Nikolai Weibull wrote:
 On 4/24/07, Gregory Seidman [EMAIL PROTECTED] wrote:
 On Tue, Apr 24, 2007 at 10:49:49AM +0300, Ilya Sher wrote:
  Robert Lee wrote:
  [snip]
   Counterwish #2: Dump VimScript and replace it with EMCAScript (maybe
   using SpiderMonkey) so that people don't need to learn a new language
  If I understand you correctly, you assume that
  ECMAScript is the most popular language among
  the people that wish to customize VIM. How
  do you know the assumption is right?
  [snip]
 
 Actually, I like the proposal for two entirely different reasons:
 
 1) the language specification comes from an international standards body

 So?  In what way does this make it a good language?  In what way does
 this make it a good language to extend Vim with?  Anyone can write a
 standard.  It doesn't mean that it's good or what is being
 standardized will be, either.

Where did anyone say that standardization made it a better language than
any other? Most of what makes it a good language has been there since the
earliest JavaScript implementations. Many of the issues that have made it
difficult to work with in the past have been hammered out during
standardization or were API issues rather than language issues.

But even that isn't what standardization buys you. The main advantage is
interoperability. If someone writes some excellent library for use in some
Flash app, but is of use in some other environment that provides ECMAScript
extension, you can just copy it over and use it. I'm capable of porting an
algorithm in one language I know to another language I know, but that's a
bit more work than copy and paste.

 2) there are lots of people working on efficient implementations, at least
two of which are open source (SpiderMonkey and Adobe's Tamarin, though
there seem to be some plans to convert SpiderMonkey to use Tamarin)

 SpiderMonkey is a terribly inefficient implementation, which is why
 Tamarin will be used in future versions of Gecko.  And I wouldn't say
 that efficiency is the primary concern of a language/runtime engine to
 use for Vim.

I strongly disagree with that statement. Efficiency is certainly important
for an editor. I don't want to sit and twiddle my thumbs while vim starts
up or executes hooks on file read, nor do I want it to suck up a big chunk
of memory while it's going about its business. In fact, what I'm asking it
to do currently rarely takes much time, but it could be really nice to ask
it to do a lot more and still not pay a huge time or memory penalty.
Efficiency is definitely important.

 It is looking more and more like the world of scripting languages for
 application extension (as opposed to standalone scripting languages) is
 converging on ECMAScript and Lua, particularly for interactive apps.

 I'm sure Microsoft agrees with this sentiment.

What does Microsoft have to do with anything?

 There's a lot to be said for following a path that leads to
 interoperability and code reuse.

 Yeah, follow-the-leader is everyone's favorite game.  And just look at
 all the libraries for both these languages.  Application extension may
 sometimes be restricted to the domain of the actual application, but
 having an abundance of libraries certainly opens up for more
 interesting possibilities.

Vim already has Perl, Python, and Ruby interpreters for application
extension, assuming you build it with the appropriate options. Any library
available for any of these languages can be made available to the Vim
runtime with minimal hassle. Are there lots of VimScript libraries that are
outside the application domain? So how does replacing VimScript with
ECMAScript prevent these interesting possibilities?


Cool down. vimscript replacing with EcmaScript is not on the horizon,
is not on the agenda, not going to happen.

The only alternative to vimscript that Bram once contemplated
was python, and it was  decisively voted down by feature voting.
(Python was considered at one point by Bram because Python is
Bram's favourite language.)

So do not worry, replacement of vimscript by the favourite language
of some vim's random user is not going to happen.

Yakov


Re: coredump with match by lines-range (7.0.222); highlighting is not painted fully.

2007-04-24 Thread Yakov Lerner

On 4/24/07, Bram Moolenaar [EMAIL PROTECTED] wrote:

Multi-line matches are not always displayed correctly.  A match is
searched for in the line where redrawing starts, which can be anywhere.
Your pattern only matches when redrawing starts at or before line 4078.


Maybe we need a pattern that matches at line =N and at line =N then ?
(say \%123l   \%123l, in addition to ==N, the \%123l).
Or is there other way to highlight block of lines ?

Thanks


Re: wish: collaboration of N vim instances editing same file

2007-04-23 Thread Yakov Lerner

On 4/23/07, Gene Kwiecinski [EMAIL PROTECTED] wrote:

I can't think of any valid reason why one lonely user - me for
instance
- would want to fire up several instances of vim to edit the same
file.

It can be. For example, in LNX user can edit file in text console,
then switch to X11 and then start editor again to edit the same file,
forgetting that other instance of VIM already launched. I in this case
just do killall  vim(or killall -9 vim, depending on mood).

I'd be seriously uncomfortable with that as a feature.  Imagine
absentmindedly editing the same file 2x or more.  Make some changes in
one instance, make different changes in another instance, save/quit the
first, save/quit the second, trash all the edits made in the first
instance.


In the orininal post, I wrote about the feature where two+ instances
of vim show and merge changes made by other instances. With
such collaboration enabled, the 2nd instance would show and merge
changes made by 1st instance, and 1st instance would absorb, merge
and show changes made by 2nd instance. In this scenario, loss of
edits does not happen. So I don't underastand why you say you are
against it if it avoids exactly what you cited as unwanted ?

Yakov Lerner wrote


-- Ability of N instances of vim to absorb, merge and show changes
to the same file made by other running vim instances


Yakov


Re: turning arbitrary word change into substitution

2007-04-23 Thread Yakov Lerner

On 4/22/07, Tim Chase [EMAIL PROTECTED] wrote:

 Is it possible to do the following, or maybe some plugin
 already exist. If not, how would I script it. Let's say I have
 some long identifier EXPECTED_GCONFIG scattered around the
 file. I put cursor after _ and change it to EXPECTED_CONTENTS
 somehow, maybe char-by-char, not necessarily in one optimal
 op.

 Now I'd like to auto-convert the last word change into s///
 command, automatically, so I can use  to change remaining
 occurencies. How could I script such thing ?

I'm not sure there's an easy way to do this automatically, as
you have to be able to identify *when* you've begun the above
process, what portion you want to change, and when you're done
changing.

I occasionally have need to do something similar, so here's what
I do (whether it's helpful or not... ;-)

1) search for an instance of my target by using #/*

:help *
:help #

2) change one of them to my desired result (in as many operations
as you need)

3) without moving the cursor off the new results, create a s//
command using those two pieces:

:%s/^R//^R^W/g

where ^R/ is control+R followed by a slash, and ^R^W is
control+R followed by control+W.  This composes the command by
using the previous search item (stored in the / register, and
handily includes the \...\ thanks to the */# searching) and
the word currently under the cursor.

:help c_CTRL-R
:help c_CTRL-R_CTRL-W

It's not exactly what you describe, but close enough that I find
it easy to do in situations like what you describe.


Nice. This is helpful. Thanks

Yakov


search vs closed folds

2007-04-23 Thread Yakov Lerner

When I search and I have closed folds, vim will automatically open
the closed fold if next match is in the closed fold.
Is there setting to disable this auto-opening ? Not to open the closed
fold when searching ?

Yakov


Re: turning arbitrary word change into substitution

2007-04-23 Thread Yakov Lerner

On 4/23/07, Arun Easi [EMAIL PROTECTED] wrote:

How about the U operation to get the original word and redo U to get back
to the current. This will mapp F3, modify according to your needs (add \
and \ etc)

nn F3 UyiwU:%s/c-r/c-rc-w/g

OR to save the :s for subsequent use,

nn F3 UyiwU:.s/c-r/c-rc-w/ecr


Thanks, this sounds very good.
Yakov


On Sun, 22 Apr 2007, Yakov Lerner wrote:

 Is it possible to do the following, or maybe some plugin already exist.
 If not, how would I script it. Let's say I have some long identifier
 EXPECTED_GCONFIG scattered around the file. I put cursor
 after _ and change it to EXPECTED_CONTENTS somehow, maybe char-by-char,
 not necessarily in one optimal op.

 Now I'd like to auto-convert the last word change into s/// command,
 automatically, so I can use  to change remaining occurencies.
 How could I script such thing ?

 Thanks
 Yakov




Re: how to determine what filetype vim is using

2007-04-23 Thread Yakov Lerner

On 4/24/07, Andrew Falanga [EMAIL PROTECTED] wrote:

Hi again,

I've finally found the answer to the indenting problems I was having.
I found that the indenting I was used to is present if I start
cindent in my .vimrc file.  However, now I've got a problem.  When I
have the starting for all files, when I edit TCL scripts, the
indenting behavior is not correct.

How do set up the .vimrc file to key off of the currently detected
file type and disable the cindent option?


Try
  au FIleType tcl set nocindent
, that assuming your filetype is spelled 'tcl'.
To check how exactly filetype is spelled:
   :e xxx.tcl
   :set filetype?

Yakov


Re: Describe-key ?

2007-04-16 Thread Yakov Lerner

On 4/15/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi,

 is there anything like describe-key (EMacs)in vim ?

 In EMacs vou can submit this command, press a combination
 of keys and EMacs will tel you the naming convention
 of this key (for example Meta-p) and its current
 bindings of that combination of keys.

 Anything like that in vim ?


For builtin commands, :help Keys
For user-remapped keys, :map Keys

Vim is multimode, so you have several meanings for each control-key.
(normal mode, insert, mode, commandline mode, etc).

Every mode for every command is documented in the help.

You need to learn the help navigation by tags and completion.
If you have these settings 'set wildmode=list:longest  wildmenu',
and you type :help ^Xtab (that's ':','h',space,'^','X,Tab)
you'll commands involving Ctrl-X in all modes.

You need to know how to find meaning for keys X for every mode in the help.
Help uses uniform prefixes for that.

Yakov


Re: Troubles configuring vim (multi-questions)

2007-04-13 Thread Yakov Lerner

On 4/13/07, OnionKnight [EMAIL PROTECTED] wrote:

Couldn't find anything about command-mode. How is it different from normal
mode?


Dont confuse 'commandline mode' with 'command mode'.

'comand mode' is same as 'normal mode', they are synonyms [1].

'commandline mode' is a mode which you enter with : from normal mode.
'commandline mode' is also the mode in which scripts are executed.
See more at ':hep vim-modes'


[1] :help normal-mode says:

   *Normal* *Normal-mode* *command-mode*
Normal mode In Normal mode you can enter all the normal editor
   commands.  If you start the editor you are in this
   mode (unless you have set the 'insertmode' option,
   see below).  This is also known as command mode.

Yakov

And yes, vi has the 7th mode.
It's called the 'confusion mode'.
It is a mode in which the beginner user of vi
mostly finds himself during his
first weeks/months/years of using vi.


wish: collaboration of N vim instances editing same file

2007-04-11 Thread Yakov Lerner

Hello Bram,
Is it possible to add this item to the vim voting list ?:

 collaboration of N vim instances editing same file
 -- Ability of N instances of vim to absorb, merge and show changes
 to the same file made by other running vim instances [ either by reading
 other vim's swapfiles, or somehow else ] ?

Can this be added to SOC ?

Yakov


Re: remote-silent and stdin

2007-04-11 Thread Yakov Lerner

On 4/10/07, Mahesh Sivasubramanian [EMAIL PROTECTED] wrote:

I am trying to do something to the effect of

ls | gvim - --remote-client.  or ls | gvim --remote-client -

However, vi sees the - as a file name and opens a new filename. Is there
way to open the stdin output on a gvim server?


Do some of these do what you want :

gvim --remote `ls`
gvim --remote $(ls)
gvim --remote-silent `ls`
gvim --remote-silent  $(ls)

?


 ... --remote-client


Must be a typo.
There is --remote and --remote-silent. There is no --remote-client.

Yakov


wish: collaboration of N vim instances editing same file

2007-04-11 Thread Yakov Lerner

Hello Bram,
Is it possible to add this item to the vim voting list ?:

 collaboration of N vim instances editing same file
 -- Ability of N instances of vim to absorb, merge and show changes
 to the same file made by other running vim instances [ either by reading
 other vim's swapfiles, or somehow else ] ?

Can this be added to SOC ?

Yakov


Re: Determining whether a window used :lcd

2007-04-11 Thread Yakov Lerner

On 4/11/07, Bob Hiestand [EMAIL PROTECTED] wrote:

  Is there any way to determine whether a particular window has its
path set with :lcd?


I think vi has no direct simple way to determine this.

I needed this once in of my script. I ended with some rude
simplification/workaround, lackng the direct simple solution.
I don't know your specific case, but you might find simlpistic workaround.

One weird attempt to determine this would be to (I did not do it):
 (1) get getcwd() in the window in quiestion
 (2) create temp new window with :new
 (3)  get getcwd() in the new temp window
 (4) compare cwd from step (3) against cwd from step(1)
 (5) :bw the temp window
This has lots of drawcacks:
- I am not sure this sequence works in the presence of :acd thought.
- I am not sure this sequence works at all, but I can't think of other
method either.
- This sequence won't detect one subtle case: case the :lcd is set, but is set
to directory X where X is same as current directory. (This case behaves
differently that case without  :lcd, but this difference might not
matter to you).
- Overly complicated.

Maybe vim needs new functions getlcwd(), hetgcwd(), or additional 2nd
param to getcwd() to return global/local dir.

Yakov


Re: script boolean operators

2007-04-11 Thread Yakov Lerner

On 4/10/07, Horvath Adam [EMAIL PROTECTED] wrote:

Thanks, it's really straightforward, but where is it in the manual?
http://vimdoc.sourceforge.net/htmldoc/usr_41.html - here I can not find.


Notice that usr_41.html is not all-covering. It is not a *reference*.
It is only a manual(tutorial). Details which do not appear in tutotial
(usr_NN) vimdocs
are found in the *reference* pages. You find *reference* pages by
several methods:
- by help tags completion: :help expressionTab
- get familiar with list of reference vimdocs:
 :cd $VIMRUNTIME/doc
 :!ls
- by / search within vimdoc
- by bruteforce search through all vimdocs: :helpgrep

The relevant reference doc in this case is ':help eval' -- it covers everything
about expression evaluation. Specificallyabout  and ||:

You can find  and ||  under:

  :help expression-syntax

then 5 lines below  you have:

  |expr2|.expr3 || expr3 logical OR

  |expr3|.expr4  expr4 logical AND

Additionally, you can notice that vim expression syntax is
rather C-like. This explains spelling of many C ops (==, , ||, ).

Yakov


Re: Vim freezes system ?!

2007-04-10 Thread Yakov Lerner

On 4/10/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Zdenek Sekera wrote:

 -Original Message-
 From: A.J.Mechelynck [mailto:[EMAIL PROTECTED]
 Sent: 10 April 2007 09:10
 To: Zdenek Sekera
 Cc: Yakov Lerner; vim@vim.org; Meino Christian Cramer; Bram Moolenaar
 Subject: Re: Vim freezes system ?!

 Zdenek Sekera wrote:
 [...]
 Just to add more to the confusion, on my box (RedHat Enterprise
 Linux,
 512Mb Ram) I have

 maxmapdepth=1000
 maxmempattern=1000
 maxmem=257676
 maxmemtot=257676

 Which tells me the last two can hardly be in kb and all over I don't
 understand what really they mean.

 ---Zdenek


 According to the help, they _are_ in KB and can reach up to two million
 (i.e.,
 2 gig). I sure wonder according to what Vim sets themat startup.

 Why do you think they can't be in KB? The above would mean slightly
 over 256
 meg, which sounds reasonable for a 512MB box (more reasonable at
 least, than
 the 249 K which I see).

 Arrgh, I guess the batteries in my mental calculator are flat after
 Easter vac :-).
 But what do these numbers really mean? You are right that mine look
 more acceptable than yours. Yours are really strange.

 ---Zdenek

Maybe there has been an arithmetic wraparound in my case? I have 2 gig of RAM
installed, which is slightly /more/ than 2 million KB.


I tried  it on the machine with 8GB of RAM. The 'mmt' values are 1024.
By the vimhelp, these values are in KB, as Tony said.

Another strange thing is:
these low values do not seem to have any effect on vim rmemory usage.

Nor when they are correct (like 643272 on 1.3 G ram machine),
neither  when they are suspicously low (like 1024 on 8G ram machine).
--
Yakov look, these numbers are suspicously low Lerner


Re: use variable in substitute

2007-04-10 Thread Yakov Lerner

On 4/10/07, Horvath Adam [EMAIL PROTECTED] wrote:

Hi,

One question again for me.

Can I use variable in pattern of substitute() in script?

let row = getline(j)  'trallala'
let rownext = getline(j+1)  'bimbam'
let row = substitute(row, ^\\\(.*\\\)$, \\1 rownext, g) 


let row = substitute(row, ^\\\(.*\\\)$, \\1  . rownext, g)

Yakov


Re: syntax/man.vim: manSubHeading is a bit too general?

2007-04-09 Thread Yakov Lerner

On 4/9/07, Nikolai Weibull [EMAIL PROTECTED] wrote:

The manSubHeading is defined as

syn match  manSubHeading  ^\s\{3\}[a-z][a-z ]*[a-z]$

This will, however, match more lines than I think is intended.  It
will, for example, match the line

\t  returns are what are recorded and compared with the data git keeps

where \t is a horizontal tabulation.


I never saw tabs in the formatted manpages. Did you ever
see tabs in the formatted manpages ? I think it contains only spaces.

Yakov


Re: how to color the word

2007-04-07 Thread Yakov Lerner

On 4/7/07, flyfish [EMAIL PROTECTED] wrote:

i see the help file of vim and some words in the text is colored, for
example, when i read the develop.txt help file, some words like Note,
design-goal are colored with yellow or pink, how could it be done? i also
want to color some keywords in my files, how to do?


:help :match
:help syntax

Yakov


Re: how to replace ESC to some other key?

2007-04-06 Thread Yakov Lerner

On 4/6/07, Taylor Venable [EMAIL PROTECTED] wrote:

On Wed, 4 Apr 2007 10:22:43 -0400
Yakov Lerner [EMAIL PROTECTED] wrote:

 On 4/4/07, wangxu [EMAIL PROTECTED] wrote:
  ESC is so far from the center of the keyboard.
  Can I replace this key to Caps Lock,for example?

 I heard some people use Tab as a substitute for Esc. Weird.
 But it's easier to do in platform-independent way.

 Yakov

If Wikipedia is correct in that vi was originally written on ADM-3A
terminals (I think I also read that on here at one time as well) and
that this particular terminal had it's escape key where nearly all
modern keyboards have a tab key, it kinda makes sense.

Here's the page, for reference: http://en.wikipedia.org/wiki/Vi


Indeed. And it didn't have tab key, did it ?

I use the  mini-keyboard (measures 29x11cm).
I love it becaise everything is nearby. Fingers need to traver less.
And takes less space on the crammed desktop :-)

Another nice relevant link is this keyboard:

   http://www.engadget.com/tag/optimus
   optimis keyboard where every key is a [color] display

Yakov


Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi,

 I did th3 follwing: With a program, which generates random numbers in
 different formats, I created a file, which consists of _one_ line of
 2097152 characters (0-9,A-F).

 To split the line into lines of 72 characters each, I started vim and
 let it read the file.

 I postioned the cursor at position 0 and entered the following in
 normal mode:

 qq72rightireturnesc0q

 Then I did a

 [EMAIL PROTECTED]

 After only 10 or 15 (guessed) executions of the macro the system
 freezes while constantly swapping (?) and became unuseable and did no
 longer respond.

 Even the mouse pointer was nearly unmoveable...

 After heavily and constantly trying I managed to kill the X-session
 and to 'killall -9 vim' from the console to get back my computer.


Hello Meino the vim killer Cramer,
I tried your scenario. You need to add 'set ul=-1' to disable undoes, and
'set lz' to disable excess redraws. Even then, vim goes rather slow at
this task.

Indeed, vim grows to 1000MB vm/rss size
size in matter of one minute without ul=-1 (, and growing very fast. )

To make editing of 2MB-long line manageable, I did:
  vim -u NONE file
 :set ul=-1 : disable undos
 :set lz
NOte that 2MB is already large file. You are now in the area where you want
take large file precautions wrt to performance.

This makes vim stay stable in memory size (although still rather large, 632mb).
But it's still slow at splitting 2mb-long lines. It took vim ~4 minutes to
split ~100 lines. So, for a whole 2mb data, it will take vim about
2 hours. You better try this kind of task with perl or C. Or just add
sensible newlines when generating your data.

Yakov

BTW your disk size is irrelevant.
What is  relevant is your RAM size and swap size.


Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, Yakov Lerner [EMAIL PROTECTED] wrote:

... It took vim ~4 minutes to split ~100 lines.


Typo here. This should have been:
It took vim ~4 minutes to split ~1000 lines.


Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

Hi Yakov the vim healer Lerner :)

memory size is 2GB Dual channel RAM, swap is 1G...

For me it is not a problem to fail with one task
(splitting a long line)...there are always
better solutions to discover on UNIX systems... :))

The problem I see is, that it is that easy to
stop a system by submitting the wrong command
to a text editor...


Aha, so you didn't try to edit a file.

You tried to find a scenario to push vim
beyond it's and your system's memory capacities.

OK, you succeeded.

Yakov


Re: Silly Question

2007-04-06 Thread Yakov Lerner

Yakov (without quotes) inserts kov after the 1st
char.

Now, who won ?


Re: Vim freezes system ?!

2007-04-06 Thread Yakov Lerner

On 4/6/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi,

  I did th3 follwing: With a program, which generates random numbers in
  different formats, I created a file, which consists of _one_ line of
  2097152 characters (0-9,A-F).

  To split the line into lines of 72 characters each, I started vim and
  let it read the file.

  I postioned the cursor at position 0 and entered the following in
  normal mode:

  qq72rightireturnesc0q

  Then I did a

  [EMAIL PROTECTED]

  After only 10 or 15 (guessed) executions of the macro the system
  freezes while constantly swapping (?) and became unuseable and did no
  longer respond.

  Even the mouse pointer was nearly unmoveable...

  After heavily and constantly trying I managed to kill the X-session
  and to 'killall -9 vim' from the console to get back my computer.

Hello Meino the vim killer Cramer,
I tried your scenario. You need to add 'set ul=-1' to disable undoes, and
'set lz' to disable excess redraws. Even then, vim goes rather slow at
this task.

Indeed, vim grows to 1000MB vm/rss size
size in matter of one minute without ul=-1 (, and growing very fast. )


The thing I find strange here is that values of 'maxmem', 'maxmemtot' were:

   :set mm? mmt?
 maxmem=643272
 maxmemtot=643272

, yet vim grew  past x2.5 times that limits (with default 'ul')
without messages.
Is this expected behaviour ?

Yakov


wish: show search progress on slow searches

2007-04-04 Thread Yakov Lerner

Wish: when search is slow, show the progress line number
every second on the bottom line (like, 12345 of 9).

Maybe this can be done with plugin, I'm not sure.
Maybe simply status line can be refreshed once in a second,
temporarily setting line number to the current search position.

Some regexes take half minute to several minutes time
on multimegabyte file. It would be nice to see the progress numbers onscreen.

Thanks
Yakov


Re: case of very slow regex search

2007-04-04 Thread Yakov Lerner

On 4/3/07, Peter Hodge [EMAIL PROTECTED] wrote:


--- Yakov Lerner [EMAIL PROTECTED] wrote:

 I use sometimes the regex that finds paragraphs
 containing given words w1,w2,... in any order ( I define paragraph
 as separated by lines, \n\n).

 I use the pattern like this: (two-word example, w1 and w2, but easily
 expandable for N words):
 /\c\(.\|.\n\)*\w1\\\(.\|.\n\)*\w2\
(and I set :set maxmempattern=2 )
 This works. But search time is unbelievably slow on big files.

 My question is; is there a rewrite of this  regex that works faster.

 To see the testcase how of how slow this works:
1. wget http://www.vmunix.com/~gabor/c/draft.html
   # this is ~1.3 MB file.
2. vim draft.html
3. /\c\(.\|.\n\)*\w1\\\(.\|.\n\)*\w2\

Try this pattern:

  /\c\n\zs\%(\%(.\|.\n\)\{-}\international\\\%(.\|.\n\)\{-}\although\\)

It has the \n at the start so it will match at most once per line and uses \{-}
instead of * to prevent backtracking. That search ends in 30 seconds (on a Dual
1.8ghz G5).  You won't need to tweak maxmempattern either.


Thanks Peter,
This works great.
Yakov


Re: highlighting errors

2007-04-04 Thread Yakov Lerner

On 4/4/07, Lionel Flandin [EMAIL PROTECTED] wrote:

Hi everyone,

I'm trying to find the command that would find the next error in a file.
For instance the following code contains a typo, how can one find it ?

-
#include stdio.h
int main(int argc, char **argv)
{
 printf(Hello world!\n);
]  // - Here it is :-), vim detects it and makes it red
 return 0;
}
-


This seems to be a recurring request. In the past, I
I posted to this list a vimscript function that does it. I made it into
small plugin:
http://www.vim.org/scripts/script.php?script_id=1851
SearchSyntaxError : search for the next syntax error detected
by the vim highlighting mechanism
The usage is very simple:
command :ERR searhes for the next syntax error, or Ctrl-KCtrl-E
That's it.

Yakov


Re: my map only works sometimes

2007-04-04 Thread Yakov Lerner

On 4/4/07, ben lieb [EMAIL PROTECTED] wrote:

The following map is used to do add span tags to highlighted text
in-line. My problem is that it only works sometimes, and I don't know why.

:map ,bb cCRCRESCkpIspanESCA/spanESCkJJ

The map works by cutting the highlighted text, putting it on its own
line, adding the tag to the front and the end of the line, and then
joining the lines.

Any thoughts on why this only works sometimes? I can't isolate what
conditions bring it about.


Can be several things.

1. To cancel possible influence of keyboard timeouts, map
the same rhs to the single-key combination -- like F10.
When ,bb dopesn't work, try f10. If f10 works, it's related to
timeouts.

2. Change to vnoremap instead of map. This cancels possibble
effects or remapping of some chars in the rhs. I think you want to use
it in the visual mode, right ? Then use vnoremap.

3. When it doesn';t work, what exactly happens ? Is it totally ignored,
or works half-way ?

4. When it doesn't work, do ':map ,bb' to check whether it's still
defined and is rhs correct.

Yakov


Re: how to replace ESC to some other key?

2007-04-04 Thread Yakov Lerner

On 4/4/07, wangxu [EMAIL PROTECTED] wrote:

ESC is so far from the center of the keyboard.
Can I replace this key to Caps Lock,for example?


I heard some people use Tab as a substitute for Esc. Weird.
But it's easier to do in platform-independent way.

Yakov


Re: Vim memory leak

2007-04-04 Thread Yakov Lerner

On 4/3/07, Max Dyckhoff [EMAIL PROTECTED] wrote:

My instance of vim (gvim on Windows) appears to have a memory leak, which makes 
me sad. Is this a common thing for everyone, or is there something in my setup 
which might be causing it? It's pretty serious.

When I start gvim and load my standard session, it will take up about 86MB of 
RAM. This includes dozens of buffers, splits, tabs and syntax, so I'm not 
really worried. After about four hours it will be up to more like 120MB, and 
after a couple of days it will be 200MB+.

Loading a fresh copy of gvim with all the plugins and my .vimrc, there are 
various actions I can see that increase the memory usage as reported by the Windows Task 
Manager. I have no idea on the validity of the Task Manager, but it's all I have on 
Windows.

:sp on a new buffer causes a raise of 4-8K.
:q on a split causes a raise of 4-8K.
Switching to/from gvim causes a small increase, typically 4-8K for a 
few switches.
Searching (with *) for a word in a .c file (with syntax highlighting) 
causes it to increase. If you hold down * then you can see the memory usage 
rocket up.
Basically, pretty much any action.

Any ideas? Will I just have to live with it and restart my vim session every 
couple of days?


Did you try to set the 'maxmemtot' option ? (:help 'maxmemtot')

Does memory drop down if you :bw all buffers ?

If you could simulate thousands of user actions using ClientServer
using some action-simulating script and have vim grow past 400-500 mb
that would be demonstration. It is not easy to distinguish necessary grow
from memory leak. But my firefox will predictably grow above
200mb in just couple of days in th air. And it does not have memory leak
for all I know. But if you can cause it grow indefinitely by opening and closing
some page, that would establish a memory leak.

Maybe you simply need to buy anoth 1GB of RAM ?
This sharply reduces feelings from another 200gb process :-)

Yakov


Re: my map only works sometimes

2007-04-04 Thread Yakov Lerner

On 4/4/07, ben lieb [EMAIL PROTECTED] wrote:

Yakov Lerner wrote:
 On 4/4/07, ben lieb [EMAIL PROTECTED] wrote:
 The following map is used to do add span tags to highlighted text
 in-line. My problem is that it only works sometimes, and I don't know
 why.

 :map ,bb cCRCRESCkpIspanESCA/spanESCkJJ

 The map works by cutting the highlighted text, putting it on its own
 line, adding the tag to the front and the end of the line, and then
 joining the lines.

 Any thoughts on why this only works sometimes? I can't isolate what
 conditions bring it about.

 Can be several things.

 1. To cancel possible influence of keyboard timeouts, map
 the same rhs to the single-key combination -- like F10.
 When ,bb dopesn't work, try f10. If f10 works, it's related to
 timeouts.

 2. Change to vnoremap instead of map. This cancels possibble
 effects or remapping of some chars in the rhs. I think you want to use
 it in the visual mode, right ? Then use vnoremap.

 3. When it doesn';t work, what exactly happens ? Is it totally ignored,
 or works half-way ?

 4. When it doesn't work, do ':map ,bb' to check whether it's still
 defined and is rhs correct.

 Yakov



When it doesn't work it, it re-highlights the first half of the
sentence, and then does nothing.



When it doesn't work, what does ':map ,,b' display ?

Yakov


Re: my map only works sometimes

2007-04-04 Thread Yakov Lerner

On 4/4/07, Yakov Lerner [EMAIL PROTECTED] wrote:

On 4/4/07, ben lieb [EMAIL PROTECTED] wrote:
 Yakov Lerner wrote:
  On 4/4/07, ben lieb [EMAIL PROTECTED] wrote:
  The following map is used to do add span tags to highlighted text
  in-line. My problem is that it only works sometimes, and I don't know
  why.
 
  :map ,bb cCRCRESCkpIspanESCA/spanESCkJJ
 
  The map works by cutting the highlighted text, putting it on its own
  line, adding the tag to the front and the end of the line, and then
  joining the lines.
 
  Any thoughts on why this only works sometimes? I can't isolate what
  conditions bring it about.
 
  Can be several things.
 
  1. To cancel possible influence of keyboard timeouts, map
  the same rhs to the single-key combination -- like F10.
  When ,bb dopesn't work, try f10. If f10 works, it's related to
  timeouts.
 
  2. Change to vnoremap instead of map. This cancels possibble
  effects or remapping of some chars in the rhs. I think you want to use
  it in the visual mode, right ? Then use vnoremap.
 
  3. When it doesn';t work, what exactly happens ? Is it totally ignored,
  or works half-way ?
 
  4. When it doesn't work, do ':map ,bb' to check whether it's still
  defined and is rhs correct.
 
  Yakov
 
 
 
 When it doesn't work it, it re-highlights the first half of the
 sentence, and then does nothing.


When it doesn't work, what does ':map ,,b' display ?


That should have been 'what does ':map ,bb' say ?'

Yakov


Re: Vim memory leak

2007-04-04 Thread Yakov Lerner

On 4/4/07, Max Dyckhoff [EMAIL PROTECTED] wrote:

My instance of vim (gvim on Windows) appears to have a memory leak, which makes 
me sad. Is this a common thing for everyone, or is there something in my setup 
which might be causing it? It's pretty serious.

When I start gvim and load my standard session, it will take up about 86MB of 
RAM. This includes dozens of buffers, splits, tabs and syntax, so I'm not 
really worried. After about four hours it will be up to more like 120MB, and 
after a couple of days it will be 200MB+.

Loading a fresh copy of gvim with all the plugins and my .vimrc, there are 
various actions I can see that increase the memory usage as reported by the Windows Task 
Manager. I have no idea on the validity of the Task Manager, but it's all I have on 
Windows.

:sp on a new buffer causes a raise of 4-8K.
:q on a split causes a raise of 4-8K.
Switching to/from gvim causes a small increase, typically 4-8K for a 
few switches.
Searching (with *) for a word in a .c file (with syntax highlighting) 
causes it to increase. If you hold down * then you can see the memory usage 
rocket up.
Basically, pretty much any action.

Any ideas? Will I just have to live with it and restart my vim session every 
couple of days?


Max,

I recalled two more things. Is your 'hidden' option set ? If it's set,
vim *will* grow. With 'hidden' set, vim will keep in memory much data
about old buffers. If you want to minimize memory, first thing you'd do is
':set nohidden'. To check your current state, 'set hidden?'.

Second important thing is :bw. Even with ':set nohidden', vim will
remember some data for every file it ever visited. To free this data
completely, you need to :ls!, then :bw for every unused buffer.

I think these two things will decrease vim's memory footprint
(in case you had 'set hidden').

Yakov


Re: Vim memory leak

2007-04-04 Thread Yakov Lerner

On 4/4/07, Max Dyckhoff [EMAIL PROTECTED] wrote:

On 4/4/07, Yakov Lerner [EMAIL PROTECTED] wrote:

 Max,

 I recalled two more things. Is your 'hidden' option set ? If it's set,
 vim *will* grow. With 'hidden' set, vim will keep in memory much data
 about old buffers. If you want to minimize memory, first thing you'd do is
 ':set nohidden'. To check your current state, 'set hidden?'.

 Second important thing is :bw. Even with ':set nohidden', vim will
 remember some data for every file it ever visited. To free this data
 completely, you need to :ls!, then :bw for every unused buffer.

 I think these two things will decrease vim's memory footprint
 (in case you had 'set hidden').

 Yakov

I do have 'hidden' set, because I like to keep things around. :ls! shows that I 
currently have about 550 buffers open. ...



we do have a large code base!


Then get another 1-2 GB of RAM. It's not called memory leak
when program allocates memory according to its functionality.

Yakov


Re: Executing vimfunctions in background

2007-04-03 Thread Yakov Lerner

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:



I'm interested in writing a plugin that could run in the background as I
do some work in a buffer. For instance I have a function that appends a
line to :copen. I would like to run it in the background continuously.
How could I do this and continue working in the foreground?

func myFunc()
while 1
exe caddexpr expand(%) . : . line(.) .  : .
getline(.)
exe sleep 5
endwhile
endfunc

 how do I launch myFunc() to run continuously in the background?


Chuhk,
You probably want to give the 'au CursorMoved' autocommand
a try for this task.
Such tasks are normally solved with autocommands in vim.
See:
:help au
:hep CursorMoved

Good luck
Yakov


Re: Executing vimfunctions in background

2007-04-03 Thread Yakov Lerner

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:


Yes and no- I think this would work in certain situations, but of course
what happens when I don't move the cursor?


If you didn't move the cursor -- then why would you
add the same position to the quicfix list again and again ? What's the point ?
How is adding same position again and again (seems meaningless to me)
better than reacting to cursor motion ?

Yakov



Actually, why isn't there a Timer autocommand? :)  Feature request?

-Original Message-
From: Yakov Lerner [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 03, 2007 11:05 AM
To: Chuck Mason
Cc: vim@vim.org
Subject: Re: Executing vimfunctions in background

On 4/3/07, Chuck Mason [EMAIL PROTECTED] wrote:


 I'm interested in writing a plugin that could run in the background as
I
 do some work in a buffer. For instance I have a function that appends
a
 line to :copen. I would like to run it in the background continuously.
 How could I do this and continue working in the foreground?

 func myFunc()
 while 1
 exe caddexpr expand(%) . : . line(.) .  : .
 getline(.)
 exe sleep 5
 endwhile
 endfunc

  how do I launch myFunc() to run continuously in the background?

Chuhk,
You probably want to give the 'au CursorMoved' autocommand
a try for this task.
Such tasks are normally solved with autocommands in vim.
See:
:help au
:hep CursorMoved

Good luck
Yakov



case of very slow regex search

2007-04-03 Thread Yakov Lerner

I use sometimes the regex that finds paragraphs
containing given words w1,w2,... in any order ( I define paragraph
as separated by lines, \n\n).

I use the pattern like this: (two-word example, w1 and w2, but easily
expandable for N words):
   /\c\(.\|.\n\)*\w1\\\(.\|.\n\)*\w2\
  (and I set :set maxmempattern=2 )
This works. But search time is unbelievably slow on big files.

My question is; is there a rewrite of this  regex that works faster.

To see the testcase how of how slow this works:
  1. wget http://www.vmunix.com/~gabor/c/draft.html
 # this is ~1.3 MB file.
  2. vim draft.html
  3. /\c\(.\|.\n\)*\w1\\\(.\|.\n\)*\w2\
 This search never finishes for me.

How  can I rewrite the regex to search faster ?

Yakov


Re: How to get the number of occurances of a search pattern ?

2007-03-31 Thread Yakov Lerner

On 3/29/07, MM [EMAIL PROTECTED] wrote:

When I do a search using / ,?,* or # how do I determine the number of
matches of search pattern in the current buffer ?


Try this plugin:
   http://www.vim.org/scripts/script.php?script_id=1682
Conveniently, it gives you number of matches for *every*
search, and  index of current match among all matches.
Yakov


Re: building gvim on debian

2007-03-27 Thread Yakov Lerner

Thanks Tim and Brian.

The problem turned to be in our firewall, it suddenly started to block the bz2's
that 'apt-get update'. 'apt-get build-dep vim-gtk' command helped. me.

Regarding breezy and dapper -- together, yes, this is the sources.list
Mepis comed with by default; they are both enabled together.

Yakov


Re: autocmd bug?

2007-03-26 Thread Yakov Lerner

On 3/26/07, Michael Wookey [EMAIL PROTECTED] wrote:

I have the following  in my .vimrc:

filetype plugin indent on
autocmd FileType c,h,cpp,hpp,cs setlocal cindent number cursorline

If I have a new buffer and set the filetype as follows, everything works
just fine:

:set filetype=c

However, if I have a new buffer and I set the filetype like this, the
autocmd doesn't fire:

:set filetype=c.doxygen

This syntax is described in:

:help 'filetype'


Which line/paragraph ? Can you paste a n excerpt ? I don;t have
it in my filetype.txt doc. I have vim7.188 and I don't have this functionality.

About year ago I suggested such syntax  -- 'set filetype=TYPE.SUBTYPE'
-- but I don't think it was accepted. I think vim does not have this.
Or is it some recent addition I'm not aware of ?

Yakov


Re: Keep cursor fixed when scrolling with mouse

2007-03-26 Thread Yakov Lerner

On 3/26/07, Some user [EMAIL PROTECTED] wrote:


Hello,

I'm using gVim on Windows and like it so far. There is one minor annoyance:
when I scroll with the mouse wheel (I'm trying to use only keyboard but
it'll take me a lot of time trying to break habit of using mouse to scroll),
the cursor moves with the screen. Is there a setting I can set that will
allow the cursor to remain fixed at one position when scrolling with the
mouse wheen/scrollbar?


Are you talknig about the case (1) where you scroll by more
that screenful of text , or (2) when you scroll just several lines ?

If you mean (1) , then I  think vim must keep cursor position on-screen, so
this is impossible. But you can have some mapping that let
you quickly jump to where the cursor was before scrolling (use marks).

Yakov


building gvim on debian

2007-03-25 Thread Yakov Lerner

When on FedoraCore, I can build gvim whenever I want and I
can install needed dependencies (*-devel).

But debian-derived distros are not nice to me ... on the
debian-derived distro (mepis), trying to install libgtk for building gvim
I got into trouble that I don't know how to solve:
'apt-get install libgtk2.0-dev' gives me errors [1].
Is libgtk2.0-dev is the correct package name that I need
to build gvim ? Trying to install lesstif results in apt-get error, too.
(I do 'apt-get update' often, but it results in errors [2])
What am I doing wrong ?

Thanks
Yakov
   one man's bug is another man's feature,
--
Below
[1] errors from 'apt-install libgtk2.0-dev'
[2] errors from 'apt-get update'
[3] contents of the sources.list
--
[1]
$ apt-install libgtk2.0-dev
Reading package lists... Done
Building dependency tree... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.

Since you only requested a single operation it is extremely likely that
the package is simply not installable and a bug report against
that package should be filed.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
libgtk2.0-dev: Depends: libgtk2.0-0 (= 2.8.17-1ubuntu5) but
2.8.20-0ubuntu1.1 is to be installed
Depends: libglib2.0-dev (= 2.8.5) but it is not going to be installed
Depends: libpango1.0-dev (= 1.10.0-2) but it is not going to be installed
Depends: libatk1.0-dev (= 1.6.1-2) but it is not going to be installed
Depends: libcairo2-dev but it is not going to be installed
E: Broken packages
---
[2]

'apt-get update' also produces errors:
Get:1 http://apt.mepis.org mepis Release.gpg [191B]
Hit http://apt.mepis.org mepis Release
Hit http://apt.mepis.org mepis/main Packages
Get:2 http://security.ubuntu.com dapper-security Release.gpg [191B]
Get:3 http://archive.ubuntu.com breezy Release.gpg [189B]
Get:4 http://archive.ubuntu.com dapper Release.gpg [189B]
Get:5 http://archive.ubuntu.com dapper-updates Release.gpg [191B]
Get:6 http://archive.ubuntu.com dapper-backports Release.gpg [191B]
Hit http://archive.ubuntu.com breezy Release
Hit http://archive.ubuntu.com dapper Release
Hit http://archive.ubuntu.com dapper-updates Release
Hit http://archive.ubuntu.com dapper-backports Release
Hit http://archive.ubuntu.com breezy/main Packages
Hit http://archive.ubuntu.com breezy/restricted Packages
Hit http://archive.ubuntu.com dapper/main Packages
Get:7 http://security.ubuntu.com dapper-security Release [50.9kB]
Hit http://archive.ubuntu.com dapper/restricted Packages
Get:8 http://security.ubuntu.com dapper-security/main Packages
99% [8 Packages bzip2 0] [Waiting for headers] [Waiting for headers]
25.6kB/s 0sbzip2: (stdin) is not a bzip2 file.
Err http://security.ubuntu.com dapper-security/main Packages
Sub-process bzip2 returned an error code (2)
Hit http://archive.ubuntu.com dapper/universe Packages
Get:9 http://security.ubuntu.com dapper-security/restricted Packages
99% [Waiting for headers] 25.6kB/s 0sbzip2: (stdin) is not a bzip2 file.
Err http://security.ubuntu.com dapper-security/restricted Packages
Sub-process bzip2 returned an error code (2)
Hit http://archive.ubuntu.com dapper/multiverse Packages
Get:10 http://archive.ubuntu.com dapper-updates/main Packages
99% [10 Packages bzip2 0] [Waiting for headers] 25.6kB/s 0sbzip2:
(stdin) is not a bzip2 file.
Err http://archive.ubuntu.com dapper-updates/main Packages
Sub-process bzip2 returned an error code (2)
Get:11 http://archive.ubuntu.com dapper-updates/restricted Packages
99% [11 Packages bzip2 0] [Waiting for headers] 25.6kB/s 0sbzip2:
(stdin) is not a bzip2 file.
Err http://archive.ubuntu.com dapper-updates/restricted Packages
Sub-process bzip2 returned an error code (2)
Hit http://archive.ubuntu.com dapper-backports/main Packages
Hit http://archive.ubuntu.com dapper-backports/restricted Packages
Hit http://archive.ubuntu.com dapper-backports/universe Packages
Hit http://archive.ubuntu.com dapper-backports/multiverse Packages
Fetched 59.9kB in 8s (7326B/s)
Failed to fetch
http://archive.ubuntu.com/ubuntu/dists/dapper-updates/main/binary-i386/Packages.bz2
Sub-process bzip2 returned an error code (2)
Failed to fetch
http://archive.ubuntu.com/ubuntu/dists/dapper-updates/restricted/binary-i386/Packages.bz2
Sub-process bzip2 returned an error code (2)
Failed to fetch
http://security.ubuntu.com/ubuntu/dists/dapper-security/main/binary-i386/Packages.bz2
Sub-process bzip2 returned an error code (2)
Failed to fetch
http://security.ubuntu.com/ubuntu/dists/dapper-security/restricted/binary-i386/Packages.bz2
Sub-process bzip2 returned an error code (2)
Reading package lists... 

Re: automatically save to filename

2007-03-21 Thread Yakov Lerner

On 3/21/07, Eric Smith [EMAIL PROTECTED] wrote:

I know that you can set the interval to auto-save to the swap file
but how do I automatically save to the named file itself every n seconds?


Yes, you can use 'CursorHold' autocommand for that.

The following (untested) is probaly an easy  starting point:
 au CursorHold * :up!
 au CursorHoldI * up!

Normally, file does not become modified
without keyboard interaction, right ? So you do not really need
the periodic saving when there was no keys pressed.I think
CursorHold/CursorHoldI will serve nicely here, without
need for periodic repeating.

Yakov


  1   2   3   4   5   6   7   8   9   >