Linux configuration vim ctags g++ IDE GDB

Source: Internet
Author: User
Tags function definition parent directory


First Lecture: Vim's configuration

After the installation of CentOS, it is installed by default VI editor, VIM is not installed, so we use Vim test.txt when prompted: Vim command not found ... This is to say that our Linux environment does not have the VIM editor installed, let's say how to install this editor:


The Vim editor requires the installation of three packages:


Vim-enhanced-7.0.109-7.el5


Vim-minimal-7.0.109-7.el5


Vim-common-7.0.109-7.el5


1. Check if your vim is already installed by checking the package that already exists on your machine:

Input rpm-qa|grep Vim This command, how VIM has been installed correctly, will display the name of the above three packages

2. If one is missing, say: vim-enhanced This package is less, execute: yum-y install vim-enhanced command, it will automatically download the installation.

3. If none of the above three packages are displayed, enter the command directly:

Yum-y Install vim*

There are two forms of setting up the vim editing environment:


One is set up in/ETC/VIMRC, this setup method will function with all users logged into the Linux environment, generally we do not advocate this way, because Linux is multi-user, everyone has their own programming habits and environment, so we advocate the following one of the settings.


Another: is to create a. vimrc file in the ~ directory where the user is logged in, setting up a custom programming environment where other users do not interact with each other.


Specific methods:

Initial use 1:


CD ~


Touch. VIMRC


Vim. VIMRC


Add 2:

Direct cd~

Vim ~/.VIMRC

In the file, enter:


Set Nu//This is the setting display line number


Set Showmode//settings display the current mode at the bottom of the command line interface.


Set ruler//in the lower-right corner displays information such as the number of lines where the cursor is located


Set autoindent//settings each time you click the ENTER key, the cursor is aligned with the starting character of the previous line when you move to the next line


Syntax on//sets syntax detection, when editing C or shell scripts, keywords are displayed in special colors


.........


[ESC]

: Wq

Installation of the second speaking and g++


Typically, installing software under CentOS uses Yum, so:

Input: Yum install gcc-c++; then it will download the relevant package for installation;



2. After installation, you can use g++ to compile. C or. cpp files, such as:

2.1 Input: g++ hello.c or g++ Hello.cpp, after execution there will be a default a.out file,

Then enter:./a.out can be run;

2.2 Input: g++-o Hello hello.c (specifies that the output file is named Hello instead of the default a.out)

Then enter:./hello or Hello to run.



Note: The default output is the A.out file, and the next time g++ compiles a. C or. cpp file, the A.out file is also generated by default, at which point

Will overwrite the original a.out file.

3. GDB Configuration

1.

Select the appropriate installation package, where I download the gdb-1.10.tar.gz

2.

Unpack the package, enter the command: Tar xzvf gdb-7.10.tar.gz

3.

Enter the extracted directory gdb-7.10

4.

Enter the command:


./configure

5.

Input command: Make


Compiling GDB

6.

Input command: Make install


Installing GDB

7.

Input command: gdb-v


View GDB version information to confirm that GDB was installed successfully

4. Configuration of the IDE

First go to CD./VIMRC

1. Syntax highlighting

Syntax enable

Syntax on


2, in the program to find the function definition (jump in the program to jump: the use of Ctags)

Tags file is an index file produced by the Ctags program, the Ctags program is called "Exuberant Ctags", is a UNIX alternative to the Ctags program, and more powerful than it is the default Ctags program on most Linux distributions. So what is a tags file for? What if you read a function call, or a variable, or a macro, and so on while reading the program, and you want to know where they are defined? With grep? That will search out a lot of irrelevant places. Now popular with Yes <c-]> who knows? When the cursor is over a function or variable, press CTRL +] and the cursor automatically jumps to its definition


Third, installation Ctags

(1), download the Tar compress package

(2), Unzip tar xzvf ctags-7.10.tar.gz

(3), compile and install

$ CD ctags-5.6

$ make

# make install//require root permission




IV: Installation and Configuration TagList


(1), download the Decompression TagList installation package

(2), then configure, do not need to compile the installation

$CD taglist/

$CP doc/taglist.txt/usr/share/vim/vim72/doc/

$CP plugin/taglist.vim/usr/share/vim/vim72/plugin/

(3), how to use


Basically configuration complete


Start vim with ": Helptags." To configure the Help file

Restart Vim and use ": Tlisttoggle" to open and close the TagList window.

You can use ": Help TagList" For more information


To open TAGLIST,_VIMRC by default, add

Let Tlist_auto_open=1

Set tags=tags;

Set Autochdir;

Note that the semicolon in the first command is essential. This command let vim first in the current directory to look for tags files, if not find the tags file, or do not find the corresponding target, go to the parent directory to find, always upward recursion. Because the path that is recorded in the tags file is always relative to the path where the tags file is located, use the second setting to change the current directory of Vim.



V: File Browser and window Manager-plugin: Winmanager


. Installing Winmanager.zip

Address: http://www.vim.org/scripts/download_script.php?src_id=754


Unzip the copy, as with the TagList steps


$CP doc/winmanager.txt/usr/share/vim/vim72/doc/

$CP plugin/winmanager.vim/usr/share/vim/vim72/plugin/


Now add the following two sentences to your ~/.VIMRC

Let g:winmanagerwindowlayout= ' fileexplorer| TagList '

Nmap wm:wmtoggle<cr>


When editing a. C or. cpp file: WM, a configured interface will appear.


650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/82/5C/wKioL1dSgvzQUsjLAADc5on7u1k956.png-wh_500x0-wm_3 -wmp_4-s_4187331500.png "title=" configured interface. png "alt=" wkiol1dsgvzqusjlaadc5on7u1k956.png-wh_50 "/>

This article is from the "Qin-wang" blog, make sure to keep this source http://10810196.blog.51cto.com/10800196/1786087

Linux configuration vim ctags g++ IDE GDB

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.