Re: .vimrc from URL

2007-01-04 Thread A.J.Mechelynck

Mikolaj Machowski wrote:

On pią sty 5 2007, Mikolaj Machowski wrote:

Mikolaj Machowski wrote:

On pią sty 5 2007, Maurí­cio wrote:

Or else, have the following at the top of the vimrc:

let g:vimrcdate =   "4 Jan 2007 22:49 UTC"
echo This vimrc was last changed on" g:vimrcdate
if input("Do you want to continue? ") !~? "y"
qall!
endif

Since this requires specific .vimrc OP can explicitly source netrw

   ^^^

at the beginning of .vimrc; open net address; write it to temporary
file; source that file; remove temporary file.

m.

I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT
YET sourced. So if the vimrc tries to issue


That is why I wrote "explicitly source netrw".

m.




Oops, I read too fast. Looks like a kludge to me but I guess it would work.


Best regards,
Tony.


Re: .vimrc from URL

2007-01-04 Thread Mikolaj Machowski
On pią sty 5 2007, Mikolaj Machowski wrote:
> Mikolaj Machowski wrote:
> > On pią sty 5 2007, Maurí­cio wrote:
> >> Or else, have the following at the top of the vimrc:
> >>
> >>let g:vimrcdate =   "4 Jan 2007 22:49 UTC"
> >>echo This vimrc was last changed on" g:vimrcdate
> >>if input("Do you want to continue? ") !~? "y"
> >>qall!
> >>endif
> >
> > Since this requires specific .vimrc OP can explicitly source netrw
   ^^^
> > at the beginning of .vimrc; open net address; write it to temporary
> > file; source that file; remove temporary file.
> >
> > m.
>
> I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT
> YET sourced. So if the vimrc tries to issue

That is why I wrote "explicitly source netrw".

m.



Re: .vimrc from URL

2007-01-04 Thread A.J.Mechelynck

Mikolaj Machowski wrote:

On pią sty 5 2007, Maurí­cio wrote:

Or else, have the following at the top of the vimrc:

let g:vimrcdate =   "4 Jan 2007 22:49 UTC"
echo This vimrc was last changed on" g:vimrcdate
if input("Do you want to continue? ") !~? "y"
qall!
endif


Since this requires specific .vimrc OP can explicitly source netrw
at the beginning of .vimrc; open net address; write it to temporary
file; source that file; remove temporary file.

m.





I repeat: when the vimrc is sourced, the plugins (such as netrw) are NOT YET 
sourced. So if the vimrc tries to issue


:view http://users.example.net/firstname.lastname/vim/vimrc

there will be an error: "invalid filename", "path not found", "file not 
found", whatever. The Net will not be accessed because netrw is not yet available.



Best regards,
Tony.


Re: .vimrc from URL

2007-01-04 Thread Mikolaj Machowski
On pią sty 5 2007, Maurí­cio wrote:
> The vimrc is sourced before the global plugins, in particular before the
> netrw plugin. So I think the short answer is no.

BTW - if netrw could directly source files over the net it could open
interesting possibilities for script repositories.

m.



Re: .vimrc from URL

2007-01-04 Thread Mikolaj Machowski
On pią sty 5 2007, Maurí­cio wrote:
>
> Or else, have the following at the top of the vimrc:
>
>   let g:vimrcdate =   "4 Jan 2007 22:49 UTC"
>   echo This vimrc was last changed on" g:vimrcdate
>   if input("Do you want to continue? ") !~? "y"
>   qall!
>   endif

Since this requires specific .vimrc OP can explicitly source netrw
at the beginning of .vimrc; open net address; write it to temporary
file; source that file; remove temporary file.

m.




Re: How to map arrow keys

2007-01-04 Thread A.J.Mechelynck

Zheng Da wrote:

On 1/4/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Zheng Da wrote:
> On 1/4/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
>>
>> WFM
>>
>> VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec  5 2006 22:18:11)
>> Included patches: 1-178
>> Compiled by [EMAIL PROTECTED]
>> Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
>> ...etc...
>>
>> Best regards,
>> Tony.
>>
> What do you mean?
>

WFM = Works For Me, on the version mentioned above.

Please give some more details.


Best regards,
Tony.



$ vim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Jan  4 2007 14:47:14)
Compiled by [EMAIL PROTECTED]


Hm. Version 7.0.000, lacking 178 bugfixes.


Normal version with GTK2 GUI.  Features included (+) or not (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info 
+comments

+cryptv -cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path 
+find_in_path

+folding -footer +fork() +gdb +gettext -hangul_input +iconv +insert_expand
+jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds 
+localmap

+menu +mksession +modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm
-mouse_jsbterm -mouse_netterm +mouse_xterm +multi_byte +multi_lang 
-mzscheme

+netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile
+python +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white -tcl +terminfo +termresponse +textobjects +title +toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo 
+vreplace
+wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim 
+xsmp_interact

+xterm_clipboard -xterm_save
  system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
 user exrc file: "$HOME/.exrc"
 system gvimrc file: "$VIM/gvimrc"
   user gvimrc file: "$HOME/.gvimrc"
   system menu file: "$VIMRUNTIME/menu.vim"
 fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2
-I/usr/include/python2.4 -pthread
Linking: gcc   -L/usr/local/lib -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext
-lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0
-lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -lXt -lncurses -lgpm
 -L/usr/lib/python2.4/config -lpython2.4 -lpthread -ldl -lutil -lm
-Xlinker -export-dynamic




I don't see anything obvious. Are you using it in GUI mode or in console mode? 
If you try the other mode, does it make a difference? Do you see anything at 
http://ftp.vim.org/pub/vim/patches/7.0/README which, by not being included, 
could prevent arrows from being mapped?


For the record, when I open a virgin [No Name] buffer in gvim and then do

:nmap   i-

from then on, in that buffer the left-arrow key inserts a dash instead of 
moving to the left. IIUC this is the behaviour you expect from this mapping.



Best regards,
Tony.


Re: .vimrc from URL

2007-01-04 Thread A.J.Mechelynck

Maurí­cio wrote:

  Hi,

I change my .vimrc very often, and I use vim
in many computers. The result is that my changes
are not always updated to all computers.

Is it possible to ask vim to update its
.vimrc from an URL, like an FTP address?

  Thanks,
  Maurício




The vimrc is sourced before the global plugins, in particular before the netrw 
plugin. So I think the short answer is no.


What you could do (maybe) is setup a shell script (aka "Batch file" on 
Dos/Windows) to synchronize your vimrc from the master online version just 
before starting Vim.


Or else, have the following at the top of the vimrc:

let g:vimrcdate =   "4 Jan 2007 22:49 UTC"
echo This vimrc was last changed on" g:vimrcdate
if input("Do you want to continue? ") !~? "y"
qall!
endif


Best regards,
Tony.


Re: How to map arrow keys

2007-01-04 Thread Zheng Da

On 1/4/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

Zheng Da wrote:
> On 1/4/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
>>
>> WFM
>>
>> VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec  5 2006 22:18:11)
>> Included patches: 1-178
>> Compiled by [EMAIL PROTECTED]
>> Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
>> ...etc...
>>
>> Best regards,
>> Tony.
>>
> What do you mean?
>

WFM = Works For Me, on the version mentioned above.

Please give some more details.


Best regards,
Tony.



$ vim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Jan  4 2007 14:47:14)
Compiled by [EMAIL PROTECTED]
Normal version with GTK2 GUI.  Features included (+) or not (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv -cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd -ebcdic
-emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path
+folding -footer +fork() +gdb +gettext -hangul_input +iconv +insert_expand
+jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu +mksession +modify_fname +mouse +mouseshape -mouse_dec +mouse_gpm
-mouse_jsbterm -mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme
+netbeans_intg -osfiletype +path_extra -perl +postscript +printer -profile
+python +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static
-tag_any_white -tcl +terminfo +termresponse +textobjects +title +toolbar
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace
+wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim +xsmp_interact
+xterm_clipboard -xterm_save
  system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
 user exrc file: "$HOME/.exrc"
 system gvimrc file: "$VIM/gvimrc"
   user gvimrc file: "$HOME/.gvimrc"
   system menu file: "$VIMRUNTIME/menu.vim"
 fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2
-I/usr/include/python2.4 -pthread
Linking: gcc   -L/usr/local/lib -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0
-latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lfontconfig -lXext
-lXrender -lXinerama -lXi -lXrandr -lXcursor -lXfixes -lpango-1.0
-lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0   -lXt -lncurses -lgpm
 -L/usr/lib/python2.4/config -lpython2.4 -lpthread -ldl -lutil -lm
-Xlinker -export-dynamic


--
With regards
Zheng Da


Re: How to open multiple files in split windows?

2007-01-04 Thread Tim Chase

gvim a b

The above command will open a and b. But only one file will be show at
one time. How to show them in to split windows?



gvim -o a b

or, if you only want 3 windows, for N files (where N>3), you can use

gvim -o 3 a b c d e f g h


More info at

:help -o

-tim






How to open multiple files in split windows?

2007-01-04 Thread Peng Yu

Hi,

gvim a b

The above command will open a and b. But only one file will be show at
one time. How to show them in to split windows?

Thanks,
Peng


.vimrc from URL

2007-01-04 Thread Maurí­cio

  Hi,

I change my .vimrc very often, and I use vim
in many computers. The result is that my changes
are not always updated to all computers.

Is it possible to ask vim to update its
.vimrc from an URL, like an FTP address?

  Thanks,
  Maurício



Re: How to map arrow keys

2007-01-04 Thread A.J.Mechelynck

Zheng Da wrote:

On 1/4/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:


WFM

VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec  5 2006 22:18:11)
Included patches: 1-178
Compiled by [EMAIL PROTECTED]
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
...etc...

Best regards,
Tony.


What do you mean?



WFM = Works For Me, on the version mentioned above.

Please give some more details.


Best regards,
Tony.


Re: How to map arrow keys

2007-01-04 Thread Zheng Da

On 1/4/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:


WFM

VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec  5 2006 22:18:11)
Included patches: 1-178
Compiled by [EMAIL PROTECTED]
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
...etc...

Best regards,
Tony.


What do you mean?

