Vim Tips Wiki
Register
No edit summary
 
m (Reformat)
Line 9: Line 9:
 
|rating=21/8
 
|rating=21/8
 
|text=
 
|text=
  +
QT GUI Toolkit comes with extensive documentation in html format; searching in help that means constant copy/paste from vim into my Opera web browser. This tip will allow you to press <C-t> in vim on any QT Class or Function and have the relevant help open up in Opera in the background.
   
 
1. build tags for all the QT classes and functions using the perl script given below.
 
QT GUI Toolkit comes with extensive documentation in html format;
 
 
searching in help that means constant copy/paste from vim
 
 
into my Opera web browser.
 
 
 
 
This tip will allow you to press <C-t> in vim on any QT Class or Function
 
 
and have the relevant help open up in Opera in the background.
 
 
 
 
1. build tags for all the QT classes and functions
 
 
using the perl script given below.
 
 
 
   
 
2. Then in ~/_vimrc put these lines:
 
2. Then in ~/_vimrc put these lines:
  +
<pre>
 
 
 
 
set tags^=$QTDIR/tags,$QTDIR/doc/html/tags
 
set tags^=$QTDIR/tags,$QTDIR/doc/html/tags
 
 
au FileType html :silent exe ":!c:/opera/6*/opera.exe ".expand("%:p")
 
au FileType html :silent exe ":!c:/opera/6*/opera.exe ".expand("%:p")
  +
</pre>
   
   
  +
3. Press &lt;Control-T&gt; on QWidget in any source file The file QTDIR/doc/html/qfile.html will open up in Opera web browser in the background.
   
 
Notes: Other web browsers may work too.
3. Press &lt;Control-T&gt; on QWidget in any source file
 
 
The file QTDIR/doc/html/qfile.html will open up in
 
 
Opera web browser in the background.
 
 
 
 
Notes:
 
 
Other web browsers may work too.
 
 
 
 
 
   
  +
<pre>
 
&#35; WHAT: make tags for qt documentation.
 
&#35; WHAT: make tags for qt documentation.
 
 
&#35; HOW: cd $QTDIR/doc/html; perl $0 index &gt; tags
 
&#35; HOW: cd $QTDIR/doc/html; perl $0 index &gt; tags
 
 
&#35; AUTHOR: Mohsin Ahmed http://www.cs.albany.edu/~mosh
 
&#35; AUTHOR: Mohsin Ahmed http://www.cs.albany.edu/~mosh
 
 
my(@mytaglist,%seen);
 
my(@mytaglist,%seen);
 
 
while( &lt;&gt; ){
 
while( &lt;&gt; ){
 
if( m/^"(\S+)"\s+(\S+\.html)(.+)/ ) {
 
 
my($class,$file,$tag)=($1,$2,$3);
if( m/^"(\S+)"\s+(\S+\.html)(.+)/ ){
 
 
push @mytaglist,"$class\t$file\t/$class/\n";
 
my($class,$file,$tag)=($1,$2,$3);
+
if( $class =~ m/(\S+)::(\S+)/ ){
  +
my($class,$func) = ($1,$2);
 
push @mytaglist,"$class\t$file\t/$class/\n";
+
push @mytaglist,"$func\t$file\t/$class::$func/\n";
 
if( ! $seen{$class}++ ){
 
 
push @mytaglist,"$class\t$file\t/$class/\n";
if( $class =~ m/(\S+)::(\S+)/ ){
 
  +
}
 
  +
}
my($class,$func) = ($1,$2);
 
 
push @mytaglist,"$func\t$file\t/$class::$func/\n";
 
 
if( ! $seen{$class}++ ){
 
 
push @mytaglist,"$class\t$file\t/$class/\n";
 
 
 
}
 
}
 
}
 
 
}
 
 
 
}
 
}
 
 
print sort @mytaglist;
 
print sort @mytaglist;
  +
</pre>
 
}}
 
}}
   
 
== Comments ==
 
== Comments ==
That's how I changed it to use firefox and close the HTML itself.
+
That's how I changed it to use firefox and close the HTML itself. Although I don't like it that much as now always when I edit an HTML file it will be closed right away...
  +
<pre>
Although I don't like it that much as now always when I edit an HTML file it will be closed right away...
 
 
 
autocmd FileType html :silent execute '!start C:\Programme\Mozilla Firefox\firefox.exe "%:p" ' | bd
 
