Steps to transform Vim into the C + + development environment (IDE) __c++

Source: Internet
Author: User
Tags documentation function definition
My Vim IDE Interface:

1, install VIM and vim Basic plug-in
First install VIM and vim Basic plug-in. These can be installed using Apt-get:
Lingd@ubuntu:~/arm$sudo apt-get install vim vim-scripts vim-doc
The vim-scripts is a few of Vim's basic plug-ins, including syntax highlighting support, indentation, and so on.
Vim Chinese help document tar package download address:
http://sourceforge.net/projects/vimcdoc/files/vimcdoc/
After decompression, there is a Doc folder, the contents of which are copied to ~/.vim/doc, or vim installation directory under the Doc directory, at this time vim help information is already in Chinese.
Web version Chinese Help document URL http://vimcdoc.sourceforge.net/doc/help.html
Home on the VIM Help document directory, read more convenient and effective, more targeted.

2, VIM configuration file
Vim's powerful features are essentially two locations: the Vim plug-in and the vim configuration file.
The System Configuration folder for Vim itself is under the/usr/share/vim/and/etc/vim/two folders. Under normal circumstances, we will not change the configuration files under these two folders, but rather in the user folder/home/user (where user is username, my username is lingd) under the establishment of their own configuration files. After entering the user folder (/home/user/), create a new file named. VIMRC with Gedit:
lingd@ubuntu:~/arm$ CD ~
lingd@ubuntu:~$ gedit. VIMRC
Note: The use of gedit is mainly for the convenience of large sections of the text paste.
Then copy the following text into this file and save:

"This line should is removed as it ensures that various options are" properly set to work with the Vim-relat Ed packages available in Debian. Debian.vim "Uncomment the next line to make vim more vi-compatible" NOTE:debian.vim sets ' nocompatible '. Setting ' compatible ' changes numerous options, so the other options should is set after Setting ' compatible '. Set Nocompatible "VIM5 and later versions support syntax. Uncommenting the "following enables syntax highlighting by default. If has ("syntax") syntax on "syntax highlighting endif colorscheme Ron" Elflord Ron Peachpuff default settings Color scheme, VIM's own color scheme is saved in the/usr/share/vim/vim72/colors directory "detect file type filetype on filetype plugin on" If Using a dark background within the editing area and syntax highlighting ' turn on ' this option as a. Nd=dark "Uncomment the following to have Vim jump "Reopening a file if has (" autocmd ") au bufreadpost * If line (" ' \ ") > 1 && Line (" "") <= Line ("$") | EXE "normal! G ' \ ' "| endif "have Vim load indentation rules and plugins according to the detected filetype filetype plugin indent o N endif "The following are commented out as they cause vim to behave a lot" differently from regular Vi. They are highly recommended though. The "Set ignorecase" search mode ignores case "set Smartcase" if the search pattern contains uppercase characters, the ' ignorecase ' option is not used. Used only if you enter the search mode and open the ' ignorecase ' option. Set Autowrite "Automatically writes the content back to the file: If the file has been modified, at each: Next,: Rewind,: Last,: I,:p revious,: Stop,: Suspend,: Tag,:!,: Make, Ctrl] and ctrl-^ when the command is used: The buffer, Ctrl-o, Ctrl-i, ' {a-z0-9}, or ' {a-z0-9} ' command is transferred to another file. Set Autoindent sets automatic alignment (indentation): That is, the indentation value of each row is equal to the previous line; Noautoindent set smartindent smart Alignment set TabStop =4 sets the width of the tab (tab) Set softtabstop=4 sets the width of the Soft tab set shiftwidth=4 (Automatic) Indent 4 spaces Set Cindent "Set CINOPTIONS={0,1S,T0,N-2,P2S using the automatic indentation method of the C + + language, (03s,=.5s,>1s,=1s,:1s) The concrete indentation mode of the word "set backspace=2" sets the backspace key to use set Showmatch "sets the match pattern, displays the matching parentheses set linebreak" the whole word wraps S. Et whichwrap=b,s,<,>,[,] "the cursor jumps from the beginning and end of the line to the other row to the" set hidden "Hide buffers when they are abandoned set mouse=a The Enable mouse usage (all modes) uses the mouse set number "Enable line numbers" to display row numbering set prev Iewwindow "Identity Preview window set history=50" SET command history to 50 "History 50"--state line setting--Set Laststatu s=2 Displays the status line of the last window, which displays the status line of the last window when the number of Windows is more than one; 0 does not display the status line set ruler ruler for the last window, which displays the line and column numbers for the cursor position, separated by commas. Each window has its own ruler. If the window has a status row, the ruler appears there. Otherwise, it appears on the last line of the screen. "--Command line Settings--set showcmd" command line display input command set showmode "command line displays vim current mode"--find setting--set I Ncsearch "Input string displays the matching point set Hlsearch

Note: In the configuration file, text that starts with a single double quote is commented.
After saving the file, start vim. At this point, vim is already the effect (syntax highlighting is beautiful-this is supported by the Plug-ins in vim-scripts):

3, ctags Installation and configuration
Ctags can establish the index of the source tree tag (the label is where an identifier is defined, such as a function definition), so that programmers can quickly locate functions, variables, macro definitions and so on to view the prototype
The following is the download installation and configuration process for ctags under Ubuntu:
Download and install ctags, Terminal input command
lingd@ubuntu:~/arm$ sudo apt-get install ctags
Build source index, such as I often need to check Linux kernel code, and this code in the/home/lingd/arm/linux-2.6.24.7 directory
Then in the terminal into the directory, enter the command Ctags-r *, you will find a more than a tags file, this is the index file
lingd@ubuntu:~/arm$ CD linux-2.6.24.7
lingd@ubuntu:~/arm/linux-2.6.24.7$ ls
Arch crypto include kernel mm samples usr
Block Documentation init LIB net scripts
Copying drivers IPC maintainers README Security
Credits FS Kbuild Makefile Reporting-bugs Sound
lingd@ubuntu:~/arm/linux-2.6.24.7$ Ctags-r *
lingd@ubuntu:~/arm/linux-2.6.24.7$ ls
Arch crypto include kernel mm samples tags
Block Documentation init Lib net scripts usr
Copying drivers IPC maintainers README Security
Credits FS Kbuild Makefile Reporting-bugs Sound
Register the index file tags path to vim,
lingd@ubuntu:~/arm/linux-2.6.24.7$ VI ~/.VIMRC
At the end of the open file add the following (of course, the specific path according to your own situation)

"--ctags setting-- "

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.