Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Bill McCarthy
On Fri 1-Dec-06 7:19pm -0600, Yakov Lerner wrote:
> On 12/1/06, Bill McCarthy <[EMAIL PROTECTED]> wrote:

>> One might think so, but also note:
>>
>> :help non-greedy

> I don't have tag 'non-greedy' in the help. I have vim 7.9.164
> from svn. Where do I get more updated helpfiles ?

I see Tony already provided the an approach for unix.  To
update your directories on Windows (using 4nt):

copy /[!*~]/u/s "ftp://ftp.vim.org/pub/vim/runtime/dos"; c:\vim\vim70

adjusting the target as appropriate.  This copies only files
that are newer or didn't exist on the target.  It skips
files ending with a tilde.

And if any help files were updated:

vim -nes "+helpt c:\vim\vim70\doc|q"

-- 
Best regards,
Bill



Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread A.J.Mechelynck

Yakov Lerner wrote:

On 12/1/06, Bill McCarthy <[EMAIL PROTECTED]> wrote:

One might think so, but also note:

:help non-greedy


I don't have tag 'non-greedy' in the help. I have vim 7.9.164
from svn. Where do I get more updated helpfiles ?

Yakov



By ftp:

ftp://ftp.vim.org/pub/vim/runtime/

and all its contents except its dos/ subdirectory.

By rsync: the following assumes that you compile vim yourself, and that the 
current directory is the top of your building tree: src/.. if you will. The 
two additional lines copy (on Unix) the updated files to where you'll be using 
them (such as /usr/local/share/vim/vim70/).


rsync -avzcP --delete --exclude="/dos/" ftp.nluug.nl::Vim/runtime/ 
./runtime/
cd src
make installruntime

Either method updates all your runtime files. In addition, rsync removes 
outdated files which don't exist anymore in the latest version of the files, 
and it doesn't touch the files which are already up-to-date.



Best regards,
Tony.


Re: "save as" in Windows menu

2006-12-01 Thread A.J.Mechelynck

Leiss, Jack wrote:



I click on "save as" in the file menu of Windows.  I do not get the "save as" 
window.  Nothing happens.  It used to work, but suddenly stopped.  Some other menu selections work and some 
don't.  How can I get "save as" to work from the file menu?

I am using VIM version 5.3 and Windows XP Professional.

I love VIM, but I am a naïve user.  I use it only for writing plain 
text (not programming).  A simple solution would be best.

Thanks,


1. Here's the simple solution:
Use the :saveas command from the keyboard:

:saveas filename.ext

Or, if you want to overwrite an existing file, use

:saveas! filename.ext

(without the exclamation mark, if the new name already exists you get an error 
message).


2. IMPORTANT WARNING:
Vim 5.3 is a very, very, very old version. If someone gave it or sold it to 
you recently, you've been swindled. The latest release is 7.0.174. Get it (or 
7.0.161 which is still "reasonably recent") from 
https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721



Best regards,
Tony.


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Yakov Lerner

On 12/2/06, Yakov Lerner <[EMAIL PROTECTED]> wrote:

On 12/1/06, Bill McCarthy <[EMAIL PROTECTED]> wrote:
> One might think so, but also note:
>
> :help non-greedy

I don't have tag 'non-greedy' in the help. I have vim 7.9.164

7.0.164, sorry, not 7.9.164. Still, where do I get more updated
helpfiles like yours ?
Yakov


Re: highlighting tabs

2006-12-01 Thread A.J.Mechelynck

Yakov Lerner wrote:

On 12/2/06, Lev Lvovsky <[EMAIL PROTECTED]> wrote:

Can anyone suggest the best way to be able to highlight tabs (versus
softtabs) selectively?  meaning, at the push of a button I can have
that feature turned on, and pressing it again turns it off - all the
while not messing with my search buffer?


:exe "set listchars=tab:\xbb\xb7,trail:\xb7"
"or set listchars=tab:»·,trail:·
:set list
map  :set list!

Yakov




Beware: it seems that "\x" means a byte, not a character, when 'encoding' is 
UTF-8 (see the recent thread about "\xe4" not being equal to itself). Use 
alpha values (your commented-out command) or else use e.g.  
(preceded by \ if in a double-quoted string but not if in a mapping) which 
means the same character in Latin1 and UTF-8 (codepoint U+00B7, represented in 
Latin1 as 0xB7, in UTF-8 as 0xC2 0xB7).



Best regards,
Tony.


RE: "save as" in Windows menu

2006-12-01 Thread Leiss, Jack



I click on "save as" in the file menu of Windows.  I do not get the 
"save as" window.  Nothing happens.  It used to work, but suddenly stopped.  
Some other menu selections work and some don't.  How can I get "save as" to 
work from the file menu?

I am using VIM version 5.3 and Windows XP Professional.

I love VIM, but I am a naïve user.  I use it only for writing plain 
text (not programming).  A simple solution would be best.

Thanks,

---
Jack K. Leiss, Ph.D.
Principal Investigator, Southeast Perinatal Health Project

Chief Epidemiologist
Center for Health Research
Constella Group, LLC
2605 Meridian Parkway, Suite 200
Durham, NC 27713
919.313.7595
919.544.7507 fax
[EMAIL PROTECTED]
www.constellagroup.com

Enhancing human health around the world, every day.




Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Yakov Lerner

On 12/1/06, Bill McCarthy <[EMAIL PROTECTED]> wrote:

One might think so, but also note:

:help non-greedy


I don't have tag 'non-greedy' in the help. I have vim 7.9.164
from svn. Where do I get more updated helpfiles ?

Yakov


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread mzyzik
On Fri, Dec 01, 2006 at 04:41:37PM -0500, Charles E Campbell Jr wrote:
> >>>I am puzzled by a slightly more complicated version:
> >>>   how to match a '%' character following the 2nd occurrence of "home"?
> >>/^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs%
> >This pattern doesn't work. Try it on this line:
> >"home home home home home home% home"
> But it *does* work!  You didn't specify avoiding the % if matches to the 
> home pattern intervened.

I can rephrase:
"how to match a '%' character following the 2nd occurrence of "home"?"
to
"how to match a '%' character directly following the 2nd occurrence of "home"?"

I am pretty sure everyone else knew what I meant.

--Matt

P.S. Does adding "directly" change the meaning for you? And if so, do
you know the regular expression I want?

> Try
>  :set hls
> and the following two lines:
> 
> home % home home home home home% home
> home home %home home home% home
> 
> and you'll only see %s match after the 2nd home, exactly as specified.  
> Now, if you change
> the requirement, a different regex is needed.
> 
> Regards,
> Chip Campbell
> 


Re: highlighting tabs

2006-12-01 Thread Yakov Lerner

On 12/2/06, Lev Lvovsky <[EMAIL PROTECTED]> wrote:

On Dec 1, 2006, at 4:53 PM, Yakov Lerner wrote:

> On 12/2/06, Lev Lvovsky <[EMAIL PROTECTED]> wrote:
>> Can anyone suggest the best way to be able to highlight tabs (versus
>> softtabs) selectively?  meaning, at the push of a button I can have
>> that feature turned on, and pressing it again turns it off - all the
>> while not messing with my search buffer?
>
> :exe "set listchars=tab:\xbb\xb7,trail:\xb7"
> "or set listchars=tab:»·,trail:·
> :set list
> map  :set list!
>
> Yakov

perfect, thank you!

without looking a gift horse in the mouth, any way I can add color to
that?


That would be 'hi SpecialKey '
For examples see ':highlight' and ':help highlight'

And congratilations for getting adult horse as a gift!

Yakov


Re: highlighting tabs

2006-12-01 Thread A.J.Mechelynck

