Configuration of the My Vim IDE editor

Source: Internet
Author: User
Tags egrep

<blockquote>
The Set Mapleader
Let Mapleader = ","
"Fast reloading of the. VIMRC
Map &lt;silent&gt; &lt;leader&gt;ss:source ~/.vimrc&lt;cr&gt;
"Fast editing of. VIMRC
Map &lt;silent&gt; &lt;leader&gt;ee:e ~/.vimrc&lt;cr&gt;
"When. VIMRC is edited, reload it
autocmd! Bufwritepost. VIMRC Source ~/.VIMRC
</blockquote>
Application of <blockquote>ctags-r SRC

CTRL]

Ctrl-t</blockquote>
Now we go to <a class= "link" href= "http://www.vim.org/scripts/script.php?script_id=273" target= "_top" >http:// www.vim.org/scripts/script.php?script_id=273</a> Download the latest version of TagList plugin, the current version is 4.6.

After downloading, unzip the file in the ~/.vim/directory, which will put a file in your ~/.vim/plugin and ~/.vim/doc directories:

TagList provides quite a few features in my vimrc such as:
<blockquote> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " Show_one_file = 1
"" If the TagList window is the last window, exit vim
Let Tlist_exit_onlywindow = 1
"Show taglist window in the right window
let Tlist _use_right_window = 1</blockquote>
After this configuration, when you enter "<span class=" command "><strong>:tlistopen</ strong></span>, the definition list of functions or variables is displayed to the right.

can use ": <span class=" Command ><strong>TlistOpen</strong></span> "open taglist window, with" <span class= "command" ><strong>:TlistClose</strong></span> "close taglist window." Alternatively, use "<span class=" command ><strong>:TlistToggle</strong></span> to toggle between on and off. The following mappings are defined in my VIMRC, using the &lt; F9&gt; key to open/close taglist window:
<blockquote>
Map &lt;silent&gt; &lt; F9&gt; :tlisttoggle&lt;cr&gt;
</blockquote>
Winmanager plugin download here: <a class= "link" href= "http://vim.sourceforge.net/scripts/script.php script_id=95 "target=" _blank ">HTTP://VIM.SOURCEFORGE.NET/SCRIPTS/SCRIPT.PHP?SCRIPT_ID=95</A>

After the

is downloaded, unzip the file in the ~/.vim/directory, which extracts the Winmanager plugin into the ~/.vim/plugin and ~/.vim/doc directories:
<blockquote>
plugin/ Winmanager.vim–winmanager plug-in
Plugin/winfileexplorer.vim-improved Explorer plugin
plugin/wintagexplorer.vim– The tag plugin provided by Winmanager is not useful for
doc/winmanager.txt– Help files
</blockquote>
still uses "<span class=" Command > <strong>:helptags ~/.vim/doc</strong></span> "command to generate the help tag, then you can use" <span class= "Commands" > <strong>:help winmanager</strong></span> "To see the help.

The

uses the Winmanager plugin to control the layout display of each plug-in in the Vim window. In my VIMRC, this setting:
<blockquote> "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" " "" "" "" "" ""
Let G:winmanagerwindowlayout = "bufexplorer,fileexplorer| TagList "
Let G:winmanagerwidth = $
Let G:defaultexplorer = 0
Nmap &lt; c-w&gt;&lt; C-f&gt; :firstexplorerwindow&lt;cr&gt;
Nmap &lt; c-w&gt;&lt; C-b&gt; :bottomexplorerwindow&lt;cr&gt;
Nmap &lt;silent&gt; &lt;leader&gt;wm:wmtoggle&lt;cr&gt;</blockquote>
< The value of span class= "emphasis" ><em>g:winManagerWindowLayout</em></span> variable defines the window layout of the Winmanager, Using the settings above, our window layout looks like this:

There are two windows on the left, the Bufexplorer window above, and the TagList window below. FileExplorer window and Bufexplorer share a window, use "<span class=" command in Bufexplorer window ><strong>ctrl-n</strong ></span> "can switch to the FileExplorer window and use it again to switch back to the Bufexplorer window. That is, in the variable g:winmanagerwindowlayout, use the "," delimited plug-in, displayed in the same window, using "<span class=" command "><strong>ctrl-n</ strong></span> "Switch between different plugins; use |" Separated plug-ins, they are displayed in a different window.

The window to the right of the screen is the main editing area.

In the VIMRC settings above, three key mappings are also defined for jumping to the upper-left window, the lower-left window, and the Show/close Winmanager window.

&nbsp;
The Lookupfile plugin can be downloaded at the following link: <a class= "link" href= "http://www.vim.org/scripts/script.php?script_id=1581" target= "_ Blank ">http://www.vim.org/scripts/script.php?script_id=1581</a>