--
With regards
Zheng Da


Re: alphabetical order of a long bibl file

2007-01-04 Thread Tim Chase

I have a long bibliography file for a latex document and I must put
the references in order. Unfortunately the different authors have used
different styles, so that I have two blocks.
In the first block all references look like


\bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock
{From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em
PASP}, 111:1333--1346.
--

(note that each entry is a single row)

And in the second block I have

--
\bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006,
Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227
--

(idem, single rows)


Well, if a few liberties can be taken, Vim7's sorting 
functionality offers a killer solution to this problem:


:%sort /\\bibitem[^{]*{\zs/

Since each bib item is on its own line (and not overflowing to 
multiple lines), a simple sort at the "right" offset (as kindly 
found by the regexp) will do the trick.  In this case, the 
pattern is "start ("\zs") the sorting comparison after '\bibitem 
up through the first open-curly-bracket' ("\\bibitem[^{]*{")"


(okay, now /that/ had some odd quoting and parenthesizing in it...)

It does have the side effect that the block are no longer 
separated by whitespace, but this can then be rectified with


:%s/$/\r

which will doublespace them again.

Adjust the "%" for to be your desired range.


I have more than 200 references and I don't feel like doing this per hand!



Hopefully this does the trick for you.  If not, drop a line to 
the list with the details of went gonzo (likely some precondition 
I'm missing).


-tim




Re: How to map arrow keys

2007-01-04 Thread A.J.Mechelynck

Zheng Da wrote:

Hi, everyone

How to map an arrow key in the normal mode?
I tried "nmap  i-"
Actually, it doesn't work even though running this mapping command
doesn't give any error messages.



WFM

VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec  5 2006 22:18:11)
Included patches: 1-178
Compiled by [EMAIL PROTECTED]
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
...etc...

Best regards,
Tony.


alphabetical order of a long bibl file

2007-01-04 Thread Vim Visual

Hi,

I have a long bibliography file for a latex document and I must put
the references in order. Unfortunately the different authors have used
different styles, so that I have two blocks.
In the first block all references look like


\bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock
{From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em
PASP}, 111:1333--1346.

\bibitem[ {Aarseth}, 2003]{Aarseth03}{Aarseth}, S.~J. (2003).\newblock
{Black hole binary dynamics}.\newblock {\em Ap\&SS}, 285:367--372.

\bibitem[ {Alexander} and {Hopman}, 2003]{AH03}{Alexander}, T. and
{Hopman}, C. (2003).\newblock {Orbital inspiral into a massive black
hole in a galactic center}.\newblock {\em ApJ Lett.}, 590:L29--L32.
--

(note that each entry is a single row)

And in the second block I have

--
\bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006,
Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227

\bibitem{farmer} Farmer A J and Phinney E S, 2003,
Mon.~Not.~Roy.~Astron.~Soc.~{\bf 346} 1197

\bibitem{sesana05} Sesana A, Haardt F, Madau P and Volonteri M 2005
{\it Astrophys. J.} {\bf 623} 23

\bibitem{emriconf} Barack L and Cutler C 2004 \PR D {\bf 70} 122002
--

(idem, single rows)

This means that (for these four entries) the final result should be

---
\bibitem[ {Aarseth}, 1999]{Aarseth99}{Aarseth}, S.~J. (1999).\newblock
{From NBODY1 to NBODY6: The Growth of an Industry}.\newblock {\em
PASP}, 111:1333--1346.

\bibitem[ {Aarseth}, 2003]{Aarseth03}{Aarseth}, S.~J. (2003).\newblock
{Black hole binary dynamics}.\newblock {\em Ap\&SS}, 285:367--372.

\bibitem[ {Alexander} and {Hopman}, 2003]{AH03}{Alexander}, T. and
{Hopman}, C. (2003).\newblock {Orbital inspiral into a massive black
hole in a galactic center}.\newblock {\em ApJ Lett.}, 590:L29--L32.

\bibitem{emriconf} Barack L and Cutler C 2004 \PR D {\bf 70} 122002

\bibitem{farmer} Farmer A J and Phinney E S, 2003,
Mon.~Not.~Roy.~Astron.~Soc.~{\bf 346} 1197

\bibitem{sesana05} Sesana A, Haardt F, Madau P and Volonteri M 2005
{\it Astrophys. J.} {\bf 623} 23

\bibitem{stroeer06emri} Stroeer A, Gair J R and Vecchio A, 2006,
Proceedings of 6th LISA Symposium submitted, preprint gr-qc/0605227
--

My first feeling was to try something like visual + ! sort -k but this
doesn't work...

any idea?

I have more than 200 references and I don't feel like doing this per hand!

Thanks

Pau


RE: How to map arrow keys

2007-01-04 Thread Max Dyckhoff
I'm afraid I have no idea, but :help nmap showed this gem which I had to share.

:nunmap can also be used outside of a monastery.

Max

> -Original Message-
> From: Zheng Da [mailto:[EMAIL PROTECTED]
> Sent: Thursday, January 04, 2007 1:31 PM
> To: vim
> Subject: How to map arrow keys
>
> Hi, everyone
>
> How to map an arrow key in the normal mode?
> I tried "nmap  i-"
> Actually, it doesn't work even though running this mapping command
> doesn't give any error messages.
>
> --
> With regards
> Zheng Da


How to map arrow keys

2007-01-04 Thread Zheng Da

Hi, everyone

How to map an arrow key in the normal mode?
I tried "nmap  i-"
Actually, it doesn't work even though running this mapping command
doesn't give any error messages.

--
With regards
Zheng Da


Re: HTML files don't auto indent, everything else does

2007-01-04 Thread Charles E Campbell Jr

thesheep wrote:


For some reason the auto-indent features aren't working with HTML source
files (and I want them to).

I've tried these:

:filetype indent on
:set autoindent

I've also tried all these kinds of things:

:set shiftwidth=2
:set softtabstop=2

And then doing 'gg=G' to auto indent.

It indents my javascript nicely, but all the HTML is just pushed hard left
without any indentation.

HTML syntax is highlighted OK, so I guess the filetype thing is working.

My .vimrc file is pretty much emtpy: just says 'syntax on'.
 


Syntax highlighting is separate from indenting.

What does

 vim abc.html
 :echo b:did_indent

show?  If 0, indicates that indent/html.vim (or any indenting script) 
was not loaded.
Unfortunately, if its 1, that means that some indenting script was 
loaded (just not which one).


Continuing: what does

 :echo &indentexpr

show?  That should be:  HtmlIndentGet(v:lnum)  if html indenting was loaded.

Regards,
Chip Campbell



Re: g?vim and bizarre font request.

2007-01-04 Thread Hugh Sasse
On Thu, 4 Jan 2007, Charles E Campbell Jr wrote:

> Hugh Sasse wrote:
> 
> > On Thu, 4 Jan 2007, Charles E Campbell Jr wrote:
> > 
> >  
> > > Hugh Sasse wrote:
> > > 
> > >
> > > > I am interested in exploring Lisp before too long.  However, I have a
> > > > physical problem with the parentheses.
> > > > 
> > > >  
> > > You may find rainbow.vim helpful; see
> > > 
> > > http://mysite.verizon.net/astronaut/vim/index.html#RAINBOW
> > >
> > 
> > that looks interesting.  Done the vimball bit then I try to install
> > rainbow.vba (having gunzipped it);
> > 
[Error reports trimmed]
> > 
> > So that means it only applies to C files out of the box?
> >  
> 
> Its been awhile since I wrote the rainbow stuff; I'd forgotten that I'd
> already included it with vim 7.0's syntax/lisp.vim.
> Just put
> 
>   let g:lisp_rainbow= 1
> 
> in your <.vimrc> and it'll be enabled for Lisp.

Thank you.
> 
> > I think it would be more useful it it were setup as a plugin
> > one could use for Perl, Ruby, (your later message covers lisp), etc
> >  
> The rainbow highlighting needs to be attuned to the specific syntax
> highlighting files for each language.
> Its done by assigning a region which begins with ( and ends with ).  To retain
> normal highlighting inside
> such syntax highlighting regions, the region must "contain" language-specific
> highlighting regions.

Oh, right. I hadn't explored the internals.  I'll have a look later...
> 
> So, Perl and Ruby would need specialized versions of rainbow.vim.  I use Perl
> but seldom, and don't know Ruby,

I use Ruby much more than Perl these days, so I'll see if I can do anything
useful along these lines.  I've done small things with the syntax files
before, so I'll see if I'm biting off more than I can chew here :-)
It will be useful to learn how you've made this user selectable, rather
than the default, so I can separate concerns in future.

> and yours is the first request for rainbow highlighting for those languages
> I've received.

I don't know how big the intersect is between the set of vim users and
the set of people with nystagmus :-)  Ruby is light on parentheses in 
the way that Perl is, but sometimes
> 
[...]
> > Your web page has:
[...]
> >  
> 
> Yep!  Definitely a mistake.  Thank you for catching it!

glad I could help.
> 
> Regards,
> Chip Campbell
> 
Thank you,
Hugh


Re: g?vim and bizarre font request.

2007-01-04 Thread Charles E Campbell Jr

Hugh Sasse wrote:


On Thu, 4 Jan 2007, Charles E Campbell Jr wrote:

 


Hugh Sasse wrote:

   


I am interested in exploring Lisp before too long.  However, I have a
physical problem with the parentheses.

 


You may find rainbow.vim helpful; see

http://mysite.verizon.net/astronaut/vim/index.html#RAINBOW
   



that looks interesting.  Done the vimball bit then I try to install
rainbow.vba (having gunzipped it);

vim rainbow.vba gives:
***vimball***  Source this file to extract it! (:so %)
Error detected while processing BufEnter Auto commands for "*.vba":
E119: Not enough arguments for function: vimball#ShowMesg
Press ENTER or type command to continue

So I try to extract it anyway:
Vimball Archive
extracted : 100 lines
wrote /home/hgs/.vim/after/syntax/c/rainbow.vim

Press ENTER or type command to continue

So that means it only applies to C files out of the box?
 



Its been awhile since I wrote the rainbow stuff; I'd forgotten that I'd 
already included it with vim 7.0's syntax/lisp.vim.

Just put

  let g:lisp_rainbow= 1

in your <.vimrc> and it'll be enabled for Lisp.


I think it would be more useful it it were setup as a plugin
one could use for Perl, Ruby, (your later message covers lisp), etc
 

The rainbow highlighting needs to be attuned to the specific syntax 
highlighting files for each language.
Its done by assigning a region which begins with ( and ends with ).  To 
retain normal highlighting inside
such syntax highlighting regions, the region must "contain" 
language-specific highlighting regions.


So, Perl and Ruby would need specialized versions of rainbow.vim.  I use 
Perl but seldom, and don't know Ruby,
and yours is the first request for rainbow highlighting for those 
languages I've received.



I don't consider myself fluent in vim internals, so maybe I've
missed something with this paragraph.

Your web page has:

Rndm  
Updated Dec 15, 2005 (v1e)
 



Yep!  Definitely a mistake.  Thank you for catching it!

Regards,
Chip Campbell




Re: g?vim and bizarre font request.

2007-01-04 Thread Hugh Sasse
On Thu, 4 Jan 2007, Charles E Campbell Jr wrote:

> Hugh Sasse wrote:
> 
> > I am interested in exploring Lisp before too long.  However, I have a
> > physical problem with the parentheses.
> > 
> You may find rainbow.vim helpful; see
> 
>  http://mysite.verizon.net/astronaut/vim/index.html#RAINBOW

that looks interesting.  Done the vimball bit then I try to install
rainbow.vba (having gunzipped it);

vim rainbow.vba gives:
***vimball***  Source this file to extract it! (:so %)
Error detected while processing BufEnter Auto commands for "*.vba":
E119: Not enough arguments for function: vimball#ShowMesg
Press ENTER or type command to continue

So I try to extract it anyway:
Vimball Archive
extracted : 100 lines
wrote /home/hgs/.vim/after/syntax/c/rainbow.vim

Press ENTER or type command to continue

So that means it only applies to C files out of the box?
I think it would be more useful it it were setup as a plugin
one could use for Perl, Ruby, (your later message covers lisp), etc
I don't consider myself fluent in vim internals, so maybe I've
missed something with this paragraph.

Your web page has:

Rndm  
 Updated Dec 15, 2005 (v1e)


I think that should be (written as if this were a patch):
-Rndm  
+RunView  

  Updated Dec 15, 2005 (v1e)
> 
> It colorizes brackets [] {} () based on nesting level.

Thank you,
Hugh


Re: dictionary fun makes gvim crash

2007-01-04 Thread Charles E Campbell Jr

Kim Schulz wrote:


Hi
I get gvim to crash every time I try the following:

let mynumbers = {0:'zero',1:'one',2:'two',3:'three',4:'four',
5:'five',6:'six',7:'seven',8:'eight',9:'nine'}
function mynumbers.convert(number) dict
  return join(map(split(a:number,'\zs'), 'get(self,
v:val,"unknown")')) 
endfunction


echo mynumbers.convert(12345)

cannot get the same code to crash in the console version of vim.

another weird thing is that if I call this function (in console vim)
and uses the argument 123123123123 then it returns as if approx. half
of the digits are unknown. is it Vim's number<->string conversion
mechanism that fails or? 
 

As for the first problem, I don't see it with gvim (using Fedora Core 5, 
gvim 7.0.1-178,huge).


As for the second, I doubt that the number 123123123123 fits inside the 
number of bits in a long integer on your machine.

Is your machine a 32-bit machine?

Regards,
Chip Campbell



Re: g?vim and bizarre font request.

2007-01-04 Thread Charles E Campbell Jr

Hugh Sasse wrote:

I am interested in exploring Lisp before too long.  However, I 
have a physical problem with the parentheses.  My nystagmus

means that just outside the subitizing range my time to count
parentheses increases dramatically.  According to wikipedia
it should increase at roughly 100ms below 4 and 250 milliseconds for
every item above 4.  So this code from Wikipedia:

(defun factorial (n)
 (if (<= n 1)
   1
   (* n (factorial (- n 1)

should mean it takes about 650ms for someone to see there are 5
close parentheses at the end.


You can also simply try putting

:let g:lisp_rainbow= 1

in your <.vimrc> .  The lisp highlighting syntax file (syntax/lisp.vim) 
already supports colorizing

()s based on nesting level.

Regards,
Chip Campbell



dictionary fun makes gvim crash

2007-01-04 Thread Kim Schulz
Hi
I get gvim to crash every time I try the following:

let mynumbers = {0:'zero',1:'one',2:'two',3:'three',4:'four',
5:'five',6:'six',7:'seven',8:'eight',9:'nine'}
function mynumbers.convert(number) dict
   return join(map(split(a:number,'\zs'), 'get(self,
v:val,"unknown")')) 
endfunction

echo mynumbers.convert(12345)

cannot get the same code to crash in the console version of vim.

another weird thing is that if I call this function (in console vim)
and uses the argument 123123123123 then it returns as if approx. half
of the digits are unknown. is it Vim's number<->string conversion
mechanism that fails or? 



$ gvim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Dec 21 2006 10:24:55)
Included patches: 1-178
Compiled by Thierry Vignaud <[EMAIL PROTECTED]>
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset
+cindent 
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info
+comments 
+cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs +dnd
-ebcdic 
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path 
+folding -footer +fork() +gettext -hangul_input +iconv +insert_expand
+jumplist
 +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap
+menu 
+mksession +modify_fname +mouse +mouseshape +mouse_dec -mouse_gpm 
-mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang
-mzscheme 
+netbeans_intg -osfiletype +path_extra +perl +postscript +printer
+profile 
+python +quickfix +reltime +rightleft -ruby +scrollbind +signs
+smartindent 
-sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static 
-tag_any_white +tcl +terminfo +termresponse +textobjects +title
+toolbar 
+user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace 
+wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
+xsmp_interact 
+xterm_clipboard -xterm_save 
   system vimrc file: "/etc/vim/vimrc"
 user vimrc file: "$HOME/.vimrc"
  user exrc file: "$HOME/.exrc"
  system gvimrc file: "/etc/vim/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
-I/usr/include/freetype2 -I/usr/include/libpng12   -DORBIT2=1 -pthread
-I/usr/include/libgnomeui-2.0 -I/usr/include/libgnome-2.0
-I/usr/include/libgnomecanvas-2.0 -I/usr/include/gtk-2.0 
-I/usr/include/libart-2.0 -I/usr/include/gconf/2 -I/usr/include/libbonoboui-2.0 
-I/usr/include/gnome-vfs-2.0 -I/usr/lib/gnome-vfs-2.0/include 
-I/usr/include/gnome-keyring-1 -I/usr/include/glib-2.0 
-I/usr/lib/glib-2.0/include -I/usr/include/orbit-2.0 
-I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0 
-I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/lib/gtk-2.0/include 
-I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/libpng12 
-I/usr/include/libxml2 -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fomit-frame-pointer -march=i586 -mtune=generic -fasynchronous-unwind-tables
-Wdeclaration-after-statement -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm  
-I/usr/lib/perl5/5.8.8/i386-linux/CORE  -I/usr/include/python2.5 -pthread 
-I/usr/include  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1   
Linking: gcc   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux/CORE
-L/usr/local/lib -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0
-lgdk_pixbuf-2.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0
-lgmodule-2.0 -lglib-2.0 -lgnomeui-2 -lbonoboui-2 -lgnome-keyring
-lxml2 -lgnomecanvas-2 -lgnome-2 -lpopt -lart_lgpl_2 -lpangoft2-1.0
-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0
-lpango-1.0 -lcairo -lbonobo-2 -lgnomevfs-2 -lbonobo-activation
-lgconf-2 -lgmodule-2.0 -lORBit-2 -lgthread-2.0 -lgobject-2.0
-lglib-2.0   -lXt -ltermcap -lacl -Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.8.8/i386-linux/CORE
-L/usr/local/lib /usr/lib/perl5/5.8.8/i386-linux/auto/DynaLoader/DynaLoader.a
-L/usr/lib/perl5/5.8.8/i386-linux/CORE -lperl -lutil -lc
-L/usr/lib/python2.5/config -lpython2.5 -lutil -Xlinker -export-dynamic
-L/usr/lib -ltcl8.4 -lieee -lm 



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


Re: g?vim and bizarre font request.

2007-01-04 Thread Charles E Campbell Jr

Hugh Sasse wrote:

I am interested in exploring Lisp before too long.  However, I 
have a physical problem with the parentheses.



You may find rainbow.vim helpful; see

 http://mysite.verizon.net/astronaut/vim/index.html#RAINBOW

It colorizes brackets [] {} () based on nesting level.

Regards,
Chip Campbell



Re: Questions about syntax highlight script.

2007-01-04 Thread Charles E Campbell Jr

[EMAIL PROTECTED] wrote:


Hi vimmers, I've got some question when writing my syntax highlight script.

Q1.
The language requires a ^M character as a keyword. The ^M character is by
default highlighted but I want to highlight it to some other color, at
least it should be different from ^L and ^N...

It seems impossible to match the ^M by
:syn match Testgroup "^M"
(Note the ^M is obtained by press C-K, release, then press C-M, release,
then press )
and
:hi def link Testgroup Number
does not highlight it as desired. It seems always highlighted to some other
color.
 



Looks like you've got a problem; the SpecialKey highlighting (see :he 
hl-SpecialKey) currently can't be
overridden with syntax highlighting.  It does appear that the :match 
(and friends :2match and :3match)
can override the SpecialKey highlighting for a specific control 
character.  This problem is mentioned
in :help todo  , line#1482 (using vim 7.0's help).  As an example for 
how to use :3match:


:3match Testgroup /\%x0d/


Q2.
The string for the script language can be as long as 50-100 lines, when I
write a ":syn region" for string, it works but sometimes when I go page
down and page up, the lines of the string are highlighted as "Normal"
instead of "String", seems that the context are not concerned. Any work
around?
 


:help syn-sync


Q3.
The first occurence of colon and the following occurences in a line have
different meanings.
So, if there are text: :::;
I want to highlight the first colon as GroupA, and highlight all following
occurences of colon in the same line as GroupB. Is that possible?
 


Sure!  Here's an example summarizing the above:

" 
syn clear
syn sync fromstart

syn region Colons matchgroup=FirstColon start=':' end='$' 
contains=MoreColons

syn match MoreColons ':' contained

hi link Ctrlm  Red
hi link FirstColon Magenta
hi link MoreColons Yellow

3match Ctrlm /\%x0d/
" 

Regards,
Chip Campbell



Re: automatic code completion in vim

2007-01-04 Thread A.J.Mechelynck

Zheng Da wrote:
[...]

By the way, how to compile vim with python.
I run ./configure --enable-pythoninterp
After I compiled vim and installed it,
"vim --version|grep python" still shows
-python +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent



In order to be able to compile Vim with Python, you need not only the Python 
runtime libraries (usually the "python" package or something like that) but 
also the Python header files ("python-dev" or "python-devel" package).


Best regards,
Tony.


Re: automatic code completion in vim

2007-01-04 Thread A.J.Mechelynck

Zheng Da wrote:

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:

It's because your tag file is not sorted correctly, the last tag
"main" should be the first tag in the file. The script does a tag
binary search and the tags file must be sorted to work properly (:help
tag-binary-search).

Best regards,

Vissale

2007/1/3, zhengda <[EMAIL PROTECTED]>:
> Vissale NEANG wrote:
> > What is you ctags command?
> > Could you send me your tag file?
> >
> > Just for comparison I give you my tag file
> >
> > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> >> > Hello,
> >> >
> >> > I am the maintainer of the script and I can reproduce the problem:
> >> >
> >> > 1 int main(){
> >> > 2hello h;
> >> > 3hello::hello();
> >> > 4h.
> >> > 5hello::<- the popup menu only appear 
here

> >> > 6tmp1 t1;
> >> > 7t1.
> >> > 8 }
> >> >
> >> > At line 4, the popup menu doesn't appear because of the brace 
at line

> >> > 1. Internally the script use the vim function "searchdecl" (same
> >> > behaviour as the command "gd") to search the declaration line 
of your
> >> > object "h". But "gd" works properly only if your brace starts a 
new
> >> > line because it uses internally the command "[[" (:help gd and 
:help
> >> > [[). So if you want to see the popup menu at line 4 you have to 
write

> >> > your code like this :
> >> >
> >> > 1 int main()
> >> > 2 {   // This brace must starts the line
> >> > 3hello h;
> >> > 4hello::hello();
> >> > 5h.  // The popup menu should appear here
> >> > 6hello::
> >> > 7tmp1 t1;
> >> > 8t1.
> >> > 9 }
> >> >
> >> > At line 8, the popup menu doesn't appear because, after the 
command
> >> > "gd", the script tokenizes the source code from line 5 to 7 and 
the

> >> > resulting code in our case is :
> >> >
> >> > h.hello::tmp1 t1;
> >> >
> >> > so the script found that the type of the object "t1" is
> >> > "h.hello::tmp1", this is not correct.
> >> > If you want to see the popup menu you have to, at least, 
terminate the

> >> > instruction at line 6 with ";"
> >> >
> >> > 1 int main()
> >> > 2 {   // This brace must starts the line
> >> > 3hello h;
> >> > 4hello::hello();
> >> > 5h.print(); // The popup menu should appear here
> >> > 6hello::hello();  // you have to terminate properly your
> >> >   // instruction with ";" before the next
> >> declaration
> >> > 7tmp1 t1;
> >> > 8t1.// the popup menu should appear here
> >> > 9 }
> >> >
> >> > If you have other questions, I am there :)
> >> >
> >> > Best regards,
> >> >
> >> > Vissale
> >> >
> >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> >> > > Mikolaj Machowski wrote:
> >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> >> > > >
> >> > > >> This won't work: you need a different variable name, see
> >> ":help E706".
> >> > > >>
> >> > > >
> >> > > > Yeah, I forgot (not only about that).
> >> > > >
> >> > > > This is complete solution::
> >> > > >
> >> > > > function! UpdateTags()
> >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> >> > > >   let tags = system('ctags --c++-kinds=+p 
--fields=+iaS

> >> --extra=+q -f
> >> > > > - .tmp.cc')
> >> > > >   " Note: whitespaces around expand are tab chars.
> >> > > >   let alltags = system('grep -v " 
'.expand('%').' "

> >> tags')
> >> > > >   let tagstable = split(alltags, '\n')
> >> > > >   call add(tagstable, tags)
> >> > > >   call writefile(tagstable, 'tags', 'b')
> >> > > >   redraw!
> >> > > >   return ';'
> >> > > > endfunction
> >> > > > inoremap  ; UpdateTags()
> >> > > >
> >> > > > Note: this is untested in real life, it doesn't return any 
errors.

> >> > > >
> >> > > > In good conditions execution of whole function takes 0.46s on
> >> big tags
> >> > > > file (KMail source, tags size over 4MB, 1 lines). Delay
> >> noticeable
> >> > > > on my computer Sempron 2200, 512M RAM, old HD 5400rpm. In 
worse

> >> conditions
> >> > > > it was taking up to 0.75s::
> >> > > >
> >> > > > FUNCTION  UpdateTags()
> >> > > > Called 1 time
> >> > > > Total time:   0.527128
> >> > > >  Self time:   0.401542
> >> > > >
> >> > > > count  total (s)   self (s)
> >> > > >   1  0.000551 call 
writefile(getline(1,

> >> '$'), '.tmp.cc', 'b')
> >> > > >   1   0.026373   0.000298 let tags = system('ctags
> >> --c++-kinds=+p
> >> > > > --fields=+iaS --extra=+q -f - .tmp.cc')
> >> > > >   1  0.91 let stags = split(tags,
> >> '\n')
> >> > > >   1   0.130731   0.031220 let alltags =
> >> system('grep -v " '.expand('%').' "
> >> > > > tags')
> >> > > >   1  0.128909 let tagstable =
> >> split(alltags, '\n')
> >> > > >   1  0.43 call exten

Re: automatic code completion in vim

2007-01-04 Thread Zheng Da

This plugin seems to work well.
Thank you so much

Zheng Da

On 1/4/07, Zheng Da <[EMAIL PROTECTED]> wrote:

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> There is also an "autotag" plugin (just found it):
>
> http://www.vim.org/scripts/script.php?script_id=1343
>
> But I have not yet try it. It seems you need to compile vim with python.
>
> 2007/1/4, Zheng Da <[EMAIL PROTECTED]>:
> > On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > You can use the vim sort command (:help sort) instead of gnu sort.
> > > Moreover it's portable.
> > >
> > > 2007/1/4, Zheng Da <[EMAIL PROTECTED]>:
> > > > On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > > > It's because your tag file is not sorted correctly, the last tag
> > > > > "main" should be the first tag in the file. The script does a tag
> > > > > binary search and the tags file must be sorted to work properly (:help
> > > > > tag-binary-search).
> > > > >
> > > > > Best regards,
> > > > >
> > > > > Vissale
> > > > >
> > > > > 2007/1/3, zhengda <[EMAIL PROTECTED]>:
> > > > > > Vissale NEANG wrote:
> > > > > > > What is you ctags command?
> > > > > > > Could you send me your tag file?
> > > > > > >
> > > > > > > Just for comparison I give you my tag file
> > > > > > >
> > > > > > > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> > > > > > >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > > > > >> > Hello,
> > > > > > >> >
> > > > > > >> > I am the maintainer of the script and I can reproduce the 
problem:
> > > > > > >> >
> > > > > > >> > 1 int main(){
> > > > > > >> > 2hello h;
> > > > > > >> > 3hello::hello();
> > > > > > >> > 4h.
> > > > > > >> > 5hello::<- the popup menu only 
appear here
> > > > > > >> > 6tmp1 t1;
> > > > > > >> > 7t1.
> > > > > > >> > 8 }
> > > > > > >> >
> > > > > > >> > At line 4, the popup menu doesn't appear because of the brace 
at line
> > > > > > >> > 1. Internally the script use the vim function "searchdecl" 
(same
> > > > > > >> > behaviour as the command "gd") to search the declaration line 
of your
> > > > > > >> > object "h". But "gd" works properly only if your brace starts 
a new
> > > > > > >> > line because it uses internally the command "[[" (:help gd and 
:help
> > > > > > >> > [[). So if you want to see the popup menu at line 4 you have 
to write
> > > > > > >> > your code like this :
> > > > > > >> >
> > > > > > >> > 1 int main()
> > > > > > >> > 2 {   // This brace must starts the line
> > > > > > >> > 3hello h;
> > > > > > >> > 4hello::hello();
> > > > > > >> > 5h.  // The popup menu should appear here
> > > > > > >> > 6hello::
> > > > > > >> > 7tmp1 t1;
> > > > > > >> > 8t1.
> > > > > > >> > 9 }
> > > > > > >> >
> > > > > > >> > At line 8, the popup menu doesn't appear because, after the 
command
> > > > > > >> > "gd", the script tokenizes the source code from line 5 to 7 
and the
> > > > > > >> > resulting code in our case is :
> > > > > > >> >
> > > > > > >> > h.hello::tmp1 t1;
> > > > > > >> >
> > > > > > >> > so the script found that the type of the object "t1" is
> > > > > > >> > "h.hello::tmp1", this is not correct.
> > > > > > >> > If you want to see the popup menu you have to, at least, 
terminate the
> > > > > > >> > instruction at line 6 with ";"
> > > > > > >> >
> > > > > > >> > 1 int main()
> > > > > > >> > 2 {   // This brace must starts the line
> > > > > > >> > 3hello h;
> > > > > > >> > 4hello::hello();
> > > > > > >> > 5h.print(); // The popup menu should appear here
> > > > > > >> > 6hello::hello();  // you have to terminate properly your
> > > > > > >> >   // instruction with ";" before the 
next
> > > > > > >> declaration
> > > > > > >> > 7tmp1 t1;
> > > > > > >> > 8t1.// the popup menu should appear here
> > > > > > >> > 9 }
> > > > > > >> >
> > > > > > >> > If you have other questions, I am there :)
> > > > > > >> >
> > > > > > >> > Best regards,
> > > > > > >> >
> > > > > > >> > Vissale
> > > > > > >> >
> > > > > > >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> > > > > > >> > > Mikolaj Machowski wrote:
> > > > > > >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> > > > > > >> > > >
> > > > > > >> > > >> This won't work: you need a different variable name, see
> > > > > > >> ":help E706".
> > > > > > >> > > >>
> > > > > > >> > > >
> > > > > > >> > > > Yeah, I forgot (not only about that).
> > > > > > >> > > >
> > > > > > >> > > > This is complete solution::
> > > > > > >> > > >
> > > > > > >> > > > function! UpdateTags()
> > > > > > >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> > > > > > >> > > >   let tags = system('ctags --c++-kinds=+p 
--fields=+iaS
> > > > > > >> --extra=+q -f
> > > > > > >> > > > - .tmp.cc')
> > > > > > >> > > >   " Note: whitespaces around expand are tab chars.
> > > > > > >> > > >   let alltags = system('gre

Re: Questions about syntax highlight script.

2007-01-04 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

"A.J.Mechelynck" <[EMAIL PROTECTED]> wrote on 2007-01-04
18:18:39:

[EMAIL PROTECTED] wrote:

Hi vimmers, I've got some question when writing my syntax highlight

script.

Q1.
The language requires a ^M character as a keyword. The ^M character is

by

default highlighted but I want to highlight it to some other color, at
least it should be different from ^L and ^N...

It seems impossible to match the ^M by
:syn match Testgroup "^M"
(Note the ^M is obtained by press C-K, release, then press C-M,

release,

then press )

When using double quotes, you can match "\r" instead, but beware: ^M is

the

carriage-return character, which has special meaning on Mac (where is is

the

end-of-line character) and on Dos/Windows (where it, plus ^J [line feed]
together make an and-of-line). In general, using any character below0x20

as a

"text" character is a bad choice.


The fact is that the script language requires the source be in Unix format
on all platforms, so there should not be problem using ^M. (AFAIK Mac is
using FreeBSD kernel, isn't FreeBSD using Unix format?)

However, your solution does not seem to work. Changing "^M" to "\r" does
not get it highlighted correctly.

--
Sincerely, Pan, Shi Zhu. ext: 2606




Maybe you should add some "containedin" keyword to that Testgroup definition. 
But let's wait until someone else replies, I don't know the ins and outs of 
syntax scripts very well.



Best regards,
Tony.


Re: automatic code completion in vim

2007-01-04 Thread Zheng Da

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:

There is also an "autotag" plugin (just found it):

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

But I have not yet try it. It seems you need to compile vim with python.

2007/1/4, Zheng Da <[EMAIL PROTECTED]>:
> On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > You can use the vim sort command (:help sort) instead of gnu sort.
> > Moreover it's portable.
> >
> > 2007/1/4, Zheng Da <[EMAIL PROTECTED]>:
> > > On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > > It's because your tag file is not sorted correctly, the last tag
> > > > "main" should be the first tag in the file. The script does a tag
> > > > binary search and the tags file must be sorted to work properly (:help
> > > > tag-binary-search).
> > > >
> > > > Best regards,
> > > >
> > > > Vissale
> > > >
> > > > 2007/1/3, zhengda <[EMAIL PROTECTED]>:
> > > > > Vissale NEANG wrote:
> > > > > > What is you ctags command?
> > > > > > Could you send me your tag file?
> > > > > >
> > > > > > Just for comparison I give you my tag file
> > > > > >
> > > > > > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> > > > > >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > > > >> > Hello,
> > > > > >> >
> > > > > >> > I am the maintainer of the script and I can reproduce the 
problem:
> > > > > >> >
> > > > > >> > 1 int main(){
> > > > > >> > 2hello h;
> > > > > >> > 3hello::hello();
> > > > > >> > 4h.
> > > > > >> > 5hello::<- the popup menu only appear 
here
> > > > > >> > 6tmp1 t1;
> > > > > >> > 7t1.
> > > > > >> > 8 }
> > > > > >> >
> > > > > >> > At line 4, the popup menu doesn't appear because of the brace at 
line
> > > > > >> > 1. Internally the script use the vim function "searchdecl" (same
> > > > > >> > behaviour as the command "gd") to search the declaration line of 
your
> > > > > >> > object "h". But "gd" works properly only if your brace starts a 
new
> > > > > >> > line because it uses internally the command "[[" (:help gd and 
:help
> > > > > >> > [[). So if you want to see the popup menu at line 4 you have to 
write
> > > > > >> > your code like this :
> > > > > >> >
> > > > > >> > 1 int main()
> > > > > >> > 2 {   // This brace must starts the line
> > > > > >> > 3hello h;
> > > > > >> > 4hello::hello();
> > > > > >> > 5h.  // The popup menu should appear here
> > > > > >> > 6hello::
> > > > > >> > 7tmp1 t1;
> > > > > >> > 8t1.
> > > > > >> > 9 }
> > > > > >> >
> > > > > >> > At line 8, the popup menu doesn't appear because, after the 
command
> > > > > >> > "gd", the script tokenizes the source code from line 5 to 7 and 
the
> > > > > >> > resulting code in our case is :
> > > > > >> >
> > > > > >> > h.hello::tmp1 t1;
> > > > > >> >
> > > > > >> > so the script found that the type of the object "t1" is
> > > > > >> > "h.hello::tmp1", this is not correct.
> > > > > >> > If you want to see the popup menu you have to, at least, 
terminate the
> > > > > >> > instruction at line 6 with ";"
> > > > > >> >
> > > > > >> > 1 int main()
> > > > > >> > 2 {   // This brace must starts the line
> > > > > >> > 3hello h;
> > > > > >> > 4hello::hello();
> > > > > >> > 5h.print(); // The popup menu should appear here
> > > > > >> > 6hello::hello();  // you have to terminate properly your
> > > > > >> >   // instruction with ";" before the next
> > > > > >> declaration
> > > > > >> > 7tmp1 t1;
> > > > > >> > 8t1.// the popup menu should appear here
> > > > > >> > 9 }
> > > > > >> >
> > > > > >> > If you have other questions, I am there :)
> > > > > >> >
> > > > > >> > Best regards,
> > > > > >> >
> > > > > >> > Vissale
> > > > > >> >
> > > > > >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> > > > > >> > > Mikolaj Machowski wrote:
> > > > > >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> > > > > >> > > >
> > > > > >> > > >> This won't work: you need a different variable name, see
> > > > > >> ":help E706".
> > > > > >> > > >>
> > > > > >> > > >
> > > > > >> > > > Yeah, I forgot (not only about that).
> > > > > >> > > >
> > > > > >> > > > This is complete solution::
> > > > > >> > > >
> > > > > >> > > > function! UpdateTags()
> > > > > >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> > > > > >> > > >   let tags = system('ctags --c++-kinds=+p 
--fields=+iaS
> > > > > >> --extra=+q -f
> > > > > >> > > > - .tmp.cc')
> > > > > >> > > >   " Note: whitespaces around expand are tab chars.
> > > > > >> > > >   let alltags = system('grep -v " '.expand('%').' 
"
> > > > > >> tags')
> > > > > >> > > >   let tagstable = split(alltags, '\n')
> > > > > >> > > >   call add(tagstable, tags)
> > > > > >> > > >   call writefile(tagstable, 'tags', 'b')
> > > > > >> > > >   redraw!
> > > > > >> > > >   return ';'
> > > > > >

Re: Questions about syntax highlight script.

2007-01-04 Thread panshizhu
"A.J.Mechelynck" <[EMAIL PROTECTED]> wrote on 2007-01-04
18:18:39:
> [EMAIL PROTECTED] wrote:
> > Hi vimmers, I've got some question when writing my syntax highlight
script.
> >
> > Q1.
> > The language requires a ^M character as a keyword. The ^M character is
by
> > default highlighted but I want to highlight it to some other color, at
> > least it should be different from ^L and ^N...
> >
> > It seems impossible to match the ^M by
> > :syn match Testgroup "^M"
> > (Note the ^M is obtained by press C-K, release, then press C-M,
release,
> > then press )
>
> When using double quotes, you can match "\r" instead, but beware: ^M is
the
> carriage-return character, which has special meaning on Mac (where is is
the
> end-of-line character) and on Dos/Windows (where it, plus ^J [line feed]
> together make an and-of-line). In general, using any character below0x20
as a
> "text" character is a bad choice.

The fact is that the script language requires the source be in Unix format
on all platforms, so there should not be problem using ^M. (AFAIK Mac is
using FreeBSD kernel, isn't FreeBSD using Unix format?)

However, your solution does not seem to work. Changing "^M" to "\r" does
not get it highlighted correctly.

--
Sincerely, Pan, Shi Zhu. ext: 2606



Re: g?vim and bizarre font request.

2007-01-04 Thread Hugh Sasse
On Thu, 4 Jan 2007, Tim Chase wrote:

> > (* n (factorial (- n 1)
> > 
[3 secs for me to count, moving cursor over is slower]
> > find a font and a means of displaying it which slightly disturbs the
> > spacing, position or shape of successive parentheses, so the pattern is
[...]
> > 
> > Given my preferred editor is Vim, and I'm using it on Windows, mostly
> > with PuTTY talking to a Unix box, does anyone know if I can do this?
> > Maybe there's another solution?
> 
> Well, when coming in over a SSH connection, there's not much you can do to
> make the font itself change.  However, you can colorize differently.  Toying

But if there is a wobbly font I could switch to manually for
everything, at the Windows end,  that would suffice.

> around, I came up with this:
> 
>   :match Error /)\zs)/
> 
> which seems to correctly highlight alternating adjacent parents (using the
> "Error" group, which I tend to use, but adjust according to taste).  My

I'll probably need another group for that, but this looks a useful technique.
[...] Spellcap looks good to me.

> original though was to try and do something of the form
> "\%1c(\|%3c(\|%5c(\|..." for alternating screen columns, but I like the
> compactness of the actual solution I gave, as well as its ability to work
> regardless of the number of columns in your terminal window.

Thank you.
> 
> -tim
> 
Hugh
> 
> 
> 



Re: g?vim and bizarre font request.

2007-01-04 Thread Tim Chase

(* n (factorial (- n 1)

should mean it takes about 650ms for someone to see there are 5
close parentheses at the end.  It takes me about 3 seconds of
concious effort to reach that number.  Moving the cursor over them
is one option, but it is slower.  I think another might be if I can
find a font and a means of displaying it which slightly disturbs the
spacing, position or shape of successive parentheses, so the pattern is
irregular. Then when the characters appear to "move about" for me I
won't mix them up and come to a wrong count. I'm thinking of the
way text used to be just a bit wobbly with the line printers of the
1980's.

Given my preferred editor is Vim, and I'm using it on Windows, mostly
with PuTTY talking to a Unix box, does anyone know if I can do this?
Maybe there's another solution?


Well, when coming in over a SSH connection, there's not much you 
can do to make the font itself change.  However, you can colorize 
differently.  Toying around, I came up with this:


:match Error /)\zs)/

which seems to correctly highlight alternating adjacent parents 
(using the "Error" group, which I tend to use, but adjust 
according to taste).  My original though was to try and do 
something of the form "\%1c(\|%3c(\|%5c(\|..." for alternating 
screen columns, but I like the compactness of the actual solution 
I gave, as well as its ability to work regardless of the number 
of columns in your terminal window.


-tim





Re: Any way of getting statusline=%B in insert mode?

2007-01-04 Thread DervishD
Hi Redoute :)

 * Redoute <[EMAIL PROTECTED]> dixit:
> DervishD wrote:
> > Any way of working around this problem?
> 
> %{char2nr(getline('.')[col('.')-1])}
> 
> works for me.

Thanks! I've modified it a bit, because I wanted the number as hexa
and always with the same width, using "printf":

set statusline=%y%m%r\ %t%=[%L]\ %05l,%03c\ 
%{printf('x%02x',char2nr(getline('.')[col('.')-1]))}


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!


g?vim and bizarre font request.

2007-01-04 Thread Hugh Sasse
I am interested in exploring Lisp before too long.  However, I 
have a physical problem with the parentheses.  My nystagmus
means that just outside the subitizing range my time to count
parentheses increases dramatically.  According to wikipedia
it should increase at roughly 100ms below 4 and 250 milliseconds for
every item above 4.  So this code from Wikipedia:

(defun factorial (n)
  (if (<= n 1)
1
(* n (factorial (- n 1)

should mean it takes about 650ms for someone to see there are 5
close parentheses at the end.  It takes me about 3 seconds of
concious effort to reach that number.  Moving the cursor over them
is one option, but it is slower.  I think another might be if I can
find a font and a means of displaying it which slightly disturbs the
spacing, position or shape of successive parentheses, so the pattern is
irregular. Then when the characters appear to "move about" for me I
won't mix them up and come to a wrong count. I'm thinking of the
way text used to be just a bit wobbly with the line printers of the
1980's.

Given my preferred editor is Vim, and I'm using it on Windows, mostly
with PuTTY talking to a Unix box, does anyone know if I can do this?
Maybe there's another solution?

Thank you
Hugh



Re: automatic code completion in vim

2007-01-04 Thread Vissale NEANG

There is also an "autotag" plugin (just found it):

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

But I have not yet try it. It seems you need to compile vim with python.

2007/1/4, Zheng Da <[EMAIL PROTECTED]>:

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> You can use the vim sort command (:help sort) instead of gnu sort.
> Moreover it's portable.
>
> 2007/1/4, Zheng Da <[EMAIL PROTECTED]>:
> > On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > It's because your tag file is not sorted correctly, the last tag
> > > "main" should be the first tag in the file. The script does a tag
> > > binary search and the tags file must be sorted to work properly (:help
> > > tag-binary-search).
> > >
> > > Best regards,
> > >
> > > Vissale
> > >
> > > 2007/1/3, zhengda <[EMAIL PROTECTED]>:
> > > > Vissale NEANG wrote:
> > > > > What is you ctags command?
> > > > > Could you send me your tag file?
> > > > >
> > > > > Just for comparison I give you my tag file
> > > > >
> > > > > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> > > > >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > > >> > Hello,
> > > > >> >
> > > > >> > I am the maintainer of the script and I can reproduce the problem:
> > > > >> >
> > > > >> > 1 int main(){
> > > > >> > 2hello h;
> > > > >> > 3hello::hello();
> > > > >> > 4h.
> > > > >> > 5hello::<- the popup menu only appear 
here
> > > > >> > 6tmp1 t1;
> > > > >> > 7t1.
> > > > >> > 8 }
> > > > >> >
> > > > >> > At line 4, the popup menu doesn't appear because of the brace at 
line
> > > > >> > 1. Internally the script use the vim function "searchdecl" (same
> > > > >> > behaviour as the command "gd") to search the declaration line of 
your
> > > > >> > object "h". But "gd" works properly only if your brace starts a new
> > > > >> > line because it uses internally the command "[[" (:help gd and 
:help
> > > > >> > [[). So if you want to see the popup menu at line 4 you have to 
write
> > > > >> > your code like this :
> > > > >> >
> > > > >> > 1 int main()
> > > > >> > 2 {   // This brace must starts the line
> > > > >> > 3hello h;
> > > > >> > 4hello::hello();
> > > > >> > 5h.  // The popup menu should appear here
> > > > >> > 6hello::
> > > > >> > 7tmp1 t1;
> > > > >> > 8t1.
> > > > >> > 9 }
> > > > >> >
> > > > >> > At line 8, the popup menu doesn't appear because, after the command
> > > > >> > "gd", the script tokenizes the source code from line 5 to 7 and the
> > > > >> > resulting code in our case is :
> > > > >> >
> > > > >> > h.hello::tmp1 t1;
> > > > >> >
> > > > >> > so the script found that the type of the object "t1" is
> > > > >> > "h.hello::tmp1", this is not correct.
> > > > >> > If you want to see the popup menu you have to, at least, terminate 
the
> > > > >> > instruction at line 6 with ";"
> > > > >> >
> > > > >> > 1 int main()
> > > > >> > 2 {   // This brace must starts the line
> > > > >> > 3hello h;
> > > > >> > 4hello::hello();
> > > > >> > 5h.print(); // The popup menu should appear here
> > > > >> > 6hello::hello();  // you have to terminate properly your
> > > > >> >   // instruction with ";" before the next
> > > > >> declaration
> > > > >> > 7tmp1 t1;
> > > > >> > 8t1.// the popup menu should appear here
> > > > >> > 9 }
> > > > >> >
> > > > >> > If you have other questions, I am there :)
> > > > >> >
> > > > >> > Best regards,
> > > > >> >
> > > > >> > Vissale
> > > > >> >
> > > > >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> > > > >> > > Mikolaj Machowski wrote:
> > > > >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> > > > >> > > >
> > > > >> > > >> This won't work: you need a different variable name, see
> > > > >> ":help E706".
> > > > >> > > >>
> > > > >> > > >
> > > > >> > > > Yeah, I forgot (not only about that).
> > > > >> > > >
> > > > >> > > > This is complete solution::
> > > > >> > > >
> > > > >> > > > function! UpdateTags()
> > > > >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> > > > >> > > >   let tags = system('ctags --c++-kinds=+p --fields=+iaS
> > > > >> --extra=+q -f
> > > > >> > > > - .tmp.cc')
> > > > >> > > >   " Note: whitespaces around expand are tab chars.
> > > > >> > > >   let alltags = system('grep -v " '.expand('%').' "
> > > > >> tags')
> > > > >> > > >   let tagstable = split(alltags, '\n')
> > > > >> > > >   call add(tagstable, tags)
> > > > >> > > >   call writefile(tagstable, 'tags', 'b')
> > > > >> > > >   redraw!
> > > > >> > > >   return ';'
> > > > >> > > > endfunction
> > > > >> > > > inoremap  ; UpdateTags()
> > > > >> > > >
> > > > >> > > > Note: this is untested in real life, it doesn't return any 
errors.
> > > > >> > > >
> > > > >> > > > In good conditions execution of whole function takes 0.46s on
> > > > >>

Re: automatic code completion in vim

2007-01-04 Thread Zheng Da

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:

You can use the vim sort command (:help sort) instead of gnu sort.
Moreover it's portable.

2007/1/4, Zheng Da <[EMAIL PROTECTED]>:
> On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > It's because your tag file is not sorted correctly, the last tag
> > "main" should be the first tag in the file. The script does a tag
> > binary search and the tags file must be sorted to work properly (:help
> > tag-binary-search).
> >
> > Best regards,
> >
> > Vissale
> >
> > 2007/1/3, zhengda <[EMAIL PROTECTED]>:
> > > Vissale NEANG wrote:
> > > > What is you ctags command?
> > > > Could you send me your tag file?
> > > >
> > > > Just for comparison I give you my tag file
> > > >
> > > > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> > > >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > > >> > Hello,
> > > >> >
> > > >> > I am the maintainer of the script and I can reproduce the problem:
> > > >> >
> > > >> > 1 int main(){
> > > >> > 2hello h;
> > > >> > 3hello::hello();
> > > >> > 4h.
> > > >> > 5hello::<- the popup menu only appear here
> > > >> > 6tmp1 t1;
> > > >> > 7t1.
> > > >> > 8 }
> > > >> >
> > > >> > At line 4, the popup menu doesn't appear because of the brace at line
> > > >> > 1. Internally the script use the vim function "searchdecl" (same
> > > >> > behaviour as the command "gd") to search the declaration line of your
> > > >> > object "h". But "gd" works properly only if your brace starts a new
> > > >> > line because it uses internally the command "[[" (:help gd and :help
> > > >> > [[). So if you want to see the popup menu at line 4 you have to write
> > > >> > your code like this :
> > > >> >
> > > >> > 1 int main()
> > > >> > 2 {   // This brace must starts the line
> > > >> > 3hello h;
> > > >> > 4hello::hello();
> > > >> > 5h.  // The popup menu should appear here
> > > >> > 6hello::
> > > >> > 7tmp1 t1;
> > > >> > 8t1.
> > > >> > 9 }
> > > >> >
> > > >> > At line 8, the popup menu doesn't appear because, after the command
> > > >> > "gd", the script tokenizes the source code from line 5 to 7 and the
> > > >> > resulting code in our case is :
> > > >> >
> > > >> > h.hello::tmp1 t1;
> > > >> >
> > > >> > so the script found that the type of the object "t1" is
> > > >> > "h.hello::tmp1", this is not correct.
> > > >> > If you want to see the popup menu you have to, at least, terminate 
the
> > > >> > instruction at line 6 with ";"
> > > >> >
> > > >> > 1 int main()
> > > >> > 2 {   // This brace must starts the line
> > > >> > 3hello h;
> > > >> > 4hello::hello();
> > > >> > 5h.print(); // The popup menu should appear here
> > > >> > 6hello::hello();  // you have to terminate properly your
> > > >> >   // instruction with ";" before the next
> > > >> declaration
> > > >> > 7tmp1 t1;
> > > >> > 8t1.// the popup menu should appear here
> > > >> > 9 }
> > > >> >
> > > >> > If you have other questions, I am there :)
> > > >> >
> > > >> > Best regards,
> > > >> >
> > > >> > Vissale
> > > >> >
> > > >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> > > >> > > Mikolaj Machowski wrote:
> > > >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> > > >> > > >
> > > >> > > >> This won't work: you need a different variable name, see
> > > >> ":help E706".
> > > >> > > >>
> > > >> > > >
> > > >> > > > Yeah, I forgot (not only about that).
> > > >> > > >
> > > >> > > > This is complete solution::
> > > >> > > >
> > > >> > > > function! UpdateTags()
> > > >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> > > >> > > >   let tags = system('ctags --c++-kinds=+p --fields=+iaS
> > > >> --extra=+q -f
> > > >> > > > - .tmp.cc')
> > > >> > > >   " Note: whitespaces around expand are tab chars.
> > > >> > > >   let alltags = system('grep -v " '.expand('%').' "
> > > >> tags')
> > > >> > > >   let tagstable = split(alltags, '\n')
> > > >> > > >   call add(tagstable, tags)
> > > >> > > >   call writefile(tagstable, 'tags', 'b')
> > > >> > > >   redraw!
> > > >> > > >   return ';'
> > > >> > > > endfunction
> > > >> > > > inoremap  ; UpdateTags()
> > > >> > > >
> > > >> > > > Note: this is untested in real life, it doesn't return any 
errors.
> > > >> > > >
> > > >> > > > In good conditions execution of whole function takes 0.46s on
> > > >> big tags
> > > >> > > > file (KMail source, tags size over 4MB, 1 lines). Delay
> > > >> noticeable
> > > >> > > > on my computer Sempron 2200, 512M RAM, old HD 5400rpm. In worse
> > > >> conditions
> > > >> > > > it was taking up to 0.75s::
> > > >> > > >
> > > >> > > > FUNCTION  UpdateTags()
> > > >> > > > Called 1 time
> > > >> > > > Total time:   0.527128
> > > >> > > >  Self time:   0.401542
> > > >> > > >
> > > >> > > >

Re: automatic code completion in vim

2007-01-04 Thread Vissale NEANG

You can use the vim sort command (:help sort) instead of gnu sort.
Moreover it's portable.

2007/1/4, Zheng Da <[EMAIL PROTECTED]>:

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> It's because your tag file is not sorted correctly, the last tag
> "main" should be the first tag in the file. The script does a tag
> binary search and the tags file must be sorted to work properly (:help
> tag-binary-search).
>
> Best regards,
>
> Vissale
>
> 2007/1/3, zhengda <[EMAIL PROTECTED]>:
> > Vissale NEANG wrote:
> > > What is you ctags command?
> > > Could you send me your tag file?
> > >
> > > Just for comparison I give you my tag file
> > >
> > > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> > >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> > >> > Hello,
> > >> >
> > >> > I am the maintainer of the script and I can reproduce the problem:
> > >> >
> > >> > 1 int main(){
> > >> > 2hello h;
> > >> > 3hello::hello();
> > >> > 4h.
> > >> > 5hello::<- the popup menu only appear here
> > >> > 6tmp1 t1;
> > >> > 7t1.
> > >> > 8 }
> > >> >
> > >> > At line 4, the popup menu doesn't appear because of the brace at line
> > >> > 1. Internally the script use the vim function "searchdecl" (same
> > >> > behaviour as the command "gd") to search the declaration line of your
> > >> > object "h". But "gd" works properly only if your brace starts a new
> > >> > line because it uses internally the command "[[" (:help gd and :help
> > >> > [[). So if you want to see the popup menu at line 4 you have to write
> > >> > your code like this :
> > >> >
> > >> > 1 int main()
> > >> > 2 {   // This brace must starts the line
> > >> > 3hello h;
> > >> > 4hello::hello();
> > >> > 5h.  // The popup menu should appear here
> > >> > 6hello::
> > >> > 7tmp1 t1;
> > >> > 8t1.
> > >> > 9 }
> > >> >
> > >> > At line 8, the popup menu doesn't appear because, after the command
> > >> > "gd", the script tokenizes the source code from line 5 to 7 and the
> > >> > resulting code in our case is :
> > >> >
> > >> > h.hello::tmp1 t1;
> > >> >
> > >> > so the script found that the type of the object "t1" is
> > >> > "h.hello::tmp1", this is not correct.
> > >> > If you want to see the popup menu you have to, at least, terminate the
> > >> > instruction at line 6 with ";"
> > >> >
> > >> > 1 int main()
> > >> > 2 {   // This brace must starts the line
> > >> > 3hello h;
> > >> > 4hello::hello();
> > >> > 5h.print(); // The popup menu should appear here
> > >> > 6hello::hello();  // you have to terminate properly your
> > >> >   // instruction with ";" before the next
> > >> declaration
> > >> > 7tmp1 t1;
> > >> > 8t1.// the popup menu should appear here
> > >> > 9 }
> > >> >
> > >> > If you have other questions, I am there :)
> > >> >
> > >> > Best regards,
> > >> >
> > >> > Vissale
> > >> >
> > >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> > >> > > Mikolaj Machowski wrote:
> > >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> > >> > > >
> > >> > > >> This won't work: you need a different variable name, see
> > >> ":help E706".
> > >> > > >>
> > >> > > >
> > >> > > > Yeah, I forgot (not only about that).
> > >> > > >
> > >> > > > This is complete solution::
> > >> > > >
> > >> > > > function! UpdateTags()
> > >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> > >> > > >   let tags = system('ctags --c++-kinds=+p --fields=+iaS
> > >> --extra=+q -f
> > >> > > > - .tmp.cc')
> > >> > > >   " Note: whitespaces around expand are tab chars.
> > >> > > >   let alltags = system('grep -v " '.expand('%').' "
> > >> tags')
> > >> > > >   let tagstable = split(alltags, '\n')
> > >> > > >   call add(tagstable, tags)
> > >> > > >   call writefile(tagstable, 'tags', 'b')
> > >> > > >   redraw!
> > >> > > >   return ';'
> > >> > > > endfunction
> > >> > > > inoremap  ; UpdateTags()
> > >> > > >
> > >> > > > Note: this is untested in real life, it doesn't return any errors.
> > >> > > >
> > >> > > > In good conditions execution of whole function takes 0.46s on
> > >> big tags
> > >> > > > file (KMail source, tags size over 4MB, 1 lines). Delay
> > >> noticeable
> > >> > > > on my computer Sempron 2200, 512M RAM, old HD 5400rpm. In worse
> > >> conditions
> > >> > > > it was taking up to 0.75s::
> > >> > > >
> > >> > > > FUNCTION  UpdateTags()
> > >> > > > Called 1 time
> > >> > > > Total time:   0.527128
> > >> > > >  Self time:   0.401542
> > >> > > >
> > >> > > > count  total (s)   self (s)
> > >> > > >   1  0.000551 call writefile(getline(1,
> > >> '$'), '.tmp.cc', 'b')
> > >> > > >   1   0.026373   0.000298 let tags = system('ctags
> > >> --c++-kinds=+p
> > >> > > > --fields=+iaS --extra=+q -f - .tmp.cc')
> > >> > > >  

Re: Questions about syntax highlight script.

2007-01-04 Thread A.J.Mechelynck

[EMAIL PROTECTED] wrote:

Hi vimmers, I've got some question when writing my syntax highlight script.

Q1.
The language requires a ^M character as a keyword. The ^M character is by
default highlighted but I want to highlight it to some other color, at
least it should be different from ^L and ^N...

It seems impossible to match the ^M by
:syn match Testgroup "^M"
(Note the ^M is obtained by press C-K, release, then press C-M, release,
then press )


When using double quotes, you can match "\r" instead, but beware: ^M is the 
carriage-return character, which has special meaning on Mac (where is is the 
end-of-line character) and on Dos/Windows (where it, plus ^J [line feed] 
together make an and-of-line). In general, using any character below 0x20 as a 
"text" character is a bad choice.



and
:hi def link Testgroup Number
does not highlight it as desired. It seems always highlighted to some other
color.

Q2.
The string for the script language can be as long as 50-100 lines, when I
write a ":syn region" for string, it works but sometimes when I go page
down and page up, the lines of the string are highlighted as "Normal"
instead of "String", seems that the context are not concerned. Any work
around?


change the ":syn sync" statement, or add one to your syntax script or to your 
vimrc, see ":help :syn-sync". I have a similar case where I have HTML pages 
with extremely long blocks of italics, but since they are in one particular 
project only, I use that project's directory as part of the match string in a 
BufRead,BufNewFile autocommand with "syn sync fromstart" as the command.




Q3.
The first occurence of colon and the following occurences in a line have
different meanings.
So, if there are text: :::;
I want to highlight the first colon as GroupA, and highlight all following
occurences of colon in the same line as GroupB. Is that possible?

Thanks in advance.

--
Sincerely, Pan, Shi Zhu. ext: 2606




Best regards,
Tony.


Re: automatic code completion in vim

2007-01-04 Thread Zheng Da

On 1/4/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:

It's because your tag file is not sorted correctly, the last tag
"main" should be the first tag in the file. The script does a tag
binary search and the tags file must be sorted to work properly (:help
tag-binary-search).

Best regards,

Vissale

2007/1/3, zhengda <[EMAIL PROTECTED]>:
> Vissale NEANG wrote:
> > What is you ctags command?
> > Could you send me your tag file?
> >
> > Just for comparison I give you my tag file
> >
> > 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
> >> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
> >> > Hello,
> >> >
> >> > I am the maintainer of the script and I can reproduce the problem:
> >> >
> >> > 1 int main(){
> >> > 2hello h;
> >> > 3hello::hello();
> >> > 4h.
> >> > 5hello::<- the popup menu only appear here
> >> > 6tmp1 t1;
> >> > 7t1.
> >> > 8 }
> >> >
> >> > At line 4, the popup menu doesn't appear because of the brace at line
> >> > 1. Internally the script use the vim function "searchdecl" (same
> >> > behaviour as the command "gd") to search the declaration line of your
> >> > object "h". But "gd" works properly only if your brace starts a new
> >> > line because it uses internally the command "[[" (:help gd and :help
> >> > [[). So if you want to see the popup menu at line 4 you have to write
> >> > your code like this :
> >> >
> >> > 1 int main()
> >> > 2 {   // This brace must starts the line
> >> > 3hello h;
> >> > 4hello::hello();
> >> > 5h.  // The popup menu should appear here
> >> > 6hello::
> >> > 7tmp1 t1;
> >> > 8t1.
> >> > 9 }
> >> >
> >> > At line 8, the popup menu doesn't appear because, after the command
> >> > "gd", the script tokenizes the source code from line 5 to 7 and the
> >> > resulting code in our case is :
> >> >
> >> > h.hello::tmp1 t1;
> >> >
> >> > so the script found that the type of the object "t1" is
> >> > "h.hello::tmp1", this is not correct.
> >> > If you want to see the popup menu you have to, at least, terminate the
> >> > instruction at line 6 with ";"
> >> >
> >> > 1 int main()
> >> > 2 {   // This brace must starts the line
> >> > 3hello h;
> >> > 4hello::hello();
> >> > 5h.print(); // The popup menu should appear here
> >> > 6hello::hello();  // you have to terminate properly your
> >> >   // instruction with ";" before the next
> >> declaration
> >> > 7tmp1 t1;
> >> > 8t1.// the popup menu should appear here
> >> > 9 }
> >> >
> >> > If you have other questions, I am there :)
> >> >
> >> > Best regards,
> >> >
> >> > Vissale
> >> >
> >> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
> >> > > Mikolaj Machowski wrote:
> >> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
> >> > > >
> >> > > >> This won't work: you need a different variable name, see
> >> ":help E706".
> >> > > >>
> >> > > >
> >> > > > Yeah, I forgot (not only about that).
> >> > > >
> >> > > > This is complete solution::
> >> > > >
> >> > > > function! UpdateTags()
> >> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
> >> > > >   let tags = system('ctags --c++-kinds=+p --fields=+iaS
> >> --extra=+q -f
> >> > > > - .tmp.cc')
> >> > > >   " Note: whitespaces around expand are tab chars.
> >> > > >   let alltags = system('grep -v " '.expand('%').' "
> >> tags')
> >> > > >   let tagstable = split(alltags, '\n')
> >> > > >   call add(tagstable, tags)
> >> > > >   call writefile(tagstable, 'tags', 'b')
> >> > > >   redraw!
> >> > > >   return ';'
> >> > > > endfunction
> >> > > > inoremap  ; UpdateTags()
> >> > > >
> >> > > > Note: this is untested in real life, it doesn't return any errors.
> >> > > >
> >> > > > In good conditions execution of whole function takes 0.46s on
> >> big tags
> >> > > > file (KMail source, tags size over 4MB, 1 lines). Delay
> >> noticeable
> >> > > > on my computer Sempron 2200, 512M RAM, old HD 5400rpm. In worse
> >> conditions
> >> > > > it was taking up to 0.75s::
> >> > > >
> >> > > > FUNCTION  UpdateTags()
> >> > > > Called 1 time
> >> > > > Total time:   0.527128
> >> > > >  Self time:   0.401542
> >> > > >
> >> > > > count  total (s)   self (s)
> >> > > >   1  0.000551 call writefile(getline(1,
> >> '$'), '.tmp.cc', 'b')
> >> > > >   1   0.026373   0.000298 let tags = system('ctags
> >> --c++-kinds=+p
> >> > > > --fields=+iaS --extra=+q -f - .tmp.cc')
> >> > > >   1  0.91 let stags = split(tags,
> >> '\n')
> >> > > >   1   0.130731   0.031220 let alltags =
> >> system('grep -v " '.expand('%').' "
> >> > > > tags')
> >> > > >   1  0.128909 let tagstable =
> >> split(alltags, '\n')
> >> > > >   1  0.43 call extend(tagstable,
> >> stags)
> >> > > >  

Re: automatic code completion in vim

2007-01-04 Thread Vissale NEANG

It's because your tag file is not sorted correctly, the last tag
"main" should be the first tag in the file. The script does a tag
binary search and the tags file must be sorted to work properly (:help
tag-binary-search).

Best regards,

Vissale

2007/1/3, zhengda <[EMAIL PROTECTED]>:

Vissale NEANG wrote:
> What is you ctags command?
> Could you send me your tag file?
>
> Just for comparison I give you my tag file
>
> 2007/1/3, Zheng Da <[EMAIL PROTECTED]>:
>> On 1/3/07, Vissale NEANG <[EMAIL PROTECTED]> wrote:
>> > Hello,
>> >
>> > I am the maintainer of the script and I can reproduce the problem:
>> >
>> > 1 int main(){
>> > 2hello h;
>> > 3hello::hello();
>> > 4h.
>> > 5hello::<- the popup menu only appear here
>> > 6tmp1 t1;
>> > 7t1.
>> > 8 }
>> >
>> > At line 4, the popup menu doesn't appear because of the brace at line
>> > 1. Internally the script use the vim function "searchdecl" (same
>> > behaviour as the command "gd") to search the declaration line of your
>> > object "h". But "gd" works properly only if your brace starts a new
>> > line because it uses internally the command "[[" (:help gd and :help
>> > [[). So if you want to see the popup menu at line 4 you have to write
>> > your code like this :
>> >
>> > 1 int main()
>> > 2 {   // This brace must starts the line
>> > 3hello h;
>> > 4hello::hello();
>> > 5h.  // The popup menu should appear here
>> > 6hello::
>> > 7tmp1 t1;
>> > 8t1.
>> > 9 }
>> >
>> > At line 8, the popup menu doesn't appear because, after the command
>> > "gd", the script tokenizes the source code from line 5 to 7 and the
>> > resulting code in our case is :
>> >
>> > h.hello::tmp1 t1;
>> >
>> > so the script found that the type of the object "t1" is
>> > "h.hello::tmp1", this is not correct.
>> > If you want to see the popup menu you have to, at least, terminate the
>> > instruction at line 6 with ";"
>> >
>> > 1 int main()
>> > 2 {   // This brace must starts the line
>> > 3hello h;
>> > 4hello::hello();
>> > 5h.print(); // The popup menu should appear here
>> > 6hello::hello();  // you have to terminate properly your
>> >   // instruction with ";" before the next
>> declaration
>> > 7tmp1 t1;
>> > 8t1.// the popup menu should appear here
>> > 9 }
>> >
>> > If you have other questions, I am there :)
>> >
>> > Best regards,
>> >
>> > Vissale
>> >
>> > 2007/1/2, zhengda <[EMAIL PROTECTED]>:
>> > > Mikolaj Machowski wrote:
>> > > > On pon sty 1 2007, Mikolaj Machowski wrote:
>> > > >
>> > > >> This won't work: you need a different variable name, see
>> ":help E706".
>> > > >>
>> > > >
>> > > > Yeah, I forgot (not only about that).
>> > > >
>> > > > This is complete solution::
>> > > >
>> > > > function! UpdateTags()
>> > > >   call writefile(getline(1, '$'), '.tmp.cc', 'b')
>> > > >   let tags = system('ctags --c++-kinds=+p --fields=+iaS
>> --extra=+q -f
>> > > > - .tmp.cc')
>> > > >   " Note: whitespaces around expand are tab chars.
>> > > >   let alltags = system('grep -v " '.expand('%').' "
>> tags')
>> > > >   let tagstable = split(alltags, '\n')
>> > > >   call add(tagstable, tags)
>> > > >   call writefile(tagstable, 'tags', 'b')
>> > > >   redraw!
>> > > >   return ';'
>> > > > endfunction
>> > > > inoremap  ; UpdateTags()
>> > > >
>> > > > Note: this is untested in real life, it doesn't return any errors.
>> > > >
>> > > > In good conditions execution of whole function takes 0.46s on
>> big tags
>> > > > file (KMail source, tags size over 4MB, 1 lines). Delay
>> noticeable
>> > > > on my computer Sempron 2200, 512M RAM, old HD 5400rpm. In worse
>> conditions
>> > > > it was taking up to 0.75s::
>> > > >
>> > > > FUNCTION  UpdateTags()
>> > > > Called 1 time
>> > > > Total time:   0.527128
>> > > >  Self time:   0.401542
>> > > >
>> > > > count  total (s)   self (s)
>> > > >   1  0.000551 call writefile(getline(1,
>> '$'), '.tmp.cc', 'b')
>> > > >   1   0.026373   0.000298 let tags = system('ctags
>> --c++-kinds=+p
>> > > > --fields=+iaS --extra=+q -f - .tmp.cc')
>> > > >   1  0.91 let stags = split(tags,
>> '\n')
>> > > >   1   0.130731   0.031220 let alltags =
>> system('grep -v " '.expand('%').' "
>> > > > tags')
>> > > >   1  0.128909 let tagstable =
>> split(alltags, '\n')
>> > > >   1  0.43 call extend(tagstable,
>> stags)
>> > > >   1  0.240341 call writefile(tagstable,
>> 'tags', 'b')
>> > > >   1  0.33 return ';'
>> > > >
>> > > > FUNCTIONS SORTED ON TOTAL TIME
>> > > > count  total (s)   self (s)  function
>> > > >   1   0.527128   0.401542  UpdateTags()
>> > > >
>> > >