Lev Lvovsky wrote:
Can anyone suggest the best way to be able to highlight tabs (versus 
softtabs) selectively?  meaning, at the push of a button I can have that 
feature turned on, and pressing it again turns it off - all the while 
not messing with my search buffer?


thanks!
-lev



Method I.
-
/\t
highlights all hard tabs in "Search" highlight
:noh
clears
BUT: clobbers search register

Method II.
--
:match Todo /\t/
:match none

Method III.
--
:setlocal list listchars=tab:\|_,eol:¶
:setlocal nolist
- local to window: setting can be different in parallel windows
	- the first character position is different from the rest, allowing easier 
counting of hard tabs


In each case, you can map the "on" and "off" commands to a pair of "related" 
keys such as e.g. F6 and Shift-F6. Example for Method III:


:map  :setl list lcs=tab:\|_,eol:¶
:map:setl nolist
:imap :setl list lcs=tab:\|_,eol:¶
:imap   :setl nolist


Best regards,
Tony.


Re: highlighting tabs

2006-12-01 Thread Lev Lvovsky

On Dec 1, 2006, at 4:53 PM, Yakov Lerner wrote:


On 12/2/06, Lev Lvovsky <[EMAIL PROTECTED]> wrote:

Can anyone suggest the best way to be able to highlight tabs (versus
softtabs) selectively?  meaning, at the push of a button I can have
that feature turned on, and pressing it again turns it off - all the
while not messing with my search buffer?


:exe "set listchars=tab:\xbb\xb7,trail:\xb7"
"or set listchars=tab:»·,trail:·
:set list
map  :set list!

Yakov


perfect, thank you!

without looking a gift horse in the mouth, any way I can add color to  
that?


thanks!
-lev

Re: highlighting tabs

2006-12-01 Thread Yakov Lerner

On 12/2/06, Lev Lvovsky <[EMAIL PROTECTED]> wrote:

Can anyone suggest the best way to be able to highlight tabs (versus
softtabs) selectively?  meaning, at the push of a button I can have
that feature turned on, and pressing it again turns it off - all the
while not messing with my search buffer?


:exe "set listchars=tab:\xbb\xb7,trail:\xb7"
"or set listchars=tab:»·,trail:·
:set list
map  :set list!

Yakov


highlighting tabs

2006-12-01 Thread Lev Lvovsky
Can anyone suggest the best way to be able to highlight tabs (versus  
softtabs) selectively?  meaning, at the push of a button I can have  
that feature turned on, and pressing it again turns it off - all the  
while not messing with my search buffer?


thanks!
-lev


Re: question on gf and path

2006-12-01 Thread Marc Weber
>   Include("includes/some.file")
> 
> it's somewhat OK, but gf requires me to actually save the source file 
> before it will accept the change from "/includes..." to "includes".

Do I have missed something or would
set nocompatible "first line in your .vimrc !
set hidden
prevent vim from saving the file on gf ??

Marc


Re: question on gf and path

2006-12-01 Thread Marc Weber
On Fri, Dec 01, 2006 at 10:30:26AM -0600, Ben K. wrote:
> Is there a way to make gf open "some.file" from this line?
> 
>   Include("/includes/some.file");
> 
> where the file is actually sitting under web server root, like
> 
>   /var/www/html/includes/some.file
> 
> I tried adding "/var/www/html" to the :set path but vim will not recognize 
> it. /var/www/html/; was the same. Basically I'm looking for a way to add 
> "prefixes".
> 
> On the same note, would it be possible to let gf open
> 
>   /var/www/html/includes/some.file
> 
> when I gf on this string
> 
>   http://somehost.com/includes/some.file
> 
> or by defining a new command (say wf)?

That's exactly where you can use my little script (which will isntall
some dependencies, too)

Just add this into your ftplgugin/filetype.vim file:

-- >8 -- >8   filetype_sourced.vim  -- >8 -- >8 -- >8 
noremap gf :call vl#ui#navigation#gfHandler#HandleGF()
call 
vl#ui#navigation#gfHandler#AddGFHandler("[matchstr(expand(''),'Include(\"\\zs[^\"].*\\ze\")')]")
-- 8< -- 8< -- 8< -- 8< -- 8< -- 8< -- 8< 