After downloading the plugin, unzip it into your ~/.vim directory and complete the installation. Then execute "<span class=" command "><strong>:helptags ~/.vim/doc</strong></span>" commands in Vim, Generate the Help file index, and then you can use the "<span class=" command "><strong>:help lookupfile</strong></span>" command to view the help file for the Lookupfile plugin.

<span class= "Bold" ><strong> Note: </strong></span>windows users need to unzip this plugin in your $vim/vimfiles or $home/ Vimfiles directory.

The Lookupfile plugin also requires the latest genutils support, so you need to download Genutils:<a class= "link" href= "http://www.vim.org/scripts/script.php?" script_id=197 "target=" _blank ">http://www.vim.org/scripts/script.php?script_id=197</a>

This plugin provides some common functions that can be used by other scripts. Its installation method is also in the ~/.vim directory decompression can be. It is important to note that the latest version of Genutils uses a new automatic loading method, so it is incompatible with the previous version. If your other plug-ins need to use an older version of Genutils, you'll need to configure it with reference to the genutils instructions so that the old and new two versions work together.

Now we introduce the Lookupfile plugin. Although the name is Lookupfile, in fact this plugin can not only be used to find files, but also in the open buffer to find, search by directory, and so on.

&nbsp;

<span class= "bold" ><strong>[project file Find]</strong></span>

Lookupfile you need to use the tag file when looking for a file. It can use the tag file generated by the <span class= "command" ><strong>ctags</strong></span> commands, but the lookup efficiency will be relatively low. Therefore, we will generate a tag file specifically for it that contains all the file names in the project.

I have written the following shell script, for VIM70 source code, generate a file name tag file.
<pre lang= "bash" escaped= "true" >
#!/bin/sh
# Generate tag file for Lookupfile plugin
Echo-e "!_tag_file_sorted\t2\t/2=foldcase/" &gt; Filenametags
Find. -not-regex '. *\.\ (png\|gif\) '-type f-printf '%f\t%p\t1\n ' | \
Sort-f &gt;&gt; Filenametags
</pre>
Running the script in the ~/src/vim70/directory generates a file named Filenametags that contains the names of all the files in the Vim70 directory and the directories in which they are located.

Now we need to let the Lookupfile plugin know where to find the filename tag file. We assume that the current working directory of Vim is ~/src/vim70/and execute the following command:
<blockquote>
: Let g:lookupfile_tagexpr = ' "./filenametags" '
</blockquote>
<span class= "Blod" > Note:</span> if you do not set <span class= "emphasis" ><em>g:lookupfile_tagexpr</em The value of ></span>, then the Lookupfile plugin will use the tags option to define the file as its tag file.

Now we can use Lookupfile to open the file, press "<span class=" command "><strong>&lt; F5&gt;</strong></span> "or input" <span class= "command" ><strong>:LookupFile</strong> </span> "Open a lookupfile small window above the current window and start typing in the file name (at least 4 characters), and with your input, the qualifying file is listed in the drop-down list. The filename can use Vim's regular expression, which greatly facilitates the file lookup. You can use "<span class=" command "><strong>CTRL-N</strong></span>" and "<span class=" command "> <strong>CTRL-P</strong></span> (or use the UP and down cursor keys) to select the file you want in the drop-down list. When you select a file, press ENTER to open the file in a previous window.

