Many people complain about reading in LinuxSource codeIt's inconvenient. I'm still used to Windows.CodeIn LinuxProgramAnd compile it in windows first, and then compile it in Linux.
Many people are used to win ide or other text editors such as UE or other text comparison tools. These tools are good, but in fact they all need to be released, rather than free. I am a mean person and don't want to waste money. In addition, I am ashamed of unlimited piracy and cracking, so I chose free lunch, And the face operating system uses free Linux. In actual use of Linux, it still needs to spend money, but it is worth it. Of course, where is the money spent? I actually bought books. Come on, let's get back to the question and talk about how to use the source code in Linux.
There are many ways to read the source code in Linux. Smart people should be able to read the source code from the title and need (g) Vim taglist ctags. It's really a perfect combination of three!
Vim/gvim
What is Vim/gvim? If you don't even know VI, don't look down. Some people familiar with Linux say that VI is not the same tool as the note pad in windows? In fact, it is a big mistake. If it is just the same function as note pad, it would have been called VI.
Taglist
Taglist is a Vim source code browser plug-in. For more information about the functions, see Google. Many things still need to be experienced before they can be used.
You need to install this plug-in, plug-in: taglist
Http://www.vim.org/scripts/script.php? Script_id = 1, 273
There are many versions, you can download the current Latest Version: http://www.vim.org/scripts/download_script.php? Src_id = 1, 7701
After the download, decompress the package first. How can I decompress the package? Find a solution.
Create a hidden folder. Vim in the user's home directory, and copy the plug-in the directory extracted from the taglist to the. Vim directory. Of course, it's okay to copy it together with other directories.
Ctags
Ctags is a software used to produce tags files ., Or search the Internet, or said it: http://ctags.sourceforge.net.
Download, decompress, compile, and install the SDK. How to decompress, compile, and install it? Of course, it is more complicated than setup.exe in wincontext, but there are different rules in different worlds, there is no way, huh, huh.
If you use the new version for installation in Ubuntu, it is not worth introducing.
Read Source Code
First, enter the directory of the source code to be viewed, and generate a tags file.
$ Ctags-R
Then use Vim to open a c file. If you want to know where a function or struct is, just move the cursor to the function and press Ctrl +]. After reading it, you can run CTRL o back to the original place.
View the function list. You also need to start the taglist and enter tlisttoggle in the command status of VIM. The function list is displayed on the left of the vim interface. You can switch to the function list area and move it to the function name line. Then, press enter to view the function code.
Gvim
You can add the above two tools to gvim if you are not familiar with vim command operations or are not familiar with keyboard operations. You only need to use gvim to open the c file, enable the function list, and double-click the function name to jump to the function. Press ctrl and press the left and right keys to track or roll back, which is more convenient and better than many tools in win.