and source the installer file 
http://www.mawercer.de/marcweber/vim/vimlib/installers/vimlib_gfhandler_installer_sourceme.vim
(Don't be afraid. The installer will ask for confirmation before doing
anything.)
I would suggest saving it to another directory (eg ~/.vimlib or
~/.vim_gf) and adding this folder to your runtimepath. 
set runtimepath+=~/.vimlib
Then its easy to remove it again if you don't like it.
I think you can see that [matchstr ... does the interesting thing which
is getting the file from under the cursor by calling expand('')
and remvoving the Include text. You
have to adjust it the way you like. You have to write your own code
which removes /includes and adds /var/www/html/includes/ which would
look like this:
call 
vl#ui#navigation#gfHandler#AddGFHandler("['/var/www/html/includes'.matchstr(expand(''),'Include(\"/includes\\zs[^\"].*\\ze\")')]")

You can even add different include directories:
call vl#ui#navigation#gfHandler#AddGFHandler("['/var/www/html/includes1'
call vl#ui#navigation#gfHandler#AddGFHandler("['/var/www/html/includes2'
call vl#ui#navigation#gfHandler#AddGFHandler("['/var/www/html/includes3'

Then you'll be asked which file to open if it doesn't exist.

Unfortunately the documentation
(http://www.mawercer.de/marcweber/vim/vimlib/docs/vl_ui_navigation_gfHandler_vim.html)
isn't up to date because vim segfaults while creating it and I don't
have the time to find the code causing it.

If something doesn't work drop me a mail.

HTH
Marc Weber


Re: if "\xe4"=="\xe4" failes,why?

2006-12-01 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

A.J.Mechelynck wrote:

[...]

It's not as simple as that, Dr. Chip: I get 0 (zero) as reply to

:echo ("\xe4" == "\xe4")

when 'encoding' is UTF-8. However, the byte 0xE4 by itself is not a 
valid character in UTF-8. I also get 1 (one) in reply to


:echo ("ä" == "\xc3\xa4")

where ä (a-umlaut) is Unicode codepoint U+00E4, represented in UTF-8 
by the two bytes 0xC3 0xA4.


That's peculiar; I get (when I source the script):
equal!
1

with the following emendation to the script:

set encoding=utf-8
if "\xe4" == "\xe4"
redraw!
echo "equal!"
else
redraw!
echo "not equal"
endif
echo ("\xe4" == "\xe4")

But, without those redraws, I get no message.

Regards,
Chip Campbell




I still get 0 (and sourcing the above scriptlet gives me

not equal
0

). In some earlier post, the OP mentioned he needed 'ignorecase' to see the 
"unequal" behaviour (I have encoding=utf-8 ignorecase as defaults).


Using gvim 7.0.174, huge version with GTK2-GNOME GUI, on SuSE Linux 9.3


Best regards,
Tony.


Re: Inverse Folding?

2006-12-01 Thread Tim Chase
Because I often want to concentrate on a small section of code in a large 
script, and because my terminal window is large, I wondered if it was possible 
to select some text and have all other text, ie. the surrounding text, fade out 
in colour, or use a darker colour or something, so that when I flick away to 
read another tab and flick back, I don't have to manually search out the small 
block of code again.


vnoremap h :exec 'match Comment 
/\%<'.line("'").'l\\|\%>'.line("'>").'l/'


seems to do what you're describing (that "|" might have to be 
"" depending how vnoremap treats things in strings...). 
Adjust "Comment" to be whatever highlight group you like...or 
make your own and make it invisible.  For me, Comment is 
[italic-]dark-grey-on-black which fades out.  Then, with a block 
highlighted, you can hit "h" and it will "mask" all the stuff 
that wasn't highlighted.


As usual, you can then just

:match none

to clear it.

Now I'm wondering if it is possible to select a block of text and issue a fold 
command that folds away everything BUT the selected text.


A similar stunt could be done to clear all folding, and then fold 
 the two ranges "1,'>-" and "'>+,$" something like this untested


vnoremap h :1,'-fold'>+,$fold


HTH,

-tim






Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Charles E Campbell Jr

[EMAIL PROTECTED] wrote:


On Fri, Dec 01, 2006 at 10:34:14AM -0500, Charles E Campbell Jr wrote:
 


[EMAIL PROTECTED] wrote:

   


I am puzzled by a slightly more complicated version:
how to match a '%' character following the 2nd occurrence of "home"?


 


/^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs%
   



This pattern doesn't work. Try it on this line:
"home home home home home home% home"

It should match nothing on that line, because the '%' doesn't follow the
2nd occurrence as desired.
 

But it *does* work!  You didn't specify avoiding the % if matches to the 
home pattern intervened.

Try
 :set hls
and the following two lines:

home % home home home home home% home
home home %home home home% home

and you'll only see %s match after the 2nd home, exactly as specified.  
Now, if you change

the requirement, a different regex is needed.

Regards,
Chip Campbell



Re: if "\xe4"=="\xe4" failes,why?

2006-12-01 Thread Charles E Campbell Jr

A.J.Mechelynck wrote:


Charles E Campbell Jr wrote:


mbbill wrote:


I met a very strange problem recently, that is
when I set the following options:
set encoding=utf-8
set ignorecase
then the expression: if "\xe4"=="\xe4" fails.
I test it using:
if "\xe4"=="\xe4"
  echo "test"
endif
but I got nothing output, why ?

 

 


Try

set encoding=utf-8
if "\xe4" == "\xe4"
redraw!
echo "equal!"
else
redraw!
echo "not equal"
endif


Looks like your message is doing an unwanted disappearing act.

Regards,
Chip Campbell




It's not as simple as that, Dr. Chip: I get 0 (zero) as reply to

:echo ("\xe4" == "\xe4")

when 'encoding' is UTF-8. However, the byte 0xE4 by itself is not a 
valid character in UTF-8. I also get 1 (one) in reply to


:echo ("ä" == "\xc3\xa4")

where ä (a-umlaut) is Unicode codepoint U+00E4, represented in UTF-8 
by the two bytes 0xC3 0xA4.


That's peculiar; I get (when I source the script):
equal!
1

with the following emendation to the script:

set encoding=utf-8
if "\xe4" == "\xe4"
redraw!
echo "equal!"
else
redraw!
echo "not equal"
endif
echo ("\xe4" == "\xe4")

But, without those redraws, I get no message.

Regards,
Chip Campbell



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

2006-12-01 Thread A.J.Mechelynck

Jeffrey Robertson wrote:

No. That's my problem.  How does gvim tell Windows to make itself an
option in this list?

[...]


I'm not sure; I think it's something in the registry. Maybe the install 
program should do it. Have you installed Vim from Steve Hall's self-installer 
https://sourceforge.net/project/showfiles.php?group_id=43866&package_id=39721 
? If you haven't, try doing it.


P.S. Please use bottom-posting or inter-posting in the Vim mailing lists.


Best regards,
Tony.


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread mzyzik
On Fri, Dec 01, 2006 at 10:34:14AM -0500, Charles E Campbell Jr wrote:
> [EMAIL PROTECTED] wrote:
> 
> >I am puzzled by a slightly more complicated version:
> > how to match a '%' character following the 2nd occurrence of "home"?
> > 
> >
> /^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs%

This pattern doesn't work. Try it on this line:
"home home home home home home% home"

It should match nothing on that line, because the '%' doesn't follow the
2nd occurrence as desired.

--Matt

> 
> where N is 1 for the "2nd occurrence" (N is 2 for the third occurrence, 
> etc).
> 
> This pattern matches up to and including the 2nd home, extends past a 
> minimal amount of anything up to but not including a %, whereupon the 
> pattern matching starts.
> 
> Regards,
> Chip Campbell
> 


Re: if "\xe4"=="\xe4" failes,why?

2006-12-01 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

mbbill wrote:


I met a very strange problem recently, that is
when I set the following options:
set encoding=utf-8
set ignorecase
then the expression: if "\xe4"=="\xe4" fails.
I test it using:
if "\xe4"=="\xe4"
  echo "test"
endif
but I got nothing output, why ?

 

 


Try

set encoding=utf-8
if "\xe4" == "\xe4"
redraw!
echo "equal!"
else
redraw!
echo "not equal"
endif


Looks like your message is doing an unwanted disappearing act.

Regards,
Chip Campbell




It's not as simple as that, Dr. Chip: I get 0 (zero) as reply to

:echo ("\xe4" == "\xe4")

when 'encoding' is UTF-8. However, the byte 0xE4 by itself is not a valid 
character in UTF-8. I also get 1 (one) in reply to


:echo ("ä" == "\xc3\xa4")

where ä (a-umlaut) is Unicode codepoint U+00E4, represented in UTF-8 by the 
two bytes 0xC3 0xA4.



Best regards,
Tony.


Re: question on gf and path

2006-12-01 Thread Tim Chase

Is there a way to make gf open "some.file" from this line?

Include("/includes/some.file");

where the file is actually sitting under web server root, like


/var/www/html/includes/some.file

I tried adding "/var/www/html" to the :set path but vim will
not recognize it. /var/www/html/; was the same. Basically I'm
looking for a way to add "prefixes".


Assuming you have "/var/www/html" in your path, the following
pairing should help you out:


nnoremap  gf :exec 'e ' . 
findfile(substitute(expand(''), '^/*','',''))


nnoremap  f :exec 'sp ' . 
findfile(substitute(expand(''), '^/*','',''))


The findfile() function also takes an extra parameter if you want
to refrain from munging your actual path, you could do something like

findfile(..., &path.',/var/www/html')


On the same note, would it be possible to let gf open

/var/www/html/includes/some.file

when I gf on this string

http://somehost.com/includes/some.file

or by defining a new command (say wf)?


A similar transformation could tweak the previous, something like

substitute(expand(...), '^\(http://[^/]/\)\=/*','','')

would strip off leading slashes and leading protocol+host.  (that 
regexp/substitute() is untested, but should be approx. correct, 
save for possible needs to escape the "\" characters)


Alternatively, you could map it to gf and f
to maintain the original meanings, but create new mappings to
provide the additional functionality.

HTH,

-tim






Re: question on gf and path

2006-12-01 Thread Ben K.


I'll check it out. Thanks.

On Fri, 1 Dec 2006, Yegappan Lakshmanan wrote:


Hi,

On 12/1/06, Ben K. <[EMAIL PROTECTED]> wrote:


Is there a way to make gf open "some.file" from this line?

Include("/includes/some.file");

where the file is actually sitting under web server root, like

/var/www/html/includes/some.file

I tried adding "/var/www/html" to the :set path but vim will not 
recognize
it. /var/www/html/; was the same. Basically I'm looking for a way to 
add

"prefixes".

On the same note, would it be possible to let gf open

/var/www/html/includes/some.file

when I gf on this string

http://somehost.com/includes/some.file

or by defining a new command (say wf)?



You may want to include look into the 'includeexpr' and 'include'
options. In Vim7, the 'include' option supports the "\zs" and "\ze"
regular expression atoms, so you can use this change the
matched text.

- Yegappan



Regards,

Ben K.
Developer
http://benix.tamu.edu


Re: Knowing the name vim was invoked under

2006-12-01 Thread A.J.Mechelynck

DervishD wrote:

Hi all :)

I would like to share the same .vimrc for "vim" and "view", so I can
use "view" as a pager without having to use "-u" in the command line. So
far, I've thought that the only way of knowing if I'm under "vim" or
"view" mode is to check the value of "readonly". Not perfect, but it
will do.

The problem is that I would like to use vim with other
"personalities" (different sets of options) depending on its invocation
name. Can this be done? I haven't found in the documentation any
function to retrieve the full command line, just the file argument list.

Any suggestion about how to discriminate in the .vimrc file
depending on the invocation name for vim?

Thanks a lot in advance :)

