Re: Gvim closing unexpectedly

2006-11-08 Thread Edward Wong

Yup, I can confirm it too. I'm in Windows with cygwin and command
:echo has(tcl) crashes gvim.  :)

On 10/5/06, Steve Hall [EMAIL PROTECTED] wrote:

From: Greg Dunn, Thu, October 05, 2006 9:36 am
 On 10/4/06, Steve Hall wrote:
  On Thu, 2006-10-05 at 10:04 +1000, Robbie Gates wrote:
  
   i was having problems with gvim hanging when i tried to edit my
   vimrc. After a bit of sleuthing, i tracked it down to has(tcl)
   hanging (called from syntax/vim.vim).
 
  It appears your post and one on the vim list are related:
 
http://tech.groups.yahoo.com/group/vim/message/74227
http://tech.groups.yahoo.com/group/vimdev/message/45215

 Yep, I have cygwin, and yep, the dummy tcl84.dll fixed the problem.

I, too, can now confirm that the Cygwin tcl84.dll on path prior to any
others causes :echo has(tcl) to hang.

Can anyone here using a Windows binary different from those packaged
by Cream reproduce this?



--
Steve Hall  [ digitect dancingpaper com ]




Is abuf always guaranteed to be the same as afile and is afile always guaranteed to be unique?

2006-11-08 Thread Nikolai Weibull

Is abuf always guaranteed to be the same as afile and is afile
always guaranteed to be unique?

 nikolai


Re: Is abuf always guaranteed to be the same as afile and is afile always guaranteed to be unique?

2006-11-08 Thread A.J.Mechelynck

Nikolai Weibull wrote:

Is abuf always guaranteed to be the same as afile and is afile
always guaranteed to be unique?

 nikolai



1. No. From :help afile:
afilewhen executing autocommands, is replaced with the file name
   for a file read or write
abuf when executing autocommands, is replaced with the currently
   effective buffer number (for :r file and :so file it is
   the current buffer, the file being read/sourced is not in a
   buffer).

IOW, for :read and :source, abuf is the current buffer and afile is not.

2. What do you mean, unique? A file can be opened in several windows, but the 
buffer will normally be the same (I'm not sure about the case when a file is 
opened by different names, owing to soft -- or, worse, hard -- links).



Best regards,
Tony.


Re: Is abuf always guaranteed to be the same as afile and is afile always guaranteed to be unique?

2006-11-08 Thread Nikolai Weibull

On 11/8/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Nikolai Weibull wrote:
 Is abuf always guaranteed to be the same as afile and is afile
 always guaranteed to be unique?

  nikolai


1. No. From :help afile:
afilewhen executing autocommands, is replaced with the file name
   for a file read or write
abuf when executing autocommands, is replaced with the currently
   effective buffer number (for :r file and :so file it is
   the current buffer, the file being read/sourced is not in a
   buffer).

IOW, for :read and :source, abuf is the current buffer and afile is not.


Ah, sorry.  My question was incomplete.  Is abuf guaranteed to be
equal to afile for all commands where a file isn't being
read/sourced?  Specifically, do they refer to the same buffer for
BufDelete?  The BufDelete documentation suggests using afile, but
I'd much prefer using the buffer number.


2. What do you mean, unique? A file can be opened in several windows, but the
buffer will normally be the same (I'm not sure about the case when a file is
opened by different names, owing to soft -- or, worse, hard -- links).


Forget it.  Turns out that afile expands to the full path, so yes,
it's unique.  The BufDelete  documentation confused me because it
sounds like it's talking about the buffer name, not the buffer's
file's path.

Thanks.

 nikolai


Re: Is abuf always guaranteed to be the same as afile and is afile always guaranteed to be unique?

2006-11-08 Thread A.J.Mechelynck

Nikolai Weibull wrote:
[...]

Ah, sorry.  My question was incomplete.  Is abuf guaranteed to be
equal to afile for all commands where a file isn't being
read/sourced?  Specifically, do they refer to the same buffer for
BufDelete?  The BufDelete documentation suggests using afile, but
I'd much prefer using the buffer number.

[...]

