?? vi and vim editor advanced features.mht
字號:
function=20
declaration in a header file and a function definition (the =
function=20
itself), the operator can choose by issuing this command. =
The user=20
will be presented with all the references to the function =
and the=20
user will be prompted to enter the number associated with =
the=20
appropriate one.</TD></TR>
<TR>
<TD vAlign=3Dtop><B><TT>:tnext</TT></B></TD>
<TD>When multiple answers are available you can go to the next =
answer. </TD></TR>
<TR>
<TD vAlign=3Dtop><TT>:set ignorecase</TT> <BR>(or <TT>:set =
ic</TT>)</TD>
<TD>The ignore case directive affects tagging.</TD></TR>
<TR>
<TD vAlign=3Dtop><TT>:tags</TT></TD>
<TD>Show tag stack (history)</TD></TR>
<TR>
<TD vAlign=3Dtop><TT>:4pop</TT></TD>
<TD>Jump to a particular position in the tag stack (history).=20
<BR>(jump to the 4th from bottom of tag stack (history). The =
command=20
"<TT>:pop</TT>" will move by default "1" backwards in the =
stack=20
(history).) <BR>or <BR><TT>:4tag</TT> <BR>(jump to the 4th =
from top=20
of tag stack)</TD></TR>
<TR>
<TD><TT>:tnext</TT></TD>
<TD>Jump to next matching tag. <BR>(Also short form =
<TT>:tn</TT> and=20
jump two <TT>:2tnext</TT>)=20
<TR>
<TD vAlign=3Dtop><TT>:tprevious</TT></TD>
<TD>Jump to previous matching tag. <BR>(Also short form =
<TT>:tp</TT>=20
and jump two <TT>:2tp</TT>)</TD></TR>
<TR>
<TD vAlign=3Dtop><TT>:tfirst</TT></TD>
<TD>Jump to first matching tag. <BR>(Also short form =
<TT>:tf</TT>,=20
<TT>:trewind</TT>, <TT>:tr</TT>) </TD></TR>
<TR>
<TD vAlign=3Dtop><TT>:tlast</TT></TD>
<TD>Jump to last matching tag. <BR>(Also short form=20
<TT>:tl</TT>)</TD></TR>
<TR>
<TD vAlign=3Dtop><PRE>:set =
tags=3D./tags,./<I>subdir</I>/tags</PRE></TD>
<TD>Using multiple tag files (one in each directory). =
<BR>Allows one=20
to specify all tags files in directory tree: <TT>set=20
tags=3Dsrc/**/tags</TT> <BR>Use Makefile to generate tags =
files as=20
well as compile in each directory.</TD></TR></TBODY></TABLE>
<P>Links:=20
<UL>
<LI><A =
href=3D"http://vimdoc.sourceforge.net/htmldoc/usr_29.html">Vim docs=20
- ctags</A>=20
<LI><A =
href=3D"http://vimdoc.sourceforge.net/htmldoc/tagsrch.html">vim/tag=20
search</A>=20
<LI><A=20
=
href=3D"http://kearneylug.org/sections.php?op=3Dviewarticle&artid=3D1=
7">Intro=20
Vim/ctags</A>=20
<LI><A =
href=3D"http://www.softpanorama.org/Editors/ctags.shtml">ctags=20
framework</A> </LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>The ctags =
utility:</BIG></B></TD></TR></TBODY></TABLE>
<P>There are more than one version of ctags out there. The =
original Unix=20
version, the GNU version and the version that comes with vim. This =
discussion is about the one that comes with vim. (default with Red =
Hat)=20
<P>For use with C++:=20
<UL>
<LI>ctags version 5.5.4: <PRE> ctags *.cpp ../inc/*.h
</PRE>
<LI>ctags version 5.0.1: <PRE> <A =
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dctags">c=
tags</A> --lang=3Dc++ --c-types=3D+Ccdefgmnpstuvx *.cpp ../inc/*.h
</PRE></LI></UL>
<P>To generate a tags file for all files in all subdirectories: =
<TT>ctags=20
-R .</TT> <A name=3DEXRC></A>
<P>The ctags program which is written by the VIM team is called "=20
Exuberant Ctags" and supports the most features in VIM.=20
<P>Man page: <A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dctags">c=
tags</A>=20
- Generate tag files for source code=20
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Defaults file:</BIG></B></TD></TR></TBODY></TABLE>
<P><B>VIM: <TT>$HOME/.exrc</TT></B>=20
<UL>
<LI><TT>~/.vimrc</TT>=20
<LI><TT>~/.gvimrc</TT>=20
<LI><TT>~/.vim/</TT> (directory of vim config files.) </LI></UL>
<P><B>VI: <TT>$HOME/.exrc</TT></B>=20
<DL>
<DD>Example:=20
<TABLE cellSpacing=3D1 cellPadding=3D4 width=3D"100%" =
bgColor=3D#000000=20
border=3D1>
<TBODY>
<TR bgColor=3D#c0c0c0>
<TD><PRE> set autoindent
set wrapmargin=3D0
map g hjlhjlhjlhlhjl
"
" S =3D save current vi buffer contents and run spell on it,
" putting list of misspelled words at the end of the vi =
buffer.
map S G:w!^M:r!spell %^M
colorscheme evening
</PRE></TD></TR></TBODY></TABLE></DD></DL>
<P>Notes:=20
<UL>
<LI>Look in <TT>/usr/share/vim/vim61/colors/</TT> for available=20
colorschemes.=20
<LI>Alternate use of autoindent: <TT>set ai sw=3D3</TT> =
</LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Vim tip:</BIG></B></TD></TR></TBODY></TABLE>
<P>Using a mousewheel with vim in an xterm. Place in file=20
<TT>$HOME/.Xdefaults</TT>=20
<DL>
<DD><PRE>XTerm*VT100.Translations: #override \n\=20
: string("0x9b") string("[64~") \n\=20
: string("0x9b") string("[65~")
</PRE></DD></DL>
<P>
<HR SIZE=3D5>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Links:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<UL>
<LI><A href=3D"http://www.vim.org/">The vim home page</A>=20
<LI><A=20
=
href=3D"http://linux.com/enhance/tuneup/database.phtml/Misc/2220.html">Ge=
tting=20
VIM to Use Your Mouse Wheel</A> - by Marius Aamodt Eriksen=20
<LI><A =
href=3D"http://www.linuxpowered.com/html/tutorials/vi.html">VI=20
Reference card</A>=20
<LI><A =
href=3D"http://www.cs.pdx.edu/~kirkenda/joy84.html">Interview with=20
Bill Joy and the history of VI</A>=20
<LI><A=20
=
href=3D"http://www.networkcomputing.com/unixworld/tutorial/009/009.html">=
Vi/Ex=20
Editor tutorial</A>=20
<LI><A href=3D"http://www.jerrywang.net/vi/">Fast vi =
tutorial</A>=20
<LI><A=20
=
href=3D"http://www.troubleshooters.com/lpm/200212/200212.htm">Troubleshoo=
ters.com:=20
VI and VIM</A> </LI></UL>
<P>
<HR SIZE=3D5>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD vAlign=3Dtop><IMG=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/book40.gif"><B><BIG>Books:=
</BIG></B></TD></TR></TBODY></TABLE>
<P>
<DL>
<DD>
<TABLE width=3D"100%" border=3D1 celpadding=3D"5">
<TBODY>
<TR>
<TD><IMG =
src=3D"http://www.yolinux.com/BOOKS/1503721.gif"></TD>
<TD vAlign=3Dtop>"The Ultimate Guide to VI and EX Text =
Editors"=20
<BR>Hewlet Packard Corporation <BR>ISBN #0-8053-4460-8,=20
Addison-Wesley Pub Co., Benjamin/Cummings Publishing =
Company=20
<P></P></TD>
<TD vAlign=3Dtop><A=20
=
href=3D"http://www.amazon.com/exec/obidos/ASIN/0805344608/yolinux-20"><IM=
G=20
alt=3DAmazon.com=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/Amazon-BuyABook88x31.gif">=
</A>=20
<BR><IMG height=3D1=20
=
src=3D"http://service.bfast.com/bfast/serve?bfmid=3D2181&sourceid=3D3=
9358384&bfpid=3D0805344608&bfmtype=3Dbook"=20
width=3D1 border=3D0 NOSAVE><A=20
=
href=3D"http://service.bfast.com/bfast/click?bfmid=3D2181&sourceid=3D=
39358384&bfpid=3D0805344608&bfmtype=3Dbook"=20
target=3D_top><IMG height=3D60=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/BarnesNobles.gif"=20
width=3D75></A> </TD></TR>
<TR>
<TD><IMG=20
=
src=3D"http://www.yolinux.com/BOOKS/1565924266.01.MZZZZZZZ.jpg"></TD>
<TD vAlign=3Dtop>"Learning the vi Editor (6th edition)" =
<BR>by Linda=20
Lamb, Arnold Robbins <BR>ISBN #1565924266, O'Reilly=20
<P></P></TD>
<TD vAlign=3Dtop><A=20
=
href=3D"http://www.amazon.com/exec/obidos/ASIN/1565924266/yolinux-20"><IM=
G=20
alt=3DAmazon.com=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/Amazon-BuyABook88x31.gif">=
</A>=20
<BR><IMG height=3D1=20
=
src=3D"http://service.bfast.com/bfast/serve?bfmid=3D2181&sourceid=3D3=
9358384&bfpid=3D1565924266&bfmtype=3Dbook"=20
width=3D1 border=3D0 NOSAVE><A=20
=
href=3D"http://service.bfast.com/bfast/click?bfmid=3D2181&sourceid=3D=
39358384&bfpid=3D1565924266&bfmtype=3Dbook"=20
target=3D_top><IMG height=3D60=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/BarnesNobles.gif"=20
width=3D75></A> </TD></TR>
<TR>
<TD><IMG=20
=
src=3D"http://www.yolinux.com/BOOKS/0735710015.01.MZZZZZZZ.jpg"></TD>
<TD vAlign=3Dtop>"Vi iMproved (VIM) <BR>by Steve Oualline =
<BR>ISBN=20
#0735710015, Sams (1st edition)=20
<P></P></TD>
<TD vAlign=3Dtop><A=20
=
href=3D"http://www.amazon.com/exec/obidos/ASIN/0735710015/yolinux-20"><IM=
G=20
alt=3DAmazon.com=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/Amazon-BuyABook88x31.gif">=
</A>=20
<BR><IMG height=3D1=20
=
src=3D"http://service.bfast.com/bfast/serve?bfmid=3D2181&sourceid=3D3=
9358384&bfpid=3D0735710015&bfmtype=3Dbook"=20
width=3D1 border=3D0 NOSAVE><A=20
=
href=3D"http://service.bfast.com/bfast/click?bfmid=3D2181&sourceid=3D=
39358384&bfpid=3D0735710015&bfmtype=3Dbook"=20
target=3D_top><IMG height=3D60=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/BarnesNobles.gif"=20
width=3D75></A> =
</TD></TR></TBODY></TABLE></DD></DL></TD></TR></TBODY></TABLE>
<P><CEMTER><IMG =
src=3D"http://www.yolinux.com/TUTORIALS/images/vipower.gif">=20
</CEMTER>
<P>
<TABLE>
<TBODY>
<TR>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -