Re: Proposal: New command/feature for quickfix

2006-06-29 Thread Jochen Baier
On Wed, Jun 28, 2006 at 03:26:04PM -0700, Yegappan Lakshmanan wrote:
 Hi,
 
 On 6/28/06, Nikolai Weibull [EMAIL PROTECTED] wrote:
 On 6/28/06, Jochen Baier [EMAIL PROTECTED] wrote:
  On Wed, Jun 28, 2006 at 11:21:00PM +0200, Mikolaj Machowski wrote:
   Dnia ?roda, 28 czerwca 2006 22:07, Jochen Baier napisa?:
i think a command like cbefore or croot could be
usefull. using this command after a quickfix trip (vimgrep,
  
   Doesn't c-o fulfill your request?
  
   m.
 
  no
 
 Good answer ;-).  Short and to the point.
 
 However, further explanation may be necessary.
 
 C-o just gets you back to the previous position in the jump list (or
 [count]), but this would be a complete reset to the point where you
 were before beginning to use the change list commands.
 
 
 You can try using the attached qf.vim plugin. Save the file to the
 $HOME/.vim/plugin or $HOME/vimfiles/plugin directory.

hi,

i used the qf.vim script to make a crestore.vim script.

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

seems to be usefull

regards jochen

 



How to always open file in a tab ?

2006-06-29 Thread Eddine

Hello all,

I'd like to take advantage of tab file editing, thus is it possible to
modify windows registry base or is there any work around to _always_
open files in a tab ?
Once again thank you bay advance for your precious help.

Best regards
Eddine.


Re: Authors

2006-06-29 Thread Seweryn Habdank-Wojewódzki
Hi

# śro czerwca 28 2006 17:51, @ Tim Chase:
 
  I will be greatful if I can know how many people have made a
  code of vim (in the past and now).
  
  I have found 23 names of persons in files, but I suppose that
  there is more.
 
 Well, as Vim is extensible, I suppose what you consider vim 
 will radically change that number.  You can read a number of the 
 names under
 
   :help credits
 
 where you'll find His Vimness, Bram, along with 3 
 documentation-author credits, and 56 other names of contributors.

Finally I've found 383 authors :-).

Regards.

-- 

