Source Insight is an editor with powerful features, but for Windows systems, which editor should Ubuntu use? Vim is a very good editor under Linux. The following small series will introduce you how to install the vim plugin on Ubuntu.
source insight is an excellent editor for windows, suitable for reading management code, mainly in the following functions:
Find function, variable, or macro definition.
Find the reference location of a function, variable, or macro.
Finding where the function is called
Finding all the matches of a symbol within a project
Since the unix philosophy advocates that a tool only does one thing, so under linux There is no such software that integrates multiple functions. Vim is a very good editor, this article describes how to install vim into the same or more powerful tools as source insight by installing plugins.
My environment is ubuntu12.04 LTS+vim version 7.3
1. ctags
The ctags plugin is used to find functions, variables or macro definitions, which can be very much under ubuntu. Easy installation,
sudo apt-get install exuberant-ctag
Execute the command in the source file directory
ctags -R
will generate a tag A file containing symbol information for all source files. In vim, the shortcut key ctrl+] will jump to the definition of the current function. In order to facilitate the production of tags, set the shortcut key F5 to generate the tag, add the following command to ~/.vimrc
nnoremap "F5" :! Ctags -R --c++-kinds=+p --fields=+iaS --extra=+q . CR
nnoremap represents the key mapping of vim normal mode,
--c++-kinds=+p : Add function prototype information to tags
-- Fields=+iaS : Add inheritance information, access control information, function signatures (such as parameter tables or prototypes) to tags.
--extra=+q : as class members Adding a class identifier to a tag
If the project has a multi-layered file structure, generally only a tag file is generated in the root directory, then the subdirectory cannot access the tag file, and opening the source file directly in the subdirectory will not find the function. A convenient way to add tags to the tags' search path in .vimrc is one for each item.
<;project1”
set tags+=/project1/tags
Shortcuts for ctags:
ctrl+] Switch to definitions
g+ctrl+] If there are multiple matches, list the matching tag list for selection
count+ctrl+t Back count tags
:count+tag advance count tags
:ts Lists matching tag lists. When there are multiple matches
:tn Skip to the next match tag
:tp Skip to the previous match tag
:tf jump to the ground a matching tag
:tl jump to the last matching tag
:set tags? View the tag file path
2.cscope
Ctags can only find the place where the symbol is defined. If you want to find similar function call lookup, symbol reference lookup and other advanced functions like sourceinsight, With the help of cscope. Cscope is a tool similar to ctags, but it's much more powerful than ctags.
Execute in the current source directory
cscope–Rbq
where
-R: recursively handle sub-layer directories
- b: automatically exit after generating the database
-q: generate cscope.in.out and cscope.po.out files, speed up the index of cscope
vim open cscope database after opening the source file To the current environment
:csadd cscope.out
Previous123Next page Total 3 pages
In Linux, using the rz/sz tool to transfer files between Linux and Windows, how do
Linux whereis command and find command are a bit similar, whereis command finds faster, but can only
After installing Ubuntu system in the notebook, there are problems such as fast power consumption, w
Linux is a free-spreading operating system, Linux system processes can operate on any file, database
Linux network management command list
Ubuntu using the command to delete the PPA repository
Linux geeks need to master the collection of skills
Linux how to use awk for array sorting
How to use the df command to view Linux disk space?
Linux system settings ssh connection interrupt time skills
CentOS download steps to install EPEL source
Linux installation of the appropriate kernel header file method
How to install zoneminder software in Linux
What should I do if the Linux system formats the partition and prompts Could not start /dev?
Win8.1 maximum permission setting method
Four strokes to solve Windows 7 video sawtooth
Windows 8.1 API will support POS devices
Win10 system upgrade program C disk space is insufficient how to do
What should I do if the Win10 system weather application cannot be replaced?
How to close the software running in the Windows8 switcher?
Let you operate Windows between the fingers [Photos]
Win2003 system hard disk how to maintain a stable use of experience sharing