Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spacewander/openresty-vim
A vim plugin offers nginx/openresty syntax highlight and directives completion
https://github.com/spacewander/openresty-vim
luajit nginx openresty syntax-highlighting vim vim-plugin
Last synced: 7 days ago
JSON representation
A vim plugin offers nginx/openresty syntax highlight and directives completion
- Host: GitHub
- URL: https://github.com/spacewander/openresty-vim
- Owner: spacewander
- License: gpl-3.0
- Created: 2017-02-05T02:40:48.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-28T02:30:59.000Z (almost 2 years ago)
- Last Synced: 2024-11-01T08:33:41.822Z (14 days ago)
- Topics: luajit, nginx, openresty, syntax-highlighting, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 176 KB
- Stars: 23
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## A Vim plugin offers Nginx/Openresty syntax highlight and directives completion
![example](./example.png)
This little plugin offers:
1. syntax highlight for Nginx configuration, with addition OpenResty enhancement.
1. syntax highlight for LuaJIT source file, with adddition OpenResty API highlight.
1. 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](https://github.com/Valloric/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.