Vim Auto Indent settings

Source: Internet
Author: User
Tags function prototype

Software vim required

http://www.vim.org

Code_complete.vim Plug-in

http://www.vim.org/scripts/script.php?script_id=1764

Ctags generally installed after vim will have, Ubuntu seems to be not supported, need to download. A VIM configuration reproduced Eric's article, source

Http://blog.chinaunix.net/u/22968/showart_432269.html

 1, configuration file location & #160;    Under directory/etc/, there is a file called VIMRC, which is a common vim profile in the system and is valid for all users. In each user's home directory, you can create a private configuration file, named: ". VIMRC". For example, under the/root directory, a. vimrc file is usually already present. & #160; 2, set syntax highlighting 1) Open VIMRC, add the following statement to make syntax highlighting:& #160;   syntax on2) If the syntax is not highlighted at this time, then Add the following statement to the profile file in the ETC directory:& #160;   export Term=xterm-color3, set the Windows-style c/C + + Auto Indent (add the following set statement to VIMRC) & #160;             1) Do not discuss tab 8 or 4 better, here Set (soft) tab width 4:& #160;                           set tabstop=4& #160;                       & nbsp;   set softtabstop=4& #160;             2) sets the number of spaces in the indent to 4&# 160;                         Set shiftwidth=4& #160;             3) Set auto Indent: 77 indent value for each row is equal to the previous line; Use Noautoindent to cancel settings: Set autoindent& #160;              4) Set automatic indentation using the C + + language:& #160;              & nbsp;          set cindent& #160;             5) How to set the specific indentation for the C + + language (in my Windows style example):& #160;                          set cinoptions={0,1s,t0,n-2,p2s, (03s,=.5s,>1s,=1s,:1s& #160;             6) If you want to display the line number of the text on the left, you can use the following statement:& #160;                         set nu& #160;              7) Finally, if you don't have the following statement, add it: if &term== "xterm" & #160;   set t_co=8& #160;   set t_sb=^[[4%dm& #160;   set t_sf=^[[3%dmendifps: Auto Indent has two options: & #160 Code:& #160;   set autoindent& #160;& #160;   set cindent& #160; & #160;& #160; Autoindent is the meaning of automatic indentation, when you insert a new line in the input state with the ENTER key, or when you insert a new row in the normal state with O or O, Autoindent automatically copies the indentation of the current line to the new row. That is, "automatic alignment", of course, if you do not enter any characters in the new line, then this indentation will be automatically deleted. & #160;& #160;& #160, Cindent is different, it will automatically adjust the length of the indentation according to the C language syntax, for example, when you enter a half statement and then enter, the indentation automatically adds a TABSTOP value, When you type a closing curly brace, a TABSTOP value is automatically reduced. Two code_complete configuration to download the code_complete copy to plugin directory, generally in (I am)/usr/share/vim/vim71/plugin next three with ctags command to generate tags file, ctags-r-- C-kinds=+p--fields=+s should be considered as an index table, and then copy the generated tags files to your programming directory.

Use the key in vim to complete the function prototype.

How to make vim write shell script auto indent

Vim comes with features such as syntax coloring, indentation, and so on, to write bash scripts.

To enable them, add the following in the. VIMRC:

set nocompatible

filetype plugin indent on

Vim Auto Indent settings

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.