I don't know; and since I don't know, I wouldn't bet on it one way or another.

Best regards,
Tony.


Re: Is abuf always guaranteed to be the same as afile and is afile always guaranteed to be unique?

2006-11-08 Thread Nikolai Weibull

On 11/8/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Nikolai Weibull wrote:



 Ah, sorry.  My question was incomplete.  Is abuf guaranteed to be
 equal to afile for all commands where a file isn't being
 read/sourced?  Specifically, do they refer to the same buffer for
 BufDelete?  The BufDelete documentation suggests using afile, but
 I'd much prefer using the buffer number.



I don't know; and since I don't know, I wouldn't bet on it one way or another.


Hehe :-)

 nikolai


Re: command line completion on several lines

2006-11-08 Thread koxinga


(for those of you who don't follow vim@vim.org, this is an answer to a 
message posted there because I got confused and posted in both lists ...)


A.J.Mechelynck wrote:

koxinga wrote:

koxinga wrote:

Hello,

[...]

It won't work with multibyte.

[...]

Any feedback appreciated, of course ...

koxinga


No feedback at all ? Not even a nice you dumbass, it doesn't even 
compile or a this is not a feature, this is a bug, moron ?



koxinga



Anything doesn't work with multibyte, I'm not interested. UTF-8 is 
essential to my use of Vim.



Best regards,
Tony.

Well, it doesn't work because I made it just to show what I would like 
to have and I don't really know how to deal with multibyte in vim. It is 
not inherent to the modification I propose. If someone does this 
correctly, it should work fine with multibyte.


