Skip to content

A vim plugin offers nginx/openresty syntax highlight and directives completion

License

Notifications You must be signed in to change notification settings

spacewander/openresty-vim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Vim plugin offers Nginx/Openresty syntax highlight and directives completion

example

This little plugin offers:

  1. syntax highlight for Nginx configuration, with addition OpenResty enhancement.
  2. syntax highlight for LuaJIT source file, with adddition OpenResty API highlight.
  3. syntax-based directives completion.

Support version

This plugin supports OpenResty v1.21.4.

How to use

First of all, install this plugin with your favorite plugin manager.

The syntax highlight is enabled once your file is detected as Nginx configuration. If Vim doesn't recognize the file type, you could add this to your .vimrc:

autocmd BufRead,BufNewFile pattern_matched_your_file(s) set filetype=nginx

For example, autocmd BufRead,BufNewFile nginx_*.conf.tpl set filetype=nginx or autocmd BufRead,BufNewFile * if match(getline(1),"nginx") >=0 | set filetype=nginx | endif

To complete the directives, type part of the word and then type Ctrl+x Ctrl+o to trigger it. If you are using YouCompleteMe, set let g:ycm_seed_identifiers_with_syntax = 1 in your .vimrc.

Known issue

There is a limit to render Lua snippet inside _by_lua_block directives. You need to close the block with } in separate line, and } should have the same indent with the {. It is a hack to distinguish from } of the inner Lua snippet. Anyway, if your configuration is in good format, the highlight should work smoothly.

About

A vim plugin offers nginx/openresty syntax highlight and directives completion

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published