Raúl Núñez de Arenas Coronado



:help v:progname

Note that sometimes Vim will get a progname with suffixes, e.g. gvimd for a 
version of gvim compiled with debug information; or vim64.exe for a Vim 6.4 
kept for testing scripts. So in general I would recommend testing using 
pattern-matching:


if v:progname =~? 'vim' " test for vim or gvim
if v:progname =~? '^r'  " restricted mode

etc. However, some "names of Vim" are equivalent with generic names plus 
command-line arguments: e.g. "gvim -R" is equivalent to "gview", "vim -Z" is 
equivalent to "rvim" etc. So other testing methods are maybe more reliable:


don't test for "if v:progname =~? '^g'", test for "if has('gui_running')
don't test for "if v:progname ~? 'view'", test for "if &readonly"

etc.


Best regards,
Tony.


Re: question on gf and path

2006-12-01 Thread Yegappan Lakshmanan

Hi,

On 12/1/06, Ben K. <[EMAIL PROTECTED]> wrote:


Is there a way to make gf open "some.file" from this line?

Include("/includes/some.file");

where the file is actually sitting under web server root, like

/var/www/html/includes/some.file

I tried adding "/var/www/html" to the :set path but vim will not recognize
it. /var/www/html/; was the same. Basically I'm looking for a way to add
"prefixes".

On the same note, would it be possible to let gf open

/var/www/html/includes/some.file

when I gf on this string

http://somehost.com/includes/some.file

or by defining a new command (say wf)?



You may want to include look into the 'includeexpr' and 'include'
options. In Vim7, the 'include' option supports the "\zs" and "\ze"
regular expression atoms, so you can use this change the
matched text.

- Yegappan


Re: if "\xe4"=="\xe4" failes,why?

2006-12-01 Thread Charles E Campbell Jr

mbbill wrote:


I met a very strange problem recently, that is
when I set the following options:
set encoding=utf-8
set ignorecase
then the expression: if "\xe4"=="\xe4" fails.
I test it using:
if "\xe4"=="\xe4"
  echo "test"
endif
but I got nothing output, why ?

 

 


Try

set encoding=utf-8
if "\xe4" == "\xe4"
redraw!
echo "equal!"
else
redraw!
echo "not equal"
endif


Looks like your message is doing an unwanted disappearing act.

Regards,
Chip Campbell



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

2006-12-01 Thread Jeffrey Robertson
No. That's my problem.  How does gvim tell Windows to make itself an
option in this list?




-Original Message-
From: Sean Plank [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 2:27 PM
To: vim@vim.org
Subject: Re: I can't make gvim the default application for .txt files in
WinXP

When I use tools --> Folder Options > File Types tab, Select the
extestion or
file type, click the Change button, browse to gvim. gvim shows up as "Vi
Improved - A Text Editor" in the Open with dialog box. Is that what you
are seeing? 

"Vi Improved - A Text Editor" is gvim
 
Sean Plank
253.815.9626 Home


- Original Message 
From: Jeffrey Robertson <[EMAIL PROTECTED]>
To: Dudley Fox <[EMAIL PROTECTED]>; vim@vim.org
Sent: Friday, December 1, 2006 10:44:40 AM
Subject: RE: I can't make gvim the default application for .txt files in
WinXP


Doesn't matter whether that box is ticked or not.  I can't open with
gvim.


 


Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


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

2006-12-01 Thread A.J.Mechelynck

Jeffrey Robertson wrote:

Thanks for replying.
 
I do this and it doesn't work.
 
By "gvim", I assume you mean gvim.exe.

[...]

By "gvim" what is meant under Windows is the entry labeled "VI Improved - A 
Text Editor".



Best regards,
Tony.


Re: question on gf and path (fwd)

2006-12-01 Thread Ben K.


Actually, making gf accept the change in buffer will help only in special 
cases. Since I can be in


/AliasedDir/x/y/x
or
/DocRoot/a/b/c/d/e/f/

and still call /DocRoot/includes/some.file

using
include("/includes/some.file") ...

and it's a frequent case.


In this case
include("__some_modification_to__... _includes/some.file")

will not necessarily be convenient.

But thanks anyway.

Ben K.
Developer
http://benix.tamu.edu


Re: question on gf and path

2006-12-01 Thread Ben K.

On Fri, 1 Dec 2006, Yakov Lerner wrote:


Also can be that leading '/' in "/includes/some.file" makes
vim believe this is absolute pathname. Try on
 Include("includes/some.file");


That's where I want to get advice... That notation using DocumentRoot like 
"/includes/some.file" is universal in web applications.


If I can temporarily change the buffer and trick vim to think the line is 
now


Include("includes/some.file")

it's somewhat OK, but gf requires me to actually save the source file 
before it will accept the change from "/includes..." to "includes".


There are situations I cannot save it, e.g. if the source is on a live 
server, during the time this is changed, the web server will not be able 
to find the file and will generate errors.


It's ok if there's no way as is. I'll prehaps look at recompiling.


Thanks.

Ben K.
Developer
http://benix.tamu.edu


Pasting utf8

2006-12-01 Thread Bill Moseley

VIM - Vi IMproved 7.0 (2006 May 7, compiled Nov 15 2006 16:24:17)
Included patches: 1-164



I don't normally use utf8, but I have a uxterm running on Linux.

If I copy and paste some UTF8 text from Firefox into Vim I see:

Weeding for Your Library\u2019s Health
^^^

But, pasting into the xterm it works fine.

That is, in my uxterm I do this (which works correctly):

$ echo "Weeding for Your Library’s Health" > utf8-test

Where "Weeding..." was pasted into the xterm with my middle mouse
click.

Now in Vim I open utf8-test my screen looks fine and encoding? shows
"encoding=utf8":

Weeding for Your Library’s Health
~   
~   
~   
  1,16  All

But, if I paste with my middle mouse button into Vim I get:

Weeding for Your Library’s Health
Weeding for Your Library\u2019s Health  <<<--- pasted line
~   
~   
~   
-- INSERT --  2,18  Bot

What is it not pasting the utf8 character?

set mouse?  shows "mouse=a".


-- 
Bill Moseley
[EMAIL PROTECTED]



Re: Useful Tools to Assist Editing (Not just VIM)

2006-12-01 Thread Aaron Griffin

On 12/1/06, Karl Guertin <[EMAIL PROTECTED]> wrote:

I'm surprised nobody's mentioned AutoHotkey, the swiss army knife of
windows utilities.

http://www.autohotkey.com/


That's probably because autohotkey is scripted in some sort of
bastardized visual basic and is therefore lame.


Re: question on gf and path

2006-12-01 Thread Yakov Lerner

On 12/1/06, Ben K. <[EMAIL PROTECTED]> wrote:


Is there a way to make gf open "some.file" from this line?

Include("/includes/some.file");

where the file is actually sitting under web server root, like

/var/www/html/includes/some.file

I tried adding "/var/www/html" to the :set path but vim will not recognize
it. /var/www/html/; was the same. Basically I'm looking for a way to add
"prefixes".

On the same note, would it be possible to let gf open

/var/www/html/includes/some.file


Try to add  /var/www/html/ into &path option, like
   set path+=/var/www/html
Also can be that leading '/' in "/includes/some.file" makes
vim believe this is absolute pathname. Try on
  Include("includes/some.file");

See :help gf

Yakov


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

2006-12-01 Thread Sean Plank
When I use tools --> Folder Options > File Types tab, Select the extestion or
file type, click the Change button, browse to gvim. gvim shows up as "Vi 
Improved - A Text Editor" in the Open with dialog box. Is that what you are 
seeing? 

"Vi Improved - A Text Editor" is gvim
 
Sean Plank
253.815.9626 Home


- Original Message 
From: Jeffrey Robertson <[EMAIL PROTECTED]>
To: Dudley Fox <[EMAIL PROTECTED]>; vim@vim.org
Sent: Friday, December 1, 2006 10:44:40 AM
Subject: RE: I can't make gvim the default application for .txt files in WinXP


Doesn't matter whether that box is ticked or not.  I can't open with
gvim.


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com


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

2006-12-01 Thread Jeffrey Robertson
Doesn't matter whether that box is ticked or not.  I can't open with
gvim.
 

 

 




From: Dudley Fox [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 1:14 PM
To: Robertson, Jeffrey (CAR:QW32); vim@vim.org
Subject: Re: I can't make gvim the default application for .txt
files in WinXP


Jeffery,
As you described your actions below you need to take one
additionall step.
2.5 Check the "Always use the selected program to open this kind
of file" checkbox (step 4 in the original list I sent you). The checkbox
is tucked away under the list of programs you can choose from, and is
not obvious at all.

If that does not work, then I am truly at a loss.

Enjoy,
Dudley 


On 12/1/06, Jeffrey Robertson <[EMAIL PROTECTED]> wrote: 

That's just a different way into the same dialog box I
used in
the first place.  It doesn't work for me.  Although I
can select
gvim.exe, it doesn't actually take effect.  To be clear:
1) I click Change  It says notepad is the default. 
2) I click browse, and pick gvim.exe, and click Open.
3) Notepad is still listed as the default.