However, nobody seems interested so I think I will just forget it and 
keep the patch for my personal use :(.


koxinga



RE: vim.org refreshed mockup

2006-11-08 Thread Zdenek Sekera
 -Original Message-
 From: Gavin Gilmour [mailto:[EMAIL PROTECTED] 
 Sent: 08 November 2006 09:51
 To: Panos Laganakos
 Cc: vim@vim.org
 Subject: Re: vim.org refreshed mockup
 
 Seconding the Looks nice comments.
 

Mee too, but the readability (the color set) still needs to
be improved.

---Zdenek


 * Panos Laganakos [EMAIL PROTECTED] [2006-11-07 
 19:59:57 +0200]:
 
  I made a mockup of a refreshed version of vim.org, trying 
 to maintain
  as much of the original look as possible:
  
  http://panos.solhost.org/mockups/vimorg-01.png
  
  vim tangofied icon by toZth
  
  -- 
  Panos Laganakos
  
 


Re: Gvim closing unexpectedly

2006-11-08 Thread Edward Wong

Yup, I can confirm it too. I'm in Windows with cygwin and command
:echo has(tcl) crashes gvim.  :)

On 10/5/06, Steve Hall [EMAIL PROTECTED] wrote:

From: Greg Dunn, Thu, October 05, 2006 9:36 am
 On 10/4/06, Steve Hall wrote:
  On Thu, 2006-10-05 at 10:04 +1000, Robbie Gates wrote:
  
   i was having problems with gvim hanging when i tried to edit my
   vimrc. After a bit of sleuthing, i tracked it down to has(tcl)
   hanging (called from syntax/vim.vim).
 
  It appears your post and one on the vim list are related:
 
http://tech.groups.yahoo.com/group/vim/message/74227
http://tech.groups.yahoo.com/group/vimdev/message/45215

 Yep, I have cygwin, and yep, the dummy tcl84.dll fixed the problem.

I, too, can now confirm that the Cygwin tcl84.dll on path prior to any
others causes :echo has(tcl) to hang.

Can anyone here using a Windows binary different from those packaged
by Cream reproduce this?



--
Steve Hall  [ digitect dancingpaper com ]




Re: vim.org refreshed mockup

2006-11-08 Thread Charles E Campbell Jr

Richard Querin wrote:


On 11/7/06, Brian McKee [EMAIL PROTECTED] wrote:


It's IE that adds the dark blue I think

Brian



Yeah. Just checked. It shows a blue background instead of white in
IE6. I assume it's just a .png support problem.



No, its not IE6; I'm using Mozilla 1.7.12.  Gene K also had problems 
with the background,

in his case some sort of checkerboard pattern showed.

My background is normally dark blue; I believe that the png doesn't 
specify the background

properly.

Chip




Re: Creating a custom browser window.

2006-11-08 Thread Yegappan Lakshmanan

Hello,

On 11/7/06, Alan Young [EMAIL PROTECTED] wrote:

Please forgive me if I use the incorrect terms ... I've been using vim
for years, but am just now getting into more than just the editing part.

I am writing a vim plugin using perl's Net::Blogger so I can make my
blogs entries from vim.  What I'd like to do, if possible, is create a
window that lists the blogs and entries in a window like the one created
when you try to edit a directory.  You can move the cursor up and down
but you can't modify the contents of the buffer.  When you press enter
on an entry it either displays the directory or edits the file.

So, something like this initially:

Blog1
Blog2

When you press enter on Blog1 you'll get:

Blog1
  Article1
  Article2
Blog2

When you press enter on Article1 you'll get a buffer with the contents
of Article1 to modify and repost.

I've gotten the perl/vim interaction down I think, and I program in perl
professionally--this isn't my problem.  I have no idea as to how to go
about doing the above.  Any pointers?

With VIm7 I think I can use the Lists and/or Dictionaries data types
(they seem to be the same as perls array/list and hash types) but I'm
just clueless on how to get the data into the buffer I described, or
even how to create that buffer.



You can use the tree control plugin to implement the above.
The tree control plugin provides a generic tree control interface
to other Vim plugins. The documentation for this plugin is
available at the following page:

http://www.geocities.com/yegappan/treectrl/treectrl.html

You can download the plugin from:

http://www.geocities.com/yegappan/treectrl/treectrl.zip

Let me know, if you have any comments or suggestions.

- Yegappan


Re: Creating a custom browser window.

2006-11-08 Thread Yegappan Lakshmanan

Hi,

On 11/8/06, Alan Young [EMAIL PROTECTED] wrote:

Yegappan Lakshmanan wrote:
 You can use the tree control plugin to implement the above.

Thank you.  I will take a look.



If you need a sample code that uses the tree control, you can use
the attached file explorer plugin. Place this file in the ~/.vim/plugin
directory.

To open the file explorer, use the following command:

   :FileTreeOpen [dirname]

- Yegappan


filetree.vim
Description: Binary data


Re: chasing symlink

2006-11-08 Thread Yakov Lerner

On 10/26/06, Charles E Campbell Jr [EMAIL PROTECTED] wrote:

Yakov Lerner wrote:

 Let's say I edit file x (vim x) which is a symlink, x-y.
 (Linux). How can I make a script that opens y
 instead of x in the buffer (chases the symlinks and opens it)

I guess I don't understand exactly what you're doing here.
Let me explain:

echo junk1  file1
ln -s file1 file2
vim file2

This shows file1's contents; ie. junk1.  So, I'm editing the target
of the symlink file, not the symlink file itself.  In fact, I'm not sure
how to edit that symlink file, but I don't think that's what you're
asking for.


The problem at hand here is that there is checked-out file, X,
under SVN control, and a symlink Y-X, and Y is outside of
checked-out subtree, and I want to check-in file from inside vim.

I can edit the file as X or as Y, fine. But if I try to check in file
under [symlinked] name Y, then SVN cannot do it.
I need to chase the link in vim and check it in under name X.

Yakov


Re: vim.org refreshed mockup

2006-11-08 Thread Kim Schulz
On Tue, 7 Nov 2006 19:59:57 +0200
Panos Laganakos [EMAIL PROTECTED] wrote:

 I made a mockup of a refreshed version of vim.org, trying to maintain
 as much of the original look as possible:
 
 http://panos.solhost.org/mockups/vimorg-01.png
 
 vim tangofied icon by toZth
 
In general I find it ok, but as some others has mentioned, the light
gray used for dates is too close to the color of the background. 
The logo area should say Vim  clearly such that you can actually see
what the page is all about. Dont like the icon for the page. It is
probably nice for the desktop, but its childish look dont match a
fullblown professional editor like Vim. 

Personally I would love to have the page split up in two parts 
 - general vim information, download, official news, docs 
 - community pages, scripts, tips, forum, less official news. 
This way we could make the community part grow with new features while
still maintaining a professional, easy to overlook, information packed
page for those just coming for the download and docs. 



-- 
Kim Schulz| Private :  http://www.schulz.dk
[EMAIL PROTECTED] | Business:  http://www.devteam.dk
+45 5190 4262 | Sparetime: http://www.fundanemt.com


Re: Creating a custom browser window.

2006-11-08 Thread Alan Young
Yegappan Lakshmanan wrote:
 If you need a sample code that uses the tree control, you can use
 the attached file explorer plugin. Place this file in the ~/.vim/plugin
 directory.
 
 To open the file explorer, use the following command:
 
:FileTreeOpen [dirname]


Where do I put the treectl.vim file? I put it in .vim/plugin and tried
an autoload directory under .vim (your zip has that directory in it) but
filetree.vim won't load (I added an echo in the block that checks for
treectrl#available and go the echo on startup).


Re: Creating a custom browser window.

2006-11-08 Thread A.J.Mechelynck

Alan Young wrote:

Yegappan Lakshmanan wrote:

If you need a sample code that uses the tree control, you can use
the attached file explorer plugin. Place this file in the ~/.vim/plugin
directory.

To open the file explorer, use the following command:

   :FileTreeOpen [dirname]



Where do I put the treectl.vim file? I put it in .vim/plugin and tried
an autoload directory under .vim (your zip has that directory in it) but
filetree.vim won't load (I added an echo in the block that checks for
treectrl#available and go the echo on startup).



Did you restart Vim after you put it in ~/.vim/plugin (for Unix) or 
~/vimfiles/plugin (for Windows)? If you didn't, you should have.


The file containing the function treectl#available() should be named 
[directory]/autoload/treectl.vim where [directory] is ~/.vim or ~/vimfiles, as 
above.


Best regards,
Tony.


Re: generate a directory listing file with vim.

2006-11-08 Thread Christian Ebert
* A.J.Mechelynck on Monday, November 06, 2006 at 09:44:05 +0100:
 Method II : Using netrw
 -
 new .

I just realize that this doesn't work for me (anymore) with
latest Vim7 (it still works with Vim6.2 that I have here as well.

It works neither works with netrw from CVS nor with the one I get
with GetLatestVimScripts.

Any idea what's going on?

c
-- 
_B A U S T E L L E N_ lesen! --- http://www.blacktrash.org/baustellen.html


Re: Creating a custom browser window.

2006-11-08 Thread Yegappan Lakshmanan

Hi Alan,

On 11/8/06, Alan Young [EMAIL PROTECTED] wrote:

Yegappan Lakshmanan wrote:
 If you need a sample code that uses the tree control, you can use
 the attached file explorer plugin. Place this file in the ~/.vim/plugin
 directory.

 To open the file explorer, use the following command:

:FileTreeOpen [dirname]


Where do I put the treectl.vim file? I put it in .vim/plugin and tried
an autoload directory under .vim (your zip has that directory in it) but
filetree.vim won't load (I added an echo in the block that checks for
treectrl#available and go the echo on startup).



You should place the treectrl.vim file in the ~/.vim/autoload directory.
The filetree.vim plugin should be placed in the ~/.vim/plugin
directory.

- Yegappan


Re: Creating a custom browser window.

2006-11-08 Thread Alan Young
A.J.Mechelynck wrote:
 Did you restart Vim after you put it in ~/.vim/plugin (for Unix) or

I figured out my problem ... I've only got up to patch 110 installed.
I'll have to recompile and try again.


Re: Spurious undefined variable error generated for certain valid ternary expressions

2006-11-08 Thread Bram Moolenaar

Brett Stahlman wrote:

 The following expression
 
 var10?var:10
 
 generates the following errors:
 
 E121: Undefined variable: var:10
 E15: Invalid expression: var10?var:10
 
 The reason is that find_name_end uses eval_isnamec unconditionally to
 decide whether a character is a valid variable name character, 
 with the result that `:' is always gobbled up as part of the variable
 name, even if it's not the second character in the name string 
 (ie, even if it doesn't separate the scope prefix from the variable
 name). find_var_ht, on the other hand, will not permit a colon
 anywhere but at character index 1 in the variable name; hence, E121,
 and ultimately, E15.
 
 Since `:' is part of a valid VimL operator, and is not valid anywhere
 other than at index 1 in a non-curly-brace variable name, 
 there is no ambiguity in the expression shown above. For expressions such as
 
 b10?b:a
 
 the ambiguity would be resolved according to the relative precedence
 of the ternary operator and the variable scope separator (`:').  I
 would assume that the precedence of the scope operator would be higher
 (since Vim treats it as part of 'variable', whose 
 precedence is much higher than that of the ternary operator); hence,
 in the preceding example, the expression would be evaluated as
 
 (b10)?(b:a)
 
 which would indeed be a syntax error...
 
 Should eval_isnamec (or perhaps its caller) take into consideration
 the character index when deciding whether `:' is to be 
 considered part of the variable name?

The docs clearly state:

You should always put a space before the ':', otherwise it can
be mistaken for use in a variable such as a:1.

In some cases var:10 can be recognized as not being a variable name, but
this leads to undetected mistakes and makes it difficult to add more
scopes later.

It's a good habit to put spaces around ? and : anyway.  Unless you never
read back what you've written perhaps.

-- 
hundred-and-one symptoms of being an internet addict:
182. You may not know what is happening in the world, but you know
 every bit of net-gossip there is.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///


Re: Creating a custom browser window.

2006-11-08 Thread Yegappan Lakshmanan

Hi Alan,

On 11/8/06, Alan Young [EMAIL PROTECTED] wrote:

A.J.Mechelynck wrote:
 Did you restart Vim after you put it in ~/.vim/plugin (for Unix) or

I figured out my problem ... I've only got up to patch 110 installed.
I'll have to recompile and try again.



You need Vim 7.0.135 and above to use the tree control plugin.
This is explained in the tree control plugin help. The patch 135
fixes a problem in Vim7 relating to garbage collecting recursive
List and Dict data structures.

- Yegappan


Re: vim.org refreshed mockup

2006-11-08 Thread Stefan Karlsson
Panos Laganakos wrote:
 I made a mockup of a refreshed version of vim.org, trying to maintain
 as much of the original look as possible:

 http://panos.solhost.org/mockups/vimorg-01.png

 vim tangofied icon by toZth


I think it looks very good. The only things I would like to change are:

1. The version info (à la Vim 7.0.162 is the current version) should be
   added.

2. The dates. Is 2006.11.03 really better than 2006-11-03?

3. The  to the right of the text in the navigation bar. I think it
   would look better with a  to the *left* of the text.

-- 
Stefan


Re: vim.org refreshed mockup

2006-11-08 Thread Dave Land
* Panos Laganakos [EMAIL PROTECTED] [2006-11-07 19:59:57  
+0200]:



I made a mockup of a refreshed version of vim.org, trying to maintain
as much of the original look as possible:

http://panos.solhost.org/mockups/vimorg-01.png


I like the simplicity, but as others have commented, the overall color
scheme needs more contrast. This is not merely a stylistic  
consideration,

but an accessibility and usability factor.

Here's a contrast analyzer (one of a number that I found by Googling
accessibility color contrast online tool):

http://juicystudio.com/services/colourcontrast.php

According to the tool, the contrast between the grey text and the white
background is too low, as is the contrast between the green navigation
text and its pale yellow background.

Increasing the contrast will make sure that everyone -- including the
vision-impaired -- can view the vim site clearly.


vim tangofied icon by toZth


If folks think that vim needs a new icon, this one's as good as any. I
don't happen to use any other Tango desktop-themed icons, so it is of no
real consequence to me, but it is a nice-looking icon, and it would
certainly be at home on my OS X dock.

Dave Land



Re: vim.org refreshed mockup

2006-11-08 Thread Charles E Campbell Jr

Dave Land wrote:



According to the tool, the contrast between the grey text and the white
background is too low, as is the contrast between the green navigation
text and its pale yellow background.



I don't think that he specifies the background; instead, its whatever your
browser has for a default.

So, I'm sure that if you fiddle with your background that perhaps the 
contrast

could be improved.

Regards,
Chip Campbell



Re: generate a directory listing file with vim.

2006-11-08 Thread Gary Johnson
On 2006-11-08, Christian Ebert [EMAIL PROTECTED] wrote:
 * A.J.Mechelynck on Monday, November 06, 2006 at 09:44:05 +0100:
  Method II : Using netrw
  -
  new .
 
 I just realize that this doesn't work for me (anymore) with
 latest Vim7 (it still works with Vim6.2 that I have here as well.
 
 It works neither works with netrw from CVS nor with the one I get
 with GetLatestVimScripts.
 
 Any idea what's going on?

If you have installed a private/local version of netrw under ~/.vim, 
you must disable the netrw files in the vim share directory.  Either 
remove them all or rename them all, e.g. by adding a suffix .orig.  
I know you don't have to do that for any other plugin, but you do 
for netrw.  I don't know why.

HTH,
Gary

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


Re: generate a directory listing file with vim.

2006-11-08 Thread Christian Ebert
* Gary Johnson on Wednesday, November 08, 2006 at 12:54:43 -0800:
 On 2006-11-08, Christian Ebert [EMAIL PROTECTED] wrote:
 * A.J.Mechelynck on Monday, November 06, 2006 at 09:44:05 +0100:
 Method II : Using netrw
 -
 new .
 
 I just realize that this doesn't work for me (anymore) with
 latest Vim7 (it still works with Vim6.2 that I have here as well.
 
 It works neither works with netrw from CVS nor with the one I get
 with GetLatestVimScripts.
 
 Any idea what's going on?
 
 If you have installed a private/local version of netrw under ~/.vim, 
 you must disable the netrw files in the vim share directory.  Either 
 remove them all or rename them all, e.g. by adding a suffix .orig.  

Ah, ok, thanks, that does the trick.

 I know you don't have to do that for any other plugin, but you do 
 for netrw.  I don't know why.

Hm. In a way the GetLatestVimScripts doesn't make sense for the
netrw stuff, because it does not real AutoInstall. -- Or, it's
for someone like me, who doesn't mind turning off the
system-wide netrw ...

c
-- 
_B A U S T E L L E N_ lesen! --- http://www.blacktrash.org/baustellen.html


Re: getting the current word into command mode line

2006-11-08 Thread Gary Johnson
On 2006-11-08, Chuck Mason [EMAIL PROTECTED] wrote:
 Say cursor is highlighting a word cword, and I want to replace 
 this word with something else everywhere in the file.  My ideal 
 solution would be:
 
 :%s/cword/something/g
 
 But we all know that won't work. So maybe there's a way to insert 
 the current word in the current buffer into the command mode line? 
 Anyone have a solution?  I'd prefer something where I don't have 
 to make a keymapping or create a function so I can use this trick 
 on a clean install.

Type

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

where

^R  is Ctrl-R
^W  is Ctrl-W

See

:help c_CTRL-R_CTRL-W

and

:help c_CTRL-R

for other things you can insert on the command line this way.

HTH,
Gary

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


how can these two act differently?

2006-11-08 Thread mzyzik
All,

I decided to make a mapping that simply hits down whenever the popup
menu comes up. This is to make the popup behavior work more like in
IDEs, where the user can just select the nearest completion item at any
moment by hitting enter (c-y does this in Vim).

Here are two mappings I tried to accomplish my goal:

1. inoremap c-n c-r=pumvisible() ? \ltc-n : 
\ltc-n\ltc-r=pumvisible() ? \\\ltdown\ : \\\ltcrcr
2. inoremap expr c-n pumvisible() ? \ltc-n : 
\ltc-n\ltc-r=pumvisible() ? \\\ltdown\ : \\\ltcr

To me, they should be identical. However, the first doesn't work in some
circumstances, whereas the second always works. Specifically, #1 doesn't
work when the vim/gvim window is not large.

For those of you who like the idea, use mapping #2. Here are more ideas:
set cot+=menuone,longest
inoremap expr cr pumvisible() ? \c-y : \c-gu\cr

--Matt


Re: getting the current word into command mode line

2006-11-08 Thread Bill McCarthy
On Wed 8-Nov-06 5:55pm -0600, Chuck Mason wrote:

 Say cursor is highlighting a word cword, and I want to
 replace this word with something else everywhere in the
 file.

In addition to the solution from Gary, if you want the
\word\ under the cursor you could hit '*', then use:

:%s//something/g

-- 
Best regards,
Bill



Re: Spurious undefined variable error generated for certain valid ternary expressions

2006-11-08 Thread Stahlman Family


- Original Message - 
From: Bram Moolenaar [EMAIL PROTECTED]

To: Stahlman Family [EMAIL PROTECTED]
Cc: vim@vim.org
Sent: Wednesday, November 08, 2006 2:00 PM
Subject: Re: Spurious undefined variable error generated for certain valid 
ternary expressions




Brett Stahlman wrote:


The following expression

var10?var:10

generates the following errors:

E121: Undefined variable: var:10
E15: Invalid expression: var10?var:10

The reason is that find_name_end uses eval_isnamec unconditionally to
decide whether a character is a valid variable name character,
with the result that `:' is always gobbled up as part of the variable
name, even if it's not the second character in the name string
(ie, even if it doesn't separate the scope prefix from the variable
name). find_var_ht, on the other hand, will not permit a colon
anywhere but at character index 1 in the variable name; hence, E121,
and ultimately, E15.

Since `:' is part of a valid VimL operator, and is not valid anywhere
other than at index 1 in a non-curly-brace variable name,
there is no ambiguity in the expression shown above. For expressions such as

b10?b:a

the ambiguity would be resolved according to the relative precedence
of the ternary operator and the variable scope separator (`:').  I
would assume that the precedence of the scope operator would be higher
(since Vim treats it as part of 'variable', whose
precedence is much higher than that of the ternary operator); hence,
in the preceding example, the expression would be evaluated as

(b10)?(b:a)

which would indeed be a syntax error...

Should eval_isnamec (or perhaps its caller) take into consideration
the character index when deciding whether `:' is to be
considered part of the variable name?


The docs clearly state:

You should always put a space before the ':', otherwise it can
be mistaken for use in a variable such as a:1.


Hmm. Ok. I didn't find that text with helpgrep, but I've got Vim7 beta version still on this computer. Perhaps it was added since 
then...


Thanks,
   Brett S.



In some cases var:10 can be recognized as not being a variable name, but
this leads to undetected mistakes and makes it difficult to add more
scopes later.

It's a good habit to put spaces around ? and : anyway.  Unless you never
read back what you've written perhaps.

--
hundred-and-one symptoms of being an internet addict:
182. You may not know what is happening in the world, but you know
every bit of net-gossip there is.

/// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\download, build and distribute -- http://www.A-A-P.org///
\\\help me help AIDS victims -- http://ICCF-Holland.org///





Re: Spurious undefined variable error generated for certain valid ternary expressions

2006-11-08 Thread panshizhu
Stahlman Family [EMAIL PROTECTED] 写于 2006-11-09 09:40:49:
  The docs clearly state:
 
  You should always put a space before the ':', otherwise it can
  be mistaken for use in a variable such as a:1.

 Hmm. Ok. I didn't find that text with helpgrep, but I've got Vim7
 beta version still on this computer. Perhaps it was added since
 then...

 Thanks,
 Brett S.


By the way, you should also know that you should never add a space before
[ ].

the abc [1] works in Vim6, but in Vim 7 there should not be a space so
there must be abc[1].

I don't know why there is such a requirement in Vim 7, but it breaks one of
my script.
--
Sincerely, Pan, Shi Zhu. ext: 2606

Re: Running own script when editing MATLAB files

2006-11-08 Thread Zachary Leung

Thanks! =)

Zac

--
Jesus said, I am the door of the sheep. If anyone enters by me, he
will be saved and will go in and out and find pasture.
John 10:9