Configure syntax highlighting when using VIM to edit nginx configuration files

Source: Internet
Author: User
Tags configuration settings

Vim is a very useful text editor in Unix system, compared with the traditional VI, the biggest difference is that it supports the color scheme, this feature makes it possible to edit some configuration files or write code in the time greatly improve work efficiency, If we have the corresponding package installed in the system vim and the syntax color scheme is turned on, the syntax highlighting is often caused by incorrect configuration settings. The general configuration error has 2 places: 1, is the remote server emulation client terminal configuration error, 2, is the server environment variable configuration error. In this case, we use SECURECRT to simulate the customer terminal as an example, simply say vim turns on the syntax color scheme:

In the SECURECRT need to configure the current session to open the customer's simulation, click on the Linux emulation and then check the "ANSI Color" 650) this.width=650; "Src=" http://s3.51cto.com/wyfs02/ M01/8c/9c/wkiom1hx28mxbzjaaacluq_gway223.png-wh_500x0-wm_3-wmp_4-s_955823715.png Configuration "alt=" in "title=" SecureCRT Wkiom1hx28mxbzjaaacluq_gway223.png-wh_50 "/>

See the value of the term variable on the re-attached server

[[email protected] ~]# echo $TERMVT 100# This setting certainly does not display the color, modified, in order to make the environment variable effective can write the term configuration in/etc/profile or ~/.BASHRC add [[Email Protected] ~]# Term=linux[[email protected] ~]# vim ~/.BASHRC ... Slightly... Term=linuxexport term

This opens the VIM color scheme, finally to say that Vim's default supported color scheme is placed in the/usr/share/vim/vim74/syntax/path under all the *.vim file, while the control syntax highlighting the file is/usr/share/vim/ Vim74/syntax/syntax.vim, a friend of the previous paragraph asked me why the nginx is not highlighted in fact the system is not configured in the default reason, in the Nginx source package contrib/vim/ Syntax folder This is the official VIM color scheme, the official document says, the configuration is also very simple:

#在家目录建立. Vim hidden folder [[email protected] ~]# mkdir ~/.vim[[email protected] ~]# CD. vim# new Syntax Copy the official configuration file [email protected ]. vim]# mkdir syntax/[[email protected]. vim]# Cp/usr/local/src/nginx-1.10.2/contrib/vim/syntax/nginx.vim syntax/# Edit file Filetype.vim[[email protected]. vim]# vim Filetype.vimau bufread,bufnewfile/usr/local/nginx/conf* if &ft = = " | Setfiletype Nginx | endif# Note is the configuration file path after bufnewfile to put Nginx

This configures the syntax highlighting when you use Vim to edit nginx configuration files.

This article from "Technical essay" blog, declined reprint!

Configure syntax highlighting when using VIM to edit nginx configuration files

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.