|\/\/|   Seweryn Habdank-Wojewódzki
`\/\/


Re: How to always open file in a tab ?

2006-06-29 Thread Srinivas Rao. M
On Thu, 2006-06-29 at 13:30, Eddine wrote:
 Hello all,
 
 I'd like to take advantage of tab file editing, thus is it possible to
 modify windows registry base or is there any work around to _always_
 open files in a tab ?
 Once again thank you bay advance for your precious help.

You can use -p command line options to open the file always in tap.
i.e. 
vim -p file1.c file2.c file3.h

will open three tabs separately for these files.

HTH,
Srini...


--
website: http://www.geocities.com/saksblr
egroups: http://in.groups.yahoo.com/group/saksblr
--
RESPONSIBILITY starts with the willingness to experience yourself as
cause in the matter.
--




Enhancement syntax/cpp.vim

2006-06-29 Thread hermitte
Hello,

I'm looking for a way to define a few :syn-match'es before the definitions from
cpp.vim, but after those of c.vim.

My first idea was to have $HOME/.vim/syntax/cpp.vim defined this way:
runtime! syntax/c.vim
:syn match ..
unlet b:current_syntax
so $VIMRUNTIME/systax/cpp.vim

Even with no definitions of my own, curly-brackets are messed up: all displayed
as if there were unmatched brackets. (cErrInParen).

Can it be fixed or is the only solution to add a
runtime! syntax/cpp-hook.vim
at the beginning of standard C++ syntax file ? (just after the runtime!
syntax/c.vim)
If the hook is the only solution, could it be officially done ?


BTW, I have another question.
It is preferable to have one complex regex used in syn-match, or two have
several :syn-match defined ?
My regex beeing:
/\(catch\s*(\)\@=\(\s*\.\.\.\s*\)[EMAIL PROTECTED])]*/


--
Luc Hermitte


Re: How to always open file in a tab ?

2006-06-29 Thread Eddine

Thank you Srini.
Is it possible to have this behaviour with the right-click Edit in
(single) Vim context menu under win32 ?


Re: regexp select and place elsewhere

2006-06-29 Thread Jerin Joy

I need to use regexp. there are a lot of lines like these. I can't
manually do it.

Jerin

On 6/29/06, Saurabh Jain [EMAIL PROTECTED] wrote:




On 6/29/06, Jerin Joy [EMAIL PROTECTED] wrote:
 Hi,

 I have data that looks like this

 input [4:0] a.b.c.d;
 which I need to replace with
 input a.b.c.d [4:0] d;

 ie. I want to copy a.b.c.d and place it after input and replace it
 with d after [4:0].


Hi,
  you can try.
 // In non-insert mode press v to start visual mode
// Then use arrow keys to select the required text.
//After selecting, press d to delete the selected text.
// And paste it using p wherever you want.

Happy vimming
-Saurabh




--
Busy Wasting Time



--
http://jerinj.blogspot.com/
--


RE: regexp select and place elsewhere

2006-06-29 Thread Vishnu
Hi Jerin,

Use the following reg exp,

:%s/\(\[\d\+:\d\+] \)\(.*\.\)\(\i\+\);/\2\3 \1\3;/


:h \(


~VIshnu

 -Original Message-
 From: Jerin Joy [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 29, 2006 2:29 PM
 To: vim@vim.org
 Subject: regexp select and place elsewhere
 
 Hi,
 
 I have data that looks like this
 
 input [4:0] a.b.c.d;
 which I need to replace with
 input a.b.c.d [4:0] d;
 
 ie. I want to copy a.b.c.d and place it after input and replace it
 with d after [4:0].
 
 I'm fairly comfortable with regexp but I'm not sure how to select and
 copy the text to another place on the line.
 Could someone help me out here.
 
 thanks,
 Jerin
 
 --
 http://jerinj.blogspot.com/
 --



Re: regexp select and place elsewhere

2006-06-29 Thread Jerin Joy

Thanks guys, I was looking for the ()

Jerin

On 6/29/06, Vishnu [EMAIL PROTECTED] wrote:

Hi Jerin,

Use the following reg exp,

:%s/\(\[\d\+:\d\+] \)\(.*\.\)\(\i\+\);/\2\3 \1\3;/


:h \(


~VIshnu

 -Original Message-
 From: Jerin Joy [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 29, 2006 2:29 PM
 To: vim@vim.org
 Subject: regexp select and place elsewhere

 Hi,

 I have data that looks like this

 input [4:0] a.b.c.d;
 which I need to replace with
 input a.b.c.d [4:0] d;

 ie. I want to copy a.b.c.d and place it after input and replace it
 with d after [4:0].

 I'm fairly comfortable with regexp but I'm not sure how to select and
 copy the text to another place on the line.
 Could someone help me out here.

 thanks,
 Jerin

 --
 http://jerinj.blogspot.com/
 --





--
http://jerinj.blogspot.com/
--


Re: How to always open file in a tab ?

2006-06-29 Thread Bernd Strohhäcker

Eddine wrote:

Thank you Srini.
Is it possible to have this behaviour with the right-click Edit in
(single) Vim context menu under win32 ?


Try adding  -p to HKLM\Software\Vim\Gvim\path

HTH, Bernd


Re: regexp select and place elsewhere

2006-06-29 Thread Christian Ebert
* Jerin Joy on Thursday, June 29, 2006 at 14:28:51 +0530:
 I have data that looks like this
 
 input [4:0] a.b.c.d;
 which I need to replace with
 input a.b.c.d [4:0] d;
 
 ie. I want to copy a.b.c.d and place it after input and replace it
 with d after [4:0].

:s/\(\[[^]]\+\]\) \(\([a-z]\.\)\{3}\([a-z]\)\);/\2 \1 \4;/

does it for your example, but I don't know which other
requirements and/or restrictions you have.

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


Re: PHP fold html

2006-06-29 Thread Silent1

if i switch the foldmethod to marker all my functions/classes will
unfold. The reason i created that other fold syntax is to be able to
fold what ever i want inside syntax fold mehtod. Now i just need to be
able to do now is to be able to fold html inside the syntax
foldmethod. Thanks in advance.

On 6/28/06, Peter Hodge [EMAIL PROTECTED] wrote:

Hi,

You can achieve this by setting setting foldmethod=marker, which automatically
creates folds at all {{{ and }}} pairs.  See :help fold-marker for more
information.  Adding to the syntax file should not be necessary.

regards,
Peter




--- Silent1 [EMAIL PROTECTED] wrote:

 i added this to the default php syntax file so i can create folds with
 //{{{ //}}} anywhere in my php.

 syn regionphpParent   matchgroup=Delimiter start=//{{{ end=//}}}
 contained [EMAIL PROTECTED],phpFoldHtmlInside transparent fold

 It works great but i would like to fold html sections of my php file
 as well, with the same syntax above. So something like this i would
 like to fold,

 ?PHP
 //{{{fold html
 ?
 HTML
 title
 more html
 /title
 /html
 ?PHP
 //}}}
 ?

 Thanks






The LOST Ninja blog: Exclusive clues, clips and gossip.
http://au.blogs.yahoo.com/lostninja




Anchoring in a regex

2006-06-29 Thread Robert Hicks

syn match tclV ttk\(\(::\)\?\([[:alnum:]_.]*::\)*\)\a[a-zA-Z0-9_.]*

I only want this to work ttk at the start. I know that ^ means the 
start but I am not sure how to add that (I did try just adding it) to 
make the regex start with ttk.


Robert



Re: Anchoring in a regex

2006-06-29 Thread Tim Chase

syn match tclV ttk\(\(::\)\?\([[:alnum:]_.]*::\)*\)\a[a-zA-Z0-9_.]*

I only want this to work ttk at the start. I know that ^ means the 
start but I am not sure how to add that (I did try just adding it) to 
make the regex start with ttk.


Just put it at the beginning:

^ttk...

just as you would use the dollar-sign at the end to anchor 
something to the end of the line:


regexp$

-tim






Disable Windows shortcuts in GVIM

2006-06-29 Thread Marc Demlenne

Hello,

How is it possible, using GVIM, to forbid Windows executing commands
destinated to VIM?
e.g CTRL-V (Virtual select) is interpreted as Paste by MS. CTRL-A as
select all, ...
How can I disable this, and retrieve unix-like behaviour in my gvim ?

Thanks very much for any help


--
Marc


Re: Disable Windows shortcuts in GVIM

2006-06-29 Thread Tim Chase

How is it possible, using GVIM, to forbid Windows executing commands
destinated to VIM?
e.g CTRL-V (Virtual select) is interpreted as Paste by MS. CTRL-A as
select all, ...
How can I disable this, and retrieve unix-like behaviour in my gvim ?



Likely your vimrc is directly or indirectly sourcing mswin.vim 
and to remedy the matter, just edit your vimrc file and remove 
the line that reads something like


runtime mswin.vim

or

source mswin.vim

Nuke the line, and you should be good to go.

It might be slurped in indirectly via the example_vimrc.vim file, 
in which case you'll want to nuke/modify that instead.


-tim





Re: Enhancement of syntax/cpp.vim

2006-06-29 Thread hermitte
[EMAIL PROTECTED] wrote:

 I'm looking for a way to define a few :syn-match'es before the definitions
 from cpp.vim, but after those of c.vim.

Well it seems it was not necessary in my precise case. I still have some
troubles with priorities.

Given my problem of enforcing good practices by highlighting c++ catches made by
value (instead of reference), I'm almost done. I'm able to highlight catch(T)
but neither catch(...) nor catch(Tanything). I'm even able to not
highlight text I'm typing (catch(Typcursor)). So far so good.

However, catch(T const E) is correctly highlighted, but catch(const T e) is
never highlighted as it should.

Does anybody sees why in my :syn definitions ? I guess the definition of the
syn-Keyword for const is the root of my problem. But I don't see how to fix
it.

-- % ---
if !exists(cpp_no_catch_by_reference)
   In C++, we should always catch by reference (and throw by value)

   The complex regex tells to match an expression without  except 
  syn match cppBadCatch
   \  /\(catch\s*(\s*\)\@=\(\s*\.\.\.\s*\)[EMAIL PROTECTED])]*\()\)[EMAIL 
PROTECTED]/

   Accept what is currently typed
  syn match cppEditedCatch
   \  /\(catch\s*(\s*\)\@=[a-zA-Z:_]\+\%#\(\s*)\)[EMAIL PROTECTED]/
  syn match cppEditedCatch
   \  
/\(catch\s*(\s*\)\@=\(\%[const]\|const\s*[a-zA-Z:_]\+\s*\)\%#\(\s*)\)[EMAIL 
PROTECTED]/
  syn match cppEditedCatch
   \  /\(catch\s*(\s*\)\@=[a-zA-Z:_]\+\s*\%[const]\=\%#\(\s*)\)[EMAIL 
PROTECTED]/

  hi def link cppBadCatchSpellBad
   hi def link cppEditedCatch 
endif
-- % ---

Thanks in advance


--
Luc Hermitte
http://hermitte.free.fr/vim/


Re: Not able to switch between tabs on newly compiled vim 7

2006-06-29 Thread Benji Fisher
On Thu, Jun 29, 2006 at 04:59:53PM +0530, Jerin Joy wrote:
 Actually I installed vim7.0(on Linux Enterprise Edition).
 I am unable to switch between various tabs using CTRL-PAGEUP and
 CTRL-PAGEDN when i am using vim.
 It is working perfectly fine for gvim.

 Probably your terminal program (xterm or gnome-terminal for
example) is grabbing these keys instead of letting vim process them.

HTH --Benji Fisher


insert space after comma based on context

2006-06-29 Thread Zhang Le

Hi,
   Most of time I want a space after a comma, so I use imap , , 
   The problem is, sometime I do not want a comma inside square
brackets in some programming language such python and matlab:
a[10,:] or a(10,:)

Is there a way to not insert a space based on context around the
cursor so that if the text before cursor is [xxx, or (xxx, no space
will be inserted?
Any tips?
Zhang Le


Re: Enhancement of syntax/cpp.vim

2006-06-29 Thread Yakov Lerner

On 6/29/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

[EMAIL PROTECTED] wrote:

 I'm looking for a way to define a few :syn-match'es before the definitions
 from cpp.vim, but after those of c.vim.

Well it seems it was not necessary in my precise case. I still have some
troubles with priorities.

Given my problem of enforcing good practices by highlighting c++ catches made by
value (instead of reference), I'm almost done. I'm able to highlight catch(T)
but neither catch(...) nor catch(Tanything). I'm even able to not
highlight text I'm typing (catch(Typcursor)). So far so good.

However, catch(T const E) is correctly highlighted, but catch(const T e) is
never highlighted as it should.

Does anybody sees why in my :syn definitions ? I guess the definition of the
syn-Keyword for const is the root of my problem. But I don't see how to fix
it.

-- % ---
if !exists(cpp_no_catch_by_reference)
   In C++, we should always catch by reference (and throw by value)

   The complex regex tells to match an expression without  except 
  syn match cppBadCatch
   \  /\(catch\s*(\s*\)\@=\(\s*\.\.\.\s*\)[EMAIL PROTECTED])]*\()\)[EMAIL 
PROTECTED]/

   Accept what is currently typed
  syn match cppEditedCatch
   \  /\(catch\s*(\s*\)\@=[a-zA-Z:_]\+\%#\(\s*)\)[EMAIL PROTECTED]/
  syn match cppEditedCatch
   \  
/\(catch\s*(\s*\)\@=\(\%[const]\|const\s*[a-zA-Z:_]\+\s*\)\%#\(\s*)\)[EMAIL 
PROTECTED]/
  syn match cppEditedCatch
   \  /\(catch\s*(\s*\)\@=[a-zA-Z:_]\+\s*\%[const]\=\%#\(\s*)\)[EMAIL 
PROTECTED]/

  hi def link cppBadCatchSpellBad
   hi def link cppEditedCatch 
endif
-- % ---


I had similar problem, namely that syn-keyword
(like static etc) prevent syn-match from matching
the keywords. The detailed explanation and
hint at possible solition is at:

http://marc.theaimsgroup.com/?l=vimm=114321198924381w=2
http://marc.theaimsgroup.com/?l=vimm=114322806510413w=2
http://marc.theaimsgroup.com/?l=vimm=114323035711653w=2

I don't know how to make syn-match to match keywords.
I proposed once to add explicit 'priority=N' attribute to syntax
rules to make it possible.

Yakov


Re: couple of debug mode issues

2006-06-29 Thread Hari Krishna Dara

On Wed, 28 Jun 2006 at 8:49pm, Yegappan Lakshmanan wrote:

 Hi Hari,

 On 6/28/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:
 
  I am seeing a couple of issues with debug mode.
  - In debug mode, the getcmdtype() is supposed to return '', but it
returns empty string. This is not a big issue, in case it works as
expected in all other modes, as I can treat '' equivalent to '', but
will be nice if it is fixed.
 

 I tried the following and the getcmdtype() function returned '' in
 the debug mode:

 :debug xyz
 Entering Debug mode.  Type cont to continue.
 cmd: xyz
 C-R=getcmdtype()CR
 

 - Yegappan

You are right, false conclusion on my part. I tried

echo getcmdtype()

and didn't see any output, and did something else after that that I
don't remember, and concluded that it is not working. Thanks for
correcting me.

-- 
Hari

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


Re: Authors

2006-06-29 Thread Aaron Griffin

On 6/29/06, Seweryn Habdank-Wojewódzki [EMAIL PROTECTED] wrote:

Finally I've found 383 authors :-).


Hurry, someone go write a plugin and ++ that number!


a question about 'diff' setting

2006-06-29 Thread Hari Krishna Dara

I faced this issue a few times, so I thought I will ask here. When I
am done with the vimdiff mode, I normally just close the windows or
switch to other files. The problem is that Vim seems to remember that
those buffers participate in the diff mode, so the next time I start a
new vimdiff on other buffers, the previous buffers start participating,
and this results in a mess as more than likely those buffers are
unrelated.

The documentation says the 'diff' setting is local to window, so closing
the windows show cancel the setting out, but when I try the below
sequence on two related files say, x.old and x.new, it seems otherwise.

:sp x.new
:vert diffsplit x.old
:q
:q
:sp x.new
:vsp x.old

At the end, you have the same two files opened in the same side-by-side
view, but I didn't expect them to have the diff mode on. Can anyone
explain why and what I should do to avoid this (other than remembering
to run :diffoff before closing, or doing a :bufdo diffoff later).

-- 
Thanks,
Hari

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


RE: a question about 'diff' setting

2006-06-29 Thread David Fishburn
 

 -Original Message-
 From: Hari Krishna Dara [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, June 29, 2006 2:53 PM
 To: vim@vim.org
 Subject: a question about 'diff' setting
...
 Can anyone explain why and what I should do to avoid 
 this (other than remembering to run :diffoff before closing, 
 or doing a :bufdo diffoff later).


I keep this in my vimrc:
if v:version = 602
command! -bar -bang Nodiff wincmd l bar onlybang bar set nodiff
noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit= 
else
command! -bar Nodiff exe 'wincmd l' bar only bar set nodiff
noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= bar let
g:diff_msg_shown = 0
endif

I think Gary Johnson came up with it initially.

Try that to see if it works.  The command! lines are on 1 line only.

Dave



Re: a question about 'diff' setting

2006-06-29 Thread Tim Chase

The documentation says the 'diff' setting is local to window, so closing
the windows show cancel the setting out, but when I try the below
sequence on two related files say, x.old and x.new, it seems otherwise.


Vim seems to keep the 'diff' information around in the same way 
it keeps marks in a given file.  Until it's unloaded, it still 
seems to remember it.  Using :bw seems to obliterate the file so 
that the next time it is loaded you don't have 'diff' set.


I agree that the docs saying that 'diff' is per-window seems a 
bit misleading, as it seems to be per-buffer.


Just my $0.02 observation...

-tim





Re: a question about 'diff' setting

2006-06-29 Thread Yakov Lerner

On 6/29/06, Hari Krishna Dara [EMAIL PROTECTED] wrote:

When I
am done with the vimdiff mode, I normally just close the windows or
switch to other files. The problem is that Vim seems to remember that
those buffers participate in the diff mode


I just do :bw twice when I want to normally edit somthing
in the vim that was started as vimdiff, if that's what you ask.

Yakov


Beta testers wanted for 6th Sense Analytics

2006-06-29 Thread mfaisst

Hi,
 
My name is Michael Faisst, I am the Product Manager for 6th Sense Analytics.
I am looking for some smart developers who understand their development
environment like no other and who would like to join us in our Beta program. 
 
If you are that developer who knows VIM 6.4 or 7 inside out and would like
to be involved in new technology that has the potential to change the way
the world looks at software development then please send me your contact
details to [EMAIL PROTECTED] 
 
About 6th Sense Analytics:
6th Sense Analytics gathers data about your software development activities.
This information is provided back to you in the form of analytics which can
be used for automated status reporting, self improvement or to substantiate
your requests to work from home, reduce meetings, tool acquisition and more.
For more details about our solution please visit us at
http://www.6thsenseanalytics.com/product/developer/.
 
What?s in it for you?
You will learn new things about your own development process and the
industry. 
I have some really nice ?6th Sense Analytics? T-Shirts to hand out to all
active participants. 
For every bug you log a ticket will be entered into a drawing for an IPod
Nano 
Free access to final sensors and analytics after the Beta program has ended. 


How much work will it be for you?
5 minutes to send me an initial email with your Name, email address,
IDE/Editor you use, Operating system and a telephone number where you can be
reached. 
A typical install takes about 15 minutes (including registration). 
After that all you have to do is verify your IDE/editor does not slow down
and it functions normally.
For every bug you find I?d like to hear about it, reporting will take about
2 minutes.
At the end of the program I?d like to ask a couple of questions about how
you liked the product and the program, that?s it.
 
The program will run for one week starting Sunday, July 9th 2006 and
complete Saturday, July 15th 2006.
I will not use share your information with anyone unless you explicitly ask
me to be contacted for more information; I do not like spam and I assume you
don?t either.
 
We only have maximum of 35 seats open for participation so if you are
interested, please contact me at your earliest convenience. 
 
Thank you for considering to participate,
Michael Faisst
Director Product Management
6th Sense Analytics
http://www.6thsenseanalytics.com
-- 
View this message in context: 
http://www.nabble.com/Beta-testers-wanted-for-6th-Sense-Analytics-tf1869289.html#a5108670
Sent from the Vim - General forum at Nabble.com.



Re: a question about 'diff' setting

2006-06-29 Thread Yegappan Lakshmanan

Hi David,

On 6/29/06, David Fishburn [EMAIL PROTECTED] wrote:



 -Original Message-
 From: Hari Krishna Dara [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 29, 2006 2:53 PM
 To: vim@vim.org
 Subject: a question about 'diff' setting
...
 Can anyone explain why and what I should do to avoid
 this (other than remembering to run :diffoff before closing,
 or doing a :bufdo diffoff later).


I keep this in my vimrc:
if v:version = 602
command! -bar -bang Nodiff wincmd l bar onlybang bar set nodiff
noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit=
else
command! -bar Nodiff exe 'wincmd l' bar only bar set nodiff
noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= bar let
g:diff_msg_shown = 0
endif

I think Gary Johnson came up with it initially.

Try that to see if it works.  The command! lines are on 1 line only.



Starting with Vim7, you don't need the above user-defined command.
Instead you can use one of the following commands:

  :diffoff
  :diffoff!

- Yegappan


A possible conflict between gvim and XP HyperTerminal?

2006-06-29 Thread phoenixl
Hi,

I'm using Windows XP HyperTerminal in vt100 emulation mode to reach a
linux box running gvim.  When I bring up a file in gvim and try to
scroll, only the left side scrolls in the HyperTerminal.  Is this a
known problem?

Thanks.
Scott


Re: Enhancement of syntax/cpp.vim

2006-06-29 Thread [EMAIL PROTECTED]
* On Thu, Jun 29, 2006 at 08:19:48PM +0300, Yakov Lerner [EMAIL PROTECTED] 
wrote:
  [...]
 I had similar problem, namely that syn-keyword
 (like static etc) prevent syn-match from matching
 the keywords. The detailed explanation and
 hint at possible solition is at:
 
 http://marc.theaimsgroup.com/?l=vimm=114321198924381w=2
 http://marc.theaimsgroup.com/?l=vimm=114322806510413w=2
 http://marc.theaimsgroup.com/?l=vimm=114323035711653w=2
 
 I don't know how to make syn-match to match keywords.
 I proposed once to add explicit 'priority=N' attribute to syntax rules
 to make it possible.

Thank you for the pointers Yakov. I'll have a look at them.


-- 
Luc Hermitte
http://hermitte.free.fr/vim/


RE: a question about 'diff' setting

2006-06-29 Thread Hari Krishna Dara

On Thu, 29 Jun 2006 at 2:59pm, David Fishburn wrote:



  -Original Message-
  From: Hari Krishna Dara [mailto:[EMAIL PROTECTED]
  Sent: Thursday, June 29, 2006 2:53 PM
  To: vim@vim.org
  Subject: a question about 'diff' setting
 ...
  Can anyone explain why and what I should do to avoid
  this (other than remembering to run :diffoff before closing,
  or doing a :bufdo diffoff later).


 I keep this in my vimrc:
 if v:version = 602
 command! -bar -bang Nodiff wincmd l bar onlybang bar set nodiff
 noscrollbind scrollopt-=hor wrap foldcolumn=0 virtualedit=
 else
 command! -bar Nodiff exe 'wincmd l' bar only bar set nodiff
 noscrollbind wrap foldcolumn=0 scrollopt-=hor virtualedit= bar let
 g:diff_msg_shown = 0
 endif

 I think Gary Johnson came up with it initially.

 Try that to see if it works.  The command! lines are on 1 line only.

 Dave

I use a version of this command myself, but the point is you have to
remember to use it before closing them. I often use two unnamed buffers
to diff and copy paste text from else where (say sql results) to diff.
When I close them without running my command, and later discover this
problem, I have to hunt around for the unnamed buffers that are silently
participating in the diff and get rid off them. There may be other
aspects in the way I work that get me into this diff problem, but I
haven't analyzed all.

-- 
Thanks,
Hari

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


Re: a question about 'diff' setting

2006-06-29 Thread Hari Krishna Dara

On Thu, 29 Jun 2006 at 2:07pm, Tim Chase wrote:

  The documentation says the 'diff' setting is local to window, so closing
  the windows show cancel the setting out, but when I try the below
  sequence on two related files say, x.old and x.new, it seems otherwise.

 Vim seems to keep the 'diff' information around in the same way
 it keeps marks in a given file.  Until it's unloaded, it still
 seems to remember it.  Using :bw seems to obliterate the file so
 that the next time it is loaded you don't have 'diff' set.

 I agree that the docs saying that 'diff' is per-window seems a
 bit misleading, as it seems to be per-buffer.

 Just my $0.02 observation...

 -tim

I first though the same way, that 'diff' is probably a buffer local
setting (instead or in addition to being window local), and so tried to
search for buffers with 'diff' value 1 using getbufvar(), but this
interestingly returns 1 only when you are in the window for that
buffer. What I mean is, say a buffer 600 has 'diff' set. If you are in
a window containing a different buffer, and call getbufvar(600,
'diff'), you get 0, but if you are in the window that has buffer 600
visible, you get 1. This obviously means you will never get 1 for
a buffer that is not currently visible in any window, so a loop to find
the buffer will not work.

-- 
Thanks,
Hari

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


Re: insert space after comma based on context

2006-06-29 Thread Dr Bean
On Fri, 30 Jun 2006, Luc Hermitte wrote:

 * On Thu, Jun 29, 2006 at 02:45:16PM +0100, Zhang Le [EMAIL PROTECTED] 
 wrote:
  Most of time I want a space after a comma, so I use imap , , 
  The problem is, sometime I do not want a comma inside square
  brackets in some programming language such python and matlab:
  a[10,:] or a(10,:)

  Is there a way to not insert a space based on context around the
  cursor so that if the text before cursor is [xxx, or (xxx, no space
  will be inserted?

 I see two ways:

 2- The second is to define context dependent mapping. You can search for
 the discussion I had with Dr Bean last week on this topic.
 You can search for the following Message-ID on gmane:
 [EMAIL PROTECTED]

 He used the function InsertIfNotAfter() I define in my C++ ftplugin
 cpp_set.vim available in lh-cpp.tar.gz [1].
 In your case, I guess it will look like:

 inoremap silent ,
 \ c-r=InsertIfNotAfter(',', ', ', '[[(][^]]\+')cr

Just for my own benefit, and to refresh my memory about what this means:

It's a mapping to add a space after the comma, but only when the
comma is not preceded by something the regex matches.

What the regex matches is an opening bracket or parenthesis followed by
a number of non-closing-bracket characters.

Shouldn't the closing parenthesis be included also in the regex?

'[[(][^])]\+'

-- 
Dr Bean People don't know what they say or 
what they think they ought to say.
--Leonard Bloomfield, quoted by Virginia McDavid


Funcref and script local functions

2006-06-29 Thread Hari Krishna Dara

When Funcref's were introduced in Vim7, I expected them to work for
script-local functions, across scripts. The documentation didn't say
that, but it didn't say that it wouldn't either, and I thought that that
is one of its biggest uses (other than the actual intended
functionality, which is for implementing numbered functions). However, I
found that the Funcref references for such functions can't actually be
passed out to other scripts. This reduces the usefulness of this feature
as we can't register private functions to receive callbacks from other
scripts.

What is weird is that the the Funcref() actually behaves exactly like
the function name itself. Say you have a function called s:T() and say
the script id is 60. The Funcref obtained via function('s:T') can't be
called from outside the script, but if the Funcref is obtained using
function('SNR60_T'), then it will be fine. Also, a Funcref obtained
using these two methods will not be to the same object, though you would
expect them to be. The below echoes 0:

echomsg function('s:T') is function('SNR60_T')

where as the below echoes 1:

echomsg function('s:T') is function('s:T')

The above two facts make Funcref counter-intuitive to understand. I
actually wonder why even a special function called function() was
required to obtain the Funcref in the first place (unlike in Python).

There are other aspects of the new features that are very
counter-intuitive to me, whether I think in terms of Python or generic
objects in any language. The one which gets me the most is the
implicit typing of variables based on the initializer. For basic types
prior to Vim7 (integer and string), you could easily switch the value of
the variable from integer to string or vice versa, and the type() of the
variable would change, suggesting that it behaves like duck typing (as
per (wikipedia). But this observation can't be extended to the newer
object types, as the below will fail:

let a = {}
let a = []

If the type of value determines the type of the variable, and if we are
merely dealing with references (assigning references instead of copying
objects), then why should the second statement above generate the below
error?

E706: Variable type mismatch for: a

Is there a standard for this type of language behavior? I didn't find
anything at this page: http://en.wikipedia.org/wiki/Dynamically_typed

I declare all my script variables before they are used, and it hurts me
for the fact that you have to create an empty array or hash such that
these variable types are established correctly. But when it comes to a
Funcref type, it is lousy that you have to initialize the variable with
the Funcref of some random function so that the type of variable gets
established as Funcref.

I don't know if what I say above makes sense to anyone (I never studied
computer science, so these are based on what you could call as common
sense of a software developer :), or if anything can be done about them
now, but at least I thought I will give some feedback on what has been
bothering me.

-- 
Thank you,
Hari

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