autocmd FileType html :silent execute '!start C:\Programme\Mozilla Firefox\firefox.exe "%:p" ' | bd
  +
</pre>
 
 
Is there a way to not use FileType, but modify the :tags behaviour instead???
 
Is there a way to not use FileType, but modify the :tags behaviour instead???
 
 
   
 
matthias.ulrich--AT--bct-technology.com
 
matthias.ulrich--AT--bct-technology.com
Line 110: Line 59:
   
 
This command in _vimrc launches Opera only on qt html files:
 
This command in _vimrc launches Opera only on qt html files:
  +
<pre>
 
 
au BufReadPost *qt*/doc/html/*.html :silent exe ":!c:/opera/6*/opera.exe ".expand("%:p") | bd
 
au BufReadPost *qt*/doc/html/*.html :silent exe ":!c:/opera/6*/opera.exe ".expand("%:p") | bd
  +
</pre>
   
 
Putting $QTDIR above did not work, ideally this command should go into qtdir/doc/html/.vimrc.
 
Putting $QTDIR above didnot work, ideally this command
 
should go into qtdir/doc/html/.vimrc
 
   
 
Thanks for asking the right question and the 'bd' suffix.
 
Thanks for asking the right question and the 'bd' suffix.
   
 
- Mohsin
 
- Mohsin
 
   
 
http://mixedvolume.blogspot.com
 
http://mixedvolume.blogspot.com
 
, May 18, 2005 11:36
 
, May 18, 2005 11:36
 
----
 
----
  +
[[Category:LanguageSpecific]]
<!-- parsed by vimtips.py in 0.443330 seconds-->
 

Revision as of 12:05, 24 September 2007

Previous TipNext Tip

Tip: #926 - QT Help from Vim

Created: May 9, 2005 17:06 Complexity: basic Author: MA Version: 6.0 Karma: 21/8 Imported from: Tip#926

QT GUI Toolkit comes with extensive documentation in html format; searching in help that means constant copy/paste from vim into my Opera web browser. This tip will allow you to press <C-t> in vim on any QT Class or Function and have the relevant help open up in Opera in the background.

1. build tags for all the QT classes and functions using the perl script given below.

2. Then in ~/_vimrc put these lines:

 set tags^=$QTDIR/tags,$QTDIR/doc/html/tags 
 au FileType html :silent exe ":!c:/opera/6*/opera.exe ".expand("%:p") 


3. Press <Control-T> on QWidget in any source file The file QTDIR/doc/html/qfile.html will open up in Opera web browser in the background.

Notes: Other web browsers may work too.

# WHAT: make tags for qt documentation. 
# HOW: cd $QTDIR/doc/html; perl $0 index > tags 
# AUTHOR: Mohsin Ahmed http://www.cs.albany.edu/~mosh
my(@mytaglist,%seen); 
while( <> ){ 
 if( m/^"(\S+)"\s+(\S+\.html)(.+)/ ) {
   my($class,$file,$tag)=($1,$2,$3); 
   push @mytaglist,"$class\t$file\t/$class/\n"; 
   if( $class =~ m/(\S+)::(\S+)/ ){ 
     my($class,$func) = ($1,$2); 
     push @mytaglist,"$func\t$file\t/$class::$func/\n"; 
     if( ! $seen{$class}++ ){ 
       push @mytaglist,"$class\t$file\t/$class/\n"; 
     } 
   } 
 } 
} 
print sort @mytaglist;

Comments

That's how I changed it to use firefox and close the HTML itself. Although I don't like it that much as now always when I edit an HTML file it will be closed right away...

autocmd FileType html :silent execute '!start C:\Programme\Mozilla Firefox\firefox.exe "%:p" ' | bd 

Is there a way to not use FileType, but modify the :tags behaviour instead???

matthias.ulrich--AT--bct-technology.com , May 18, 2005 5:03


Matthias,

This command in _vimrc launches Opera only on qt html files:

au BufReadPost *qt*/doc/html/*.html :silent exe ":!c:/opera/6*/opera.exe ".expand("%:p") | bd 

Putting $QTDIR above did not work, ideally this command should go into qtdir/doc/html/.vimrc.

Thanks for asking the right question and the 'bd' suffix.

- Mohsin

http://mixedvolume.blogspot.com , May 18, 2005 11:36