Does gvim have to "register" something with Windows to
get recognized
as a valid choice?

-- Jeff. 

-Original Message-
From: Krall, Ed-P27726 [mailto:[EMAIL PROTECTED]
Sent: Friday, December 01, 2006 12:45 PM
To: Robertson, Jeffrey (CAR:QW32); Dudley Fox;
vim@vim.org
Subject: RE: I can't make gvim the default application
for .txt files in
WinXP

I have many file types mapped into GVIM: .txt, .lst,
.cfg, and others.

Go to Windows explorer ("my computer"), tools --> Folder
Options, and 
select the File Types tab.   Select the extestion or
file type, click
the Change button, and select or specify the
application.


Ed





-Original Message-
From: Jeffrey Robertson [mailto: [EMAIL PROTECTED]
Sent: Friday, December 01, 2006 9:08 AM
To: Dudley Fox; vim@vim.org
Subject: RE: I can't make gvim the default application
for .txt files in 
WinXP

Thanks for replying.

I do this and it doesn't work.

By "gvim", I assume you mean gvim.exe.

When I do this, after I select gvim.exe and that dialog
closes, the
"Open with" dialog still shows Notepad selected.  I
can't get gvim to 
show up as an option in the program chooser list.  I can
get vim, but I
want gvim.

Any idea what's up?


From: Dudley Fox [mailto:[EMAIL PROTECTED] ]
Sent: Thursday, November 30, 2006 6:06 PM
To: Robertson, Jeffrey (CAR:QW32); vim@vim.org
Subject: Re: I can't make gvim the default
application for .txt
files in WinXP


Jeffrey,
Try this:

1. Right click on a .txt file
2. Select the "Open With" menu option
3. Select the "Choose Program..." menu option 
4. Check the "Always use the selected program to
open this kind
of file" checkbox
5. Select gvim, you may have to browse to it.
6. Click ok.


This should work for you, though you will have
to do this for 
each file type you want gvim to open. If that does not
work please let
me know. There are other ways to achieve this, but this
is the easiest.

Sincerely,
Dudley


On 11/30/06, Jeffrey Robertson <
[EMAIL PROTECTED]> wrote:

Hi:

I just installed Vim 7.0 on my Windows
XP box.  I cannot
force files
with .txt (or any other extension) to
automatically open 
in gvim.
However, I do ha

Re: Useful Tools to Assist Editing (Not just VIM)

2006-12-01 Thread Karl Guertin

I'm surprised nobody's mentioned AutoHotkey, the swiss army knife of
windows utilities.

http://www.autohotkey.com/


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Bill McCarthy
On Fri 1-Dec-06 1:59am -0600, A.J.Mechelynck wrote:

> He gave it. In the above case, you highlight not only the 2nd occurrence but
> also the 4th, 6th, etc.

Of course.  I was so focused on (1) the "second on the line"
and (2) the "shortest match first algorithm" of non-greedy
constructs (which surprises many users) that I completely
ignored matches starting elsewhere :-(   That is:

   :%s/home.\{-}\zshome/alone

only changes the second home - no matter how many are on a
line..

Peter's solution to find only the second works everywhere.

To the person who didn't like the \{-} form, use \v:

/\v^.{-}home.{-}\zshome

Sorry Peter and zzapper for the confusion.

--
Best regards,
Bill



Re: Useful Tools to Assist Editing (Not just VIM)

2006-12-01 Thread zzapper
Gary Johnson <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> On 2006-12-01, Troy Piggins <[EMAIL PROTECTED]> wrote:
>> * zzapper <[EMAIL PROTECTED]> :
> 
> I've been using 'external' for quite a while and am very happy with 
> it.
> 
> http://bur.st/~benc/?p=external
> 
> I found out about it from
> 
> http://vim.sourceforge.net/tips/tip.php?tip_id=805
> 
> HTH, Gary

Gary
That's wonderful and super quick to set up
Tried it in MSWORD and Pegasus Email

I applied the patch mentioned in tip805
external.vim (vim7)
if exists(b:ECdidBufferInit)
change to 
if exists("b:ECdidBufferInit")

by rainergrohmann

s


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



Re: suggestions for ssh under windows

2006-12-01 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Charles E Campbell Jr wrote:

I have a netrw user using WinXP who wants to use ssh; currently, he 
doesn't have such an executable.
I tend to use cygwin, but that's like asking one to build a home 
instead of new cabinets for the kitchen.


So, where can he get ssh for WinXP?

I'm likely to put a synopsis of any answers in netrw's help.



Hello!

Thank you for your suggestions -- as I mentioned, I'll be including a 
synopsis in netrw's help.  Looks
like there're four solutions: putty, openssh, gnuwin32, and including a 
couple of files from cygwin
(although for that last case I'm not sure how one would get just the two 
without downloading the

entire distribution).  It'll be netrw-problem #8 (:help netrw-P8).

Regards,
Chip Campbell





The Cygwin distribution is made up of a large number of small packages which 
can be downloaded separately. You can opt for the large economy package with 
bells, whistles, and Christmas gift wrapping, or else download one small set 
of basic functions required by all the rest, plus whatever additional software 
packages you want.


I suggested GnuWin32 on general principles, but I haven't actually checked 
whether it offers an ssh program.



Best regards,
Tony.


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

2006-12-01 Thread Russell Bateman
I have had inexplicable and inconsistent trouble with Windoz doing this 
at least since back in version 98. It's infuriating.





Jeffrey Robertson wrote:

That's just a different way into the same dialog box I used in
the first place.  It doesn't work for me.  Although I can select
gvim.exe, it doesn't actually take effect.  To be clear:
1) I click Change  It says notepad is the default.
2) I click browse, and pick gvim.exe, and click Open.
3) Notepad is still listed as the default.

Does gvim have to "register" something with Windows to get recognized
as a valid choice?

-- Jeff.

