Install and use taglist in VIM

Source: Internet
Author: User
Tags prototype definition

Successfully transformed Vim into a powerful ide Series II

"Plugin Introduction 』

Taglist is a Vim plug-in that provides a structured view of source code symbols.

(Directly using others' images. On my machine ~)

"Download and install 』

1) from http://www.vim.org/scripts/script.php? You can download the installation package from http://vim-taglist.sourceforge.net/index.html.

2) Enter ~ /. Vim directory. decompress the taglist installation package ~ The/. Vim directory generates several new subdirectories, such as plugin and DOC (other directories such as autoload may be created when other plug-ins are installed ).

3) Enter ~ /. Vim/doc directory. Run the "helptags." command in vim. This step adds the help document under Doc to the help topic of VIM, so that we can run "Help taglist.txt" in VIM to view the help of taglist.

4) Open the configuration file ~ /. Add the following lines to vimrc:

Let tlist_show_one_file = 1 "the tag of multiple files is not displayed at the same time, only the current file's let tlist_exit_onlywindow = 1" if the taglist window is the last window, exit Vim let tlist_ctags_cmd = "/usr/bin/ctags" "and associate the taglist with ctags.

By now, the installation is complete.

"Basic Function usage 』

Run ": tlist" on the vim command line to open the taglist window. Run ": tlist" again to close the window.

CTRL + WW switching between left and right windows

In taglistWindow, You can use the following shortcut keys:

<CR> jump to the position defined by the tag under the cursor. Double-click the tag with the mouse.
O display the tag under the cursor in a new window
<Space> display the prototype definition of the tag under the cursor
U update the tag in the taglist window
S. Change the sorting method and switch between name-based and order-based.
The X taglist window is zoomed in and out to facilitate viewing long tags.
+ Open a fold, same as Zo
-Fold the tag, same as ZC
* Open all folds, same as Zr
= Fold all tags, same as ZM
[[Jump to the previous file
] Jump to the next file
Q: Close the taglist window.
<F1> Show Help

But! Most of these can be replaced by the mouse !! The shortcut key is cloud ~~

Tip:

If the mouse clicks in VIM is invalid, go ~ /. Add this sentence to vimrc:

set mouse=a  " always use mouse

"Common configuration options 』

-The tlist_ctags_cmd option is used to specify the location of your exuberant ctags program. If it is not in the path defined by your path variable, you need to use this option to set it;

-
If you do not want to display tags in multiple files at the same time, set tlist_show_one_file to 1. By default, tags in multiple files are displayed;

-
Set tlist_sort_type to "name" to sort the taglist by Tag name. By default, the taglist is sorted by the order in which the tag appears in the file. Sort by the range (namespace or class) where the tag appears, and the todo that has been added to the taglist
List, but not yet supported;

-
If you exit Vim when you want to use the taglist window as the last window, set tlist_exit_onlywindow to 1;

-
If you want to display the taglist window on the right, set tlist_use_right_window to 1. It is displayed on the left by default.

-
In gvim, if you want to display the taglist menu, set tlist_show_menu to 1. You can use tlist_max_submenu_items and tlist_max_tag_length to control the number of menu entries and the length of the displayed tag name;

-
By default, When you double-click a tag, it will jump to the defined position of the tag. If you want to click the tag, set tlist_use_singleclick to 1;

-
If you want to open the taglist window automatically after Vim is started, set tlist_auto_open to 1;

-
If you want to automatically close the taglist window after tag selection, set tlist_close_on_select to 1;

-
When the tag of multiple files is displayed at the same time, set tlist_file_fold_auto_close to 1, so that the taglist displays only the tag of the current file, and the tags of other files are collapsed.

-
When you use: tlisttoggle to open the taglist window, if you want the input focus to be In the taglist window, set tlist_gainfocus_on_toggleopen to 1;

-
If you want the taglist to always parse the tag in the file, set tlist_process_file_always to 1 regardless of whether the taglist window is opened;

-Tlist_winheight and tlist_winwidth can be used to set the height and width of the taglist window. Tlist_use_horiz_window: 1. Set the horizontal display of the taglist window;


Usage: In ~ /. In the vimrc file, add the options to be set in a format similar to the one mentioned above.

For example, if you click a tag to jump to the location defined by the tag, add the following sentence to the file:

let Tlist_Use_SingleClick=1

"Read instructions 』

1) Vim has multiple configuration files vimrc, such as/etc/vimrc. This file affects Vim of the entire system. And ~ /. Vimrc. This file only affects the user's vim. And ~ The configuration in the/. vimrc file overwrites the configuration in/etc/vimrc. Here we only modify ~ /. Vimrc file.

2) The Vim plug-in is installed in the runtimepath directory of VIM. You can run the "set RTP" command on the vim command line to view the plug-in. Here we choose to install in ~ /. Vim directory. If no directory exists, create one.

3) when this article says "run the cmdxx command under the vim command line", it means to run the cmdxx command in the command line mode of vim, in the normal mode of VIM, enter the colon ":" to enter the command line mode, and then enter the command running xx. The colon ":" is omitted in the subsequent description.

4) if "run a command under Vim command line" is not specified, the command is executed in shell.

5) If the command is left blank or contains characters that are easily confused with the body, I will use double quotation marks to distinguish the command from the body. Therefore, do not enter quotation marks at the beginning and end of the command during actual operations.

6) This article describes the combination of shortcut keys, in the form of a-B shortcut keys, that means to press the key and B key at the same time, and in the form of "A-B C" shortcut keys, it means to press the key and B key at the same time, then open the AB key, and then press the C key.

7) the system I use is ubunt 11.10, And the vim version is VI improved 7.3.

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.