The Lookupfile plugin provides some configuration options to make it more consistent with your work habits by adjusting these configuration options. Here are the settings for lookupfile in my VIMRC for reference:
<pre lang= "PHP" escaped= "true" >
""""""""""""""""""""""""""""""
"Winmanager setting
" """"""""""""""""""""""""""""""
Let g:winmanagerwindowlayout = "bufexplorer,fileexplorer| TagList "
Let G:winmanagerwidth = 30
Let G:defaultexplorer = 0
Nmap &lt; c-w&gt;&lt; C-f&gt; :firstexplorerwindow&lt;cr&gt;
Nmap &lt; c-w&gt;&lt; C-b&gt; :bottomexplorerwindow&lt;cr&gt;
Nmap &lt;silent&gt; &lt;leader&gt;wm:WMToggle&lt;cr&gt;

""""""""""""""""""""""""""""""
"Lookupfile setting
" """"""""""""""""""""""""""""""
Let G:lookupfile_minpatlength = 1 "Enter a minimum of 1 characters to start the lookup
Let G:lookupfile_preservelastpattern = 0 "Do not save the last found string
Let G:lookupfile_preservepatternhistory = 1 "Save Find History
Let G:lookupfile_alwaysacceptfirst = 1 "Enter to open the first matching item
Let G:lookupfile_allownewfiles = 0 "does not allow the creation of files that do not exist
If Filereadable ("./filenametags") "Sets the name of the tag file
Let g:lookupfile_tagexpr = ' "./filenametags" '
endif
"Map lookupfile for, LK
Nmap &lt;silent&gt; &lt;leader&gt;lk:LUTags&lt;cr&gt;
"Map Lubufs for, LL
Nmap &lt;silent&gt; &lt;leader&gt;ll:LUBufs&lt;cr&gt;
"Map Luwalk for, LW
Nmap &lt;silent&gt; &lt;leader&gt;lw:LUWalk&lt;cr&gt;


The lookup file with the Ignore case
function! Lookupfile_ignorecasefunc (pattern)
Let _tags = &amp;tags
Try
Let &amp;tags = eval (g:lookupfile_tagexpr)
Let Newpattern = ' \c '. A:pattern
Let tags = taglist (newpattern)
Catch
Echohl ErrorMsg |  echo "Exception:" ". v:exception | Echohl NONE
Return ""
Finally
Let &amp;tags = _tags
Endtry

"Show the matches for what's typed so far.
Let files = map (tags, ' v:val["filename"] ')
return files
Endfunction
Let G:lookupfile_lookupfunc = ' Lookupfile_ignorecasefunc ' </pre>
Opening the file type detection feature is simple, add the following sentence to your VIMRC:
<blockquote>
FileType plugin indent on
</blockquote>
http://www.vim.org/scripts/script.php?script_id=625 Download Color Theme
<blockquote>cscope-rbq
<div class= "Itemizedlist" >
<ul type= "disc" >
<li><span class= "Bold" &GT;&LT;STRONG&GT;-R&LT;/STRONG&GT;&LT;/SPAN&GT;: When you build an index file, search for code in the subtree </li>
<li><span class= "Bold" &GT;&LT;STRONG&GT;-B&LT;/STRONG&GT;&LT;/SPAN&GT;: Generate only index files, not into Cscope interface </li>
<li><span class= "Bold" &GT;&LT;STRONG&GT;-Q&LT;/STRONG&GT;&LT;/SPAN&GT;: Generate Cscope.in.out and cscope.po.out files to speed up cscope indexing speed </li>
<li><span class= "Bold" &GT;&LT;STRONG&GT;-K&LT;/STRONG&GT;&LT;/SPAN&GT;: the/usr/include directory is not searched when the index file is generated </ Li>
<li><span class= "Bold" &GT;&LT;STRONG&GT;-I&LT;/STRONG&GT;&LT;/SPAN&GT;: If the file name of the saved files list is not cscope.files, you need to add this option to tell Cscope where to find the source file list. You can use the "<span class=" bold "><strong>–</strong></span>" to indicate that a list of files is obtained by standard input. </li>
<li><span class= "Bold" ><strong>-i</strong></span><span class= "emphasis" >< Em>dir</em></span&gt: In <span class= "bold" ><strong>-I</strong></span> Find header file in the directory indicated by the option </li>
<li><span class= "Bold" &GT;&LT;STRONG&GT;-U&LT;/STRONG&GT;&LT;/SPAN&GT;: Scan all files, regenerate cross-index files </li>
<li><span class= "Bold" &GT;&LT;STRONG&GT;-C&LT;/STRONG&GT;&LT;/SPAN&GT;: Ignore case when searching </li>
<li><span class= "Bold" ><strong>-p</strong></span><span class= "emphasis" >< Em>path</em></span&gt: Add a path to a file represented by a relative path, so you can use it without switching to the directory where your database file is located. </li>
</ul>
</div></blockquote>
Cscope Query function:
<blockquote>
<div class= "Itemizedlist" >
<ul type= "disc" >
<li><span class= "Bold" ><strong>s:</strong></span> find the C-language symbol, that is, find the function name, macro, enumeration value, etc. where it appears </ Li>
<li><span class= "Bold" ><strong>g:</strong></span> find the location defined by functions, macros, enumerations, and so on, similar to the functionality provided by Ctags </li>
<li><span class= "Bold" ><strong>d:</strong></span> find functions called by this function </li>
<li><span class= "Bold" ><strong>c:</strong></span> find functions that call this function </li>
<li><span class= "Bold" ><strong>t:</strong></span> find the specified string </li>
<li><span class= "Bold" ><strong>e:</strong></span> find Egrep mode, equivalent to Egrep function, but looks much faster </li>
<li><span class= "Bold" ><strong>f:</strong></span> find and open files, like Vim's find function </li>
<li><span class= "Bold" ><strong>i:</strong></span> find files that contain this file </li>
</ul>
</div></blockquote>
&nbsp;

Configuration of the My Vim IDE editor

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.