-Original Message-
From: Krall, Ed-P27726 [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 12:45 PM

To: Robertson, Jeffrey (CAR:QW32); Dudley Fox; vim@vim.org
Subject: RE: I can't make gvim the default application for .txt files in
WinXP

I have many file types mapped into GVIM: .txt, .lst, .cfg, and others.

Go to Windows explorer ("my computer"), tools --> Folder Options, and
select the File Types tab.   Select the extestion or file type, click
the Change button, and select or specify the application.


Ed 





 
-Original Message-
From: Jeffrey Robertson [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 9:08 AM

To: Dudley Fox; vim@vim.org
Subject: RE: I can't make gvim the default application for .txt files in
WinXP

Thanks for replying.
 
I do this and it doesn't work.
 
By "gvim", I assume you mean gvim.exe.
 
When I do this, after I select gvim.exe and that dialog closes, the

"Open with" dialog still shows Notepad selected.  I can't get gvim to
show up as an option in the program chooser list.  I can get vim, but I
want gvim.
 
Any idea what's up?



	From: Dudley Fox [mailto:[EMAIL PROTECTED] 
	Sent: Thursday, November 30, 2006 6:06 PM

To: Robertson, Jeffrey (CAR:QW32); vim@vim.org
Subject: Re: I can't make gvim the default application for .txt
files in WinXP


Jeffrey,
Try this:

1. Right click on a .txt file
2. Select the "Open With" menu option
3. Select the "Choose Program..." menu option
4. Check the "Always use the selected program to open this kind
of file" checkbox 
	5. Select gvim, you may have to browse to it.

6. Click ok.


This should work for you, though you will have to do this for
each file type you want gvim to open. If that does not work please let
me know. There are other ways to achieve this, but this is the easiest. 
	

Sincerely,
Dudley


	On 11/30/06, Jeffrey Robertson <[EMAIL PROTECTED]> wrote: 


Hi:

I just installed Vim 7.0 on my Windows XP box.  I cannot
force files
with .txt (or any other extension) to automatically open
in gvim.
However, I do have the "edit with vim" option in my
right-click menu. 
		

If I try to specify a new program to use for .txt and
navigate to the
folder with gvim.exe, even if I select it, it doesn't
take effect
(Notepad is still the default).

I was able to do this on my old Win2K box with Vim
6.something.

What's up?

Thanks,
Jeff







  




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

2006-12-01 Thread Jeffrey Robertson
That's just a different way into the same dialog box I used in
the first place.  It doesn't work for me.  Although I can select
gvim.exe, it doesn't actually take effect.  To be clear:
1) I click Change  It says notepad is the default.
2) I click browse, and pick gvim.exe, and click Open.
3) Notepad is still listed as the default.

Does gvim have to "register" something with Windows to get recognized
as a valid choice?

-- Jeff.

