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

Source: Internet
Author: User
Tags function definition set background
Reprint please indicate the source lingdxuyan.blog.chinaunix.net
Steps to transform Vim into the C + + development environment (IDE)
Original Address http://blog168.chinaunix.net/space.php?uid=23089249&do=blog&id=2855999

Resources
Wu Yin's "hands-on teaching you to convert vim into an IDE programming environment"
Successfully made vim under Fedora for the IDE
Using Vim to build a C + + development environment
Configuration of Vim+ctags under Ubuntu (turn)
Vim under the code automatic completion and code jump Read (Turn) omnicppcomplete-a Vim Plugin
My VIM IDE Interface: 1, install vim and vim Basic plug-in first installs 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 powerful function, its source basically on two places: Vim plug-in and 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. The following text is then copied into this file to save: "This line should is removed as it ensures that various options are
"Properly set to work with the vim-related 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 no other options should is set after setting ' compatible '."
Set nocompatible

"VIM5 and later versions support syntax highlighting. Uncommenting the
"Following enables syntax highlighting by default."
If has ("syntax")
Syntax on "syntax highlighting
endif
ColorScheme Ron "Elflord Ron peachpuff default set color scheme, VIM's own color scheme saved in/usr/share/vim/vim72/colors directory

The Detect file type
FileType on
FileType plugin on

"If using a dark background within the editing area and syntax highlighting
"Turn on" option as OK
Set Background=dark

"Uncomment the following to have Vim jump to the last position when
"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 on
endif

"The following are commented out as they cause vim to behave a lot
"Differently from regular Vi. They are highly recommended though.

Ignore case in "set ignorecase" search mode
Set Smartcase If the search pattern contains uppercase characters, do not use the ' ignorecase ' option. 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 automatically aligns (indents): The indentation value of each row is equal to the previous line; Use Noautoindent to cancel the setting
"Set smartindent" smart alignment
Set tabstop=4 "Sets the width of the tab (Tab key)
Set softtabstop=4 "Sets the width of a soft tab
4 spaces used by set shiftwidth=4 "(automatic) Indentation
Set Cindent "Using the automatic indentation method of C + + language
Set Cinoptions={0,1s,t0,n-2,p2s, (03s,=.5s,>1s,=1s,:1s "sets the specific indentation for C + + language
Set backspace=2 setting backspace key available
Set Showmatch "sets match mode, showing matching parentheses
Set linebreak "Whole word wrapping."
Set whichwrap=b,s,<,>,[,] "the cursor can jump to another line from the beginning and end of the line
"Set hidden" Hide buffers when they are abandoned
Set mouse=a "Enable mouse usage (all modes)" using the mouse
Set Number "Enable Line No."
"Set Previewwindow" identifies the preview window
Set history=50 "set command history to 50" history 50


"--Status line setting--
Set laststatus=2 always displays the state line of the last window, and the status line of the last window when the number of Windows is set to 1; 0 does not display the status line of the last window
Set ruler ruler, 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 to display the commands entered
Set showmode command line shows vim current mode

"--find setting--
Set Incsearch "input string shows match point
Set Hlsearch Note: In a 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
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.