-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate vim syntax based on the documentation #99
base: master
Are you sure you want to change the base?
Conversation
I'm stoked to try this! 🎁 |
Great addition 👍 I would like the diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1e7d49..0cad90f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,7 @@ install(FILES flashmq.conf DESTINATION "/etc/flashmq")
install(FILES debian/flashmq.service DESTINATION "/lib/systemd/system")
install(FILES man/flashmq.conf.5 DESTINATION "/usr/share/man/man5")
install(FILES man/flashmq.1 DESTINATION "/usr/share/man/man1")
+install(FILES man/flashmq.vim DESTINATION "/usr/share/vim/vimfiles/syntax") And that installs it, even if the dir doesn't exist. From what I can tell, the But, I'm having issues getting the file type detection to work. I can edit I'm also having a hard time to make the modeline work ( Also small note: I have to add a space after a keyword to make it green. I don't have to do that for Nginx config files. |
This works for me, it switches syntax when I open the file: # vim: set ft=flashmq:
bridge {
listen 123
} I can't offer more help, I never use that feature of vim. Double-check
I see what you mean, yeah it's nice if that works. I pushed a fix for it. The problem is that I'm not using |
c40980b
to
a32512e
Compare
@halfgaar, Does your More info in |
Note, @bigsmoke added a feature recently, now merged in master, which adds a listen and bridge option I haven't yet continued with my attempt to get the file type selection in order. I'd like to fix that for the .deb builds before I merge it in. |
Script for generating a fully up-to-date-and-correct vim syntax file based on the documentation.
Some notes:
nginx
syntax highlights thelisten
directive in all possible scopes even thoughnginx
doesn't allow this. A lot of the examples I looked at also usedsyn Keyword
, but that means the words get highlighted no matter where it is on the line whereas with FlashMQ we know the option has to be the first word on the line.Error
type: I think it's nicer to err on the side of non-aggression. For example, an option could be accidentally left out of the manual, or the syntax file could be slightly older than FlashMQ itself. In these cases you don't want to render sections of the config file in red.nginx
example I mentioned isn't all bad: nginx itself will report a clear error if you do it wrong anyway, and it greatly simplifies the vim file.:help mysyntaxfile
inside vim (or look at the online documentation)\s*
in the script but I haven't checked to see how the FlashMQ parser behaves wrt. tabs and spaces. If you generally don't accept tabs you can replace them with*
How to use the generated file
Modify these instructions according to the flavor of
vim
you're using:Examples