Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Easy way to get VIM highlight NGINX configuration file

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Preface

It is well known that by default, vim does not highlight the configuration file of nginx, so you need to turn on this function manually. So how to open it manually? Let's take a look at the detailed implementation.

Download nginx.vim

Here take the Linux system as an example, other systems are more or less the same.

Change to the syntax configuration directory of vim and download the nginx syntax file.

Note that the vim74 in the path needs to correspond to the vim version number installed on the machine.

Cd / usr/share/vim/vim74/syntax & & wget-O nginx.vim https://vim.sourceforge.io/scripts/download_script.php?src_id=19394

Configure filetype.vim

Edit the filetype.vim file to register the nginx syntax file

Vim/ usr/share/vim/vim74/filetype.vim

Add the following code to the file, where nginx_path needs to be replaced with the configuration file directory of nginx on the machine, such as / etc/nginx/*:

"nginxau BufNewFile,BufRead nginx_path setf nginx

Effect at a glance

Before configuration

After configuration

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report