-Original Message-
From: Krall, Ed-P27726 [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 12:45 PM
To: Robertson, Jeffrey (CAR:QW32); Dudley Fox; vim@vim.org
Subject: RE: I can't make gvim the default application for .txt files in
WinXP

I have many file types mapped into GVIM: .txt, .lst, .cfg, and others.

Go to Windows explorer ("my computer"), tools --> Folder Options, and
select the File Types tab.   Select the extestion or file type, click
the Change button, and select or specify the application.


Ed 




 
-Original Message-
From: Jeffrey Robertson [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 9:08 AM
To: Dudley Fox; vim@vim.org
Subject: RE: I can't make gvim the default application for .txt files in
WinXP

Thanks for replying.
 
I do this and it doesn't work.
 
By "gvim", I assume you mean gvim.exe.
 
When I do this, after I select gvim.exe and that dialog closes, the
"Open with" dialog still shows Notepad selected.  I can't get gvim to
show up as an option in the program chooser list.  I can get vim, but I
want gvim.
 
Any idea what's up?


From: Dudley Fox [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 6:06 PM
To: Robertson, Jeffrey (CAR:QW32); vim@vim.org
Subject: Re: I can't make gvim the default application for .txt
files in WinXP


Jeffrey,
Try this:

1. Right click on a .txt file
2. Select the "Open With" menu option
3. Select the "Choose Program..." menu option
4. Check the "Always use the selected program to open this kind
of file" checkbox 
5. Select gvim, you may have to browse to it.
6. Click ok.


This should work for you, though you will have to do this for
each file type you want gvim to open. If that does not work please let
me know. There are other ways to achieve this, but this is the easiest. 

Sincerely,
Dudley


On 11/30/06, Jeffrey Robertson <[EMAIL PROTECTED]> wrote: 

Hi:

I just installed Vim 7.0 on my Windows XP box.  I cannot
force files
with .txt (or any other extension) to automatically open
in gvim.
However, I do have the "edit with vim" option in my
right-click menu. 

If I try to specify a new program to use for .txt and
navigate to the
folder with gvim.exe, even if I select it, it doesn't
take effect
(Notepad is still the default).

I was able to do this on my old Win2K box with Vim
6.something.

What's up?

Thanks,
Jeff






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

2006-12-01 Thread Krall, Ed-P27726
I have many file types mapped into GVIM: .txt, .lst, .cfg, and others.

Go to Windows explorer ("my computer"), tools --> Folder Options, and
select the File Types tab.   Select the extestion or file type, click
the Change button, and select or specify the application.


Ed 




 
-Original Message-
From: Jeffrey Robertson [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 01, 2006 9:08 AM
To: Dudley Fox; vim@vim.org
Subject: RE: I can't make gvim the default application for .txt files in
WinXP

Thanks for replying.
 
I do this and it doesn't work.
 
By "gvim", I assume you mean gvim.exe.
 
When I do this, after I select gvim.exe and that dialog closes, the
"Open with" dialog still shows Notepad selected.  I can't get gvim to
show up as an option in the program chooser list.  I can get vim, but I
want gvim.
 
Any idea what's up?


From: Dudley Fox [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 6:06 PM
To: Robertson, Jeffrey (CAR:QW32); vim@vim.org
Subject: Re: I can't make gvim the default application for .txt
files in WinXP


Jeffrey,
Try this:

1. Right click on a .txt file
2. Select the "Open With" menu option
3. Select the "Choose Program..." menu option
4. Check the "Always use the selected program to open this kind
of file" checkbox 
5. Select gvim, you may have to browse to it.
6. Click ok.


This should work for you, though you will have to do this for
each file type you want gvim to open. If that does not work please let
me know. There are other ways to achieve this, but this is the easiest. 

Sincerely,
Dudley


On 11/30/06, Jeffrey Robertson <[EMAIL PROTECTED]> wrote: 

Hi:

I just installed Vim 7.0 on my Windows XP box.  I cannot
force files
with .txt (or any other extension) to automatically open
in gvim.
However, I do have the "edit with vim" option in my
right-click menu. 

If I try to specify a new program to use for .txt and
navigate to the
folder with gvim.exe, even if I select it, it doesn't
take effect
(Notepad is still the default).

I was able to do this on my old Win2K box with Vim
6.something.

What's up?

Thanks,
Jeff






question on gf and path

2006-12-01 Thread Ben K.


Is there a way to make gf open "some.file" from this line?

Include("/includes/some.file");

where the file is actually sitting under web server root, like

/var/www/html/includes/some.file

I tried adding "/var/www/html" to the :set path but vim will not recognize 
it. /var/www/html/; was the same. Basically I'm looking for a way to add 
"prefixes".


On the same note, would it be possible to let gf open

/var/www/html/includes/some.file

when I gf on this string

http://somehost.com/includes/some.file

or by defining a new command (say wf)?


Thanks.




Ben K.
Developer
http://benix.tamu.edu


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

2006-12-01 Thread Jeffrey Robertson
Thanks for replying.
 
I do this and it doesn't work.
 
By "gvim", I assume you mean gvim.exe.
 
When I do this, after I select gvim.exe and that dialog closes, the
"Open with" dialog still shows Notepad selected.  I can't get gvim to
show up as an option in the program chooser list.  I can get vim, but I
want gvim.
 
Any idea what's up?


From: Dudley Fox [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 30, 2006 6:06 PM
To: Robertson, Jeffrey (CAR:QW32); vim@vim.org
Subject: Re: I can't make gvim the default application for .txt
files in WinXP


Jeffrey,
Try this:

1. Right click on a .txt file
2. Select the "Open With" menu option
3. Select the "Choose Program..." menu option
4. Check the "Always use the selected program to open this kind
of file" checkbox 
5. Select gvim, you may have to browse to it.
6. Click ok.


This should work for you, though you will have to do this for
each file type you want gvim to open. If that does not work please let
me know. There are other ways to achieve this, but this is the easiest. 

Sincerely,
Dudley


On 11/30/06, Jeffrey Robertson <[EMAIL PROTECTED]> wrote: 

Hi:

I just installed Vim 7.0 on my Windows XP box.  I cannot
force files
with .txt (or any other extension) to automatically open
in gvim.
However, I do have the "edit with vim" option in my
right-click menu. 

If I try to specify a new program to use for .txt and
navigate to the
folder with gvim.exe, even if I select it, it doesn't
take effect
(Notepad is still the default).

I was able to do this on my old Win2K box with Vim
6.something.

What's up?

Thanks,
Jeff






Re: Useful Tools to Assist Editing (Not just VIM)

2006-12-01 Thread Aaron Griffin

On 11/30/06, zzapper <[EMAIL PROTECTED]> wrote:

I've done a page to describe these tools in more details.

http://successtheory.com/tips/vimtools.php


Related note, but not on topic:
I like slimKEYS under windows for global hotkey management:
http://slimcode.com/slimKEYS/


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Charles E Campbell Jr

[EMAIL PROTECTED] wrote:


I am puzzled by a slightly more complicated version:
how to match a '%' character following the 2nd occurrence of "home"?
 


/^.\{-}\%(home.\{-1,}\)\{N}home.\{-}\zs%

where N is 1 for the "2nd occurrence" (N is 2 for the third occurrence, 
etc).


This pattern matches up to and including the 2nd home, extends past a 
minimal amount of anything up to but not including a %, whereupon the 
pattern matching starts.


Regards,
Chip Campbell



Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread mzyzik
All,

I am puzzled by a slightly more complicated version:
how to match a '%' character following the 2nd occurrence of "home"?

--Matt

On Fri, Dec 01, 2006 at 09:09:17AM -0500, Charles E Campbell Jr wrote:
> Peter Hodge wrote:
> 
> >Try:
> >
> > /^.\{-}home.\{-}\zshome
> >
> >
> >for your reference:
> >
> > \{-} makes the '.' match as little as possible
> > \zs makes the search match begin at this point in the pattern
> >
> > 
> >
> To generalize to the n-th occurrence:  (put the qty of skipped matches in N)
> 
> /^.\{-}\%(home.\{-1,}\)\{N}\zshome
> 
> So, for the 2nd home: let N=1.
> 
> Regards,
> Chip Campbell
> 


Re: Inverse Folding?

2006-12-01 Thread Charles E Campbell Jr

Vigil wrote:

Because I often want to concentrate on a small section of code in a 
large script, and because my terminal window is large, I wondered if 
it was possible to select some text and have all other text, ie. the 
surrounding text, fade out in colour, or use a darker colour or 
something, so that when I flick away to read another tab and flick 
back, I don't have to manually search out the small block of code again.


I did a search on vim.org to see if anyone had already done this, but 
came across a tip that lead me to manually fold away the code that I 
don't want to see, ie. the code above, and the code below, the subject 
code.


Now I'm wondering if it is possible to select a block of text and 
issue a fold command that folds away everything BUT the selected text.



I have the following in my <.vimrc>:

nnoremap  :exe 'silent! normal! 
'.((foldclosed('.')>0)? 'zMzx' : 'zc')


This map is useful for when you have syntax or marker based folding 
enabled.  Just go someplace, and while in normal mode use the  bar.


Now, if your file isn't already supporting a bunch of folds, then you'll 
want to manually fold code above and below as you have been doing.  To 
simplify the process:


vnoremap  :fo1,'<-1fo'>+1,$fo

With these two maps you have a solution!  Just visually select the 
region of interest, then hit your space bar twice.  Plus, each map by 
itself is useful.


Regards,
Chip Campbell



Inverse Folding?

2006-12-01 Thread Vigil
Because I often want to concentrate on a small section of code in a large 
script, and because my terminal window is large, I wondered if it was possible 
to select some text and have all other text, ie. the surrounding text, fade out 
in colour, or use a darker colour or something, so that when I flick away to 
read another tab and flick back, I don't have to manually search out the small 
block of code again.


I did a search on vim.org to see if anyone had already done this, but came 
across a tip that lead me to manually fold away the code that I don't want to 
see, ie. the code above, and the code below, the subject code.


Now I'm wondering if it is possible to select a block of text and issue a fold 
command that folds away everything BUT the selected text.


--

.


Knowing the name vim was invoked under

2006-12-01 Thread DervishD
Hi all :)

I would like to share the same .vimrc for "vim" and "view", so I can
use "view" as a pager without having to use "-u" in the command line. So
far, I've thought that the only way of knowing if I'm under "vim" or
"view" mode is to check the value of "readonly". Not perfect, but it
will do.

The problem is that I would like to use vim with other
"personalities" (different sets of options) depending on its invocation
name. Can this be done? I haven't found in the documentation any
function to retrieve the full command line, just the file argument list.

Any suggestion about how to discriminate in the .vimrc file
depending on the invocation name for vim?

Thanks a lot in advance :)

Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread Charles E Campbell Jr

Peter Hodge wrote:


Try:

 /^.\{-}home.\{-}\zshome


for your reference:

 \{-} makes the '.' match as little as possible
 \zs makes the search match begin at this point in the pattern

 


To generalize to the n-th occurrence:  (put the qty of skipped matches in N)

/^.\{-}\%(home.\{-1,}\)\{N}\zshome

So, for the 2nd home: let N=1.

Regards,
Chip Campbell



Re: Call a vim function from the command line

2006-12-01 Thread Thomas

Is it possible to invoke a function in vim automatically?
I'd like to process a text file automatically. I *could* write an
onload for the specific file that calls a functions, saves and exists,
but it does not strike me as very elegant.

Is there anything like

vim -auto -text_file -function



:h starting.txt

Something like:
vim -c "call function()" -c qa! text_file

or so?



Re: suggestions for ssh under windows

2006-12-01 Thread Charles E Campbell Jr

Charles E Campbell Jr wrote:

I have a netrw user using WinXP who wants to use ssh; currently, he 
doesn't have such an executable.
I tend to use cygwin, but that's like asking one to build a home 
instead of new cabinets for the kitchen.


So, where can he get ssh for WinXP?

I'm likely to put a synopsis of any answers in netrw's help.



Hello!

Thank you for your suggestions -- as I mentioned, I'll be including a 
synopsis in netrw's help.  Looks
like there're four solutions: putty, openssh, gnuwin32, and including a 
couple of files from cygwin
(although for that last case I'm not sure how one would get just the two 
without downloading the

entire distribution).  It'll be netrw-problem #8 (:help netrw-P8).

Regards,
Chip Campbell




Call a vim function from the command line

2006-12-01 Thread Samuel Wright

Hi All,

Is it possible to invoke a function in vim automatically?
I'd like to process a text file automatically. I *could* write an
onload for the specific file that calls a functions, saves and exists,
but it does not strike me as very elegant.

Is there anything like

vim -auto -text_file -function

That I can use for this?

Sam


Re: Disable in insert mode

2006-12-01 Thread Ying Bian

Tony,

Yes, you got it.  I just checked it and found a couple insert mode
mappings with an initial comma.  They are defined by a plugin.

I uninstalled that plugin and the delay went away.

Thanks,

--
B.Y.

On 11/30/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Ying Bian wrote:
> Vimers,
>
> I set my mapleader to comma (,).  Although I do not have any
> insert-mode maps starting
> with comma, whenever I type "," in insert mode, it still waits for a
> while (the value of
> timeoutlen).
>
> Is there any way to "disable" the mapleader in insert mode so that vim
> will be more
> responsive when I type the mapleader?
>

The mapleader value is used when the mapping is _defined_ not invoked.

Check your mappings:

:map!

Don't forget the exclamation mark. Are you sure you don't see any mapping
there with an initial comma?

Also

:echo hasmapto(',', 'i')

The answer should be zero if you have no insert-mode mapping to anything that
includes a comma, one if you do.

Note that you can type the next character after the comma (usually a space)
regardless of whether you already see the comma displayed in Vim. If
comma-space is not mapped, typing them will make both bytes appear in the 
buffer.


You may try the following, but I don't think it will work:

autocmd InsertEnter * let mapleader = ""
autocmd InsertLeave * let mapleader = ","


Best regards,
Tony.




--
B.Y.


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread zzapper
"A.J.Mechelynck" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> Bill McCarthy wrote:
>> On Thu 30-Nov-06 11:49pm -0600, Peter Hodge wrote:
>>> --- Bill McCarthy wrote:
 On Thu 30-Nov-06 10:24pm -0600, Peter Hodge wrote:
> --- Bill McCarthy wrote:
>> On Thu 30-Nov-06 9:20pm -0600, Peter Hodge wrote:
>> 
>>> Try:
>>>
>>>   /^.\{-}home.\{-}\zshome
>>>

/^.\{-}home.\{-}\zshome/e

Was the solution I was looking for (BTW the /e indicates where the match 
ends)

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



Re: multiples search and replace in the same command? (fwd)

2006-12-01 Thread Vigil

-- Forwarded message --
Date: Fri, 1 Dec 2006 11:05:48 +0100
From: Tanoor Dieng <[EMAIL PROTECTED]>
To: Vigil <[EMAIL PROTECTED]>
Subject: Re: multiples search and replace in the same command?

On 12/1/06, Vigil <[EMAIL PROTECTED]> wrote:

This could be construed as one command:

%s/e/EEE/g | %s/a/AAA/g



Thank you all for your answers. I've subscrived to this list yesterday
and only by posting one message, i've learned a lot of things. That's
great !
Although all solutions presented are interesring, i think i'll use
Vigil's one aka:

%s/e/EEE/g | %s/a/AAA/g


It is simple and perfectly adapted to what i want to do.

Thanks again.
Best regards,
Tanoor.


Re: multiples search and replace in the same command?

2006-12-01 Thread Vigil

This could be construed as one command:

%s/e/EEE/g | %s/a/AAA/g

On Thu, 30 Nov 2006, Tanoor Dieng wrote:


Hi, i'm trying to replace all occurrences of characaters like é, è, ê
etc ... by their corresponding htmlentities. To do that, i use the
following command:
%s/é/\é/g

The problem with that command is that i have to do that for all
characters. I was wandering if there's a way to do it with only one
command.


Best regards.



--

.

Re: suggestions for ssh under windows

2006-12-01 Thread A.J.Mechelynck
[EMAIL PROTECTED] wrote:
> "A.J.Mechelynck" <[EMAIL PROTECTED]> 写于 2006-12-01 04:58:02:
>> For individual Unix-like programs needed for work in a native-Windows
>> environment, I recommend getting them from the GnuWin32 project on
>> sourceforge
>> if it has them ( http://gnuwin32.sourceforge.net/ or something like that;
> not
>> 100% sure of the URL). Unlike Cygwin, which sets up a Unix-like virtual
>> machine on top of Windows, GnuWin32 is a rewrite of Unix utilities with
>> Windows system calls, and its programs works quite well in the cmd.
>> exe "Dos box".
>>
>> I have also occasionally tested unxutils but not with as much success.
> 
> A virtual machine emulates things so that the performance degrades. If
> Cygwin is really an emulation engine to build a virtual machine, it will
> have poor performance. But that is not the case. Compile the same source
> within Cygwin and Visual C++, chances are that you will get better
> performance in Cygwin!
> 
> Cygwin is not setting up a unix-like virtual machine, instead, it redirect
> Unix system call to Windows system call at source level, so the performance
> is as good as Windows Native applications.
> 
> An example: I had compiled 3 versions of LAME 3.97, on Cygwin, Visual C++ 7
> and Ubuntu Linux, and had done a thorough test, the Cygwin version of the
> lame.exe has the best performance. it is even faster than the same
> application compiled under linux in the same computer with the same version
> of gcc.
> 
> --
> Sincerely, Pan, Shi Zhu. ext: 2606
> 
> 

I'm not talking about the programs produced by the MinGW-for-Cygwin compiler
and linker (gcc compiler with -mno-cygwin and gcc linker with -mwindows),
which is a cross-compiler and cross-linker, but about the cygwin1.dll and the
programs which use it. These programs are doing Unix system calls, which the
cygwin1.dll translates into Windows system calls. The programs you talk about
(including Steve Hall's Vim for Windows) are doing Windows system calls at the
C-object-library level, even though they were compiled by a compiler and
linker issuing Unix system calls to the cygwin1.dll.

With Windows plus cygwin1.dll you have a "virtual Unix kernel" emulated by the
DLL running on top of Windows. I stand my case.


Best regards,
Tony.


Re: Disabling *system-wide* plugins

2006-12-01 Thread DervishD
Hi Bill :))

 * Bill McCarthy <[EMAIL PROTECTED]> dixit:
> On Thu 30-Nov-06 2:26pm -0600, DervishD wrote:
> > I want to be able to NOT load the plugins in my system-wide runtime
> > directory, and instead loading my own set of plugins, and only
> > those. So far, I know that "set noloadplugins" will do the job,
> > partially. This won't load the default plugins in the
> > $VIMRUNTIME/plugins directory, ok, but then my own plugins won't be
> > loaded from "~/.vim/plugins".
> >
> > Apart from sourcing them manually from my .vimrc (which is not
> > difficult), is there any other way of avoiding the loading of the
> > plugins in the runtime directory but load the ~/.vim/plugins ones? Of
> > course, a good way would be not installing the default plugins in the
> > first place, but I want them available for the rest of users in my
> > system (a fellow programmer, specially).
> 
> The simplest is to modify your vimrc.  Add something like
> this:
> 
> se nolpl

This seemed obvious to me, but...

> let x = &rtp
> se rtp-=$VIMRUNTIME
> ru! plugin/**/*.vim
> let &rtp = x

...not this! This is a simple and elegant solution to my problem,
THANKS A LOT! Gosh, I'm really amazed with the people in this list :)

Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736 | http://www.dervishd.net
It's my PC and I'll cry if I want to... RAmen!


Re: Matching JUST the nth occurence of a text in a line

2006-12-01 Thread A.J.Mechelynck

Chuck Mason wrote:

Am I the only one amused that /homen   does nearly the same thing?
I mean, I suppose you could be doing operations on your search but
couldn't you equally just "ayw and do stuff there?  Besides \{-}\zs
takes too long to type :)


To go to the 2nd occurrence from the cursor, you can use

2/home

(or 2/\ if you want to exclude "homeless" etc.) but all occurrences 
will be highlighted.



Best regards,
Tony.