Closed tgeng closed 4 years ago
I haven't attempted to support literate Agda at all, though it is possible it works fine or could be made to work just by making the syntax highlighting work do something reasonable for.lagda.md
files.
If there is some specific markdown plugin you have in mind, I can look at it, but if it doesn't actually load other plugins to handle code blocks, there's nothing I can do to change its behavior.
If all you care about from the markdown plugin is syntax highlighting, it might be enough to replace the agda-vim
syntax file with the markdown plugin's syntax file plus the rule
syn match agdaHole "\v(^|\s|[.(){};])@<=(\?)($|\s|[.(){};])@="
and modify ftdetect/agda.vim
to handle *.lagda.md
files. In theory, this should make all the interactive features work.
It should be relatively easy to go further and take an existing markdown syntax file and combine it with the current Agda syntax file so that you get Agda highlighting in the code blocks and markdown highlighting outside of them.
With vanilla neovim 0.3.8, and ftdetect/agda.vim
containing the following
au BufRead,BufNewFile *.agda,*.lagda,*.lagda.md setf agda
vim still thinks a lagda.md
file to be a markdown file instead of agda (echo &ft
gives markdown
). I also tried cp ftplugin/agda.vim ftplugin/markdown.vim
and it works like a charm for lagda.md
file. But it complains for normal markdown files as agda complains the extension does not contain .lagda
before .md
.
Any ideas?
For the former, the problem is presumably that both autocmds are run and the Markdown one is run afterwards. One solution to this that doesn't require changing any of the original files is to simply specify the filetype in a vim modeline.
In the latter case, you are simply replacing the Markdown plugin's code with the agda-vim's which isn't going to work for Markdown files that aren't Agda files as you found out.
Any "nice" integration between these is either going to require a sophisticated Markdown plugin that can load third-party plugins for code blocks, or it will require non-trivial changes to one or both of the Markdown plugin and this one. The cheapest integration you could get is to modify the agda-vim syntax files to source the Markdown syntax files (or just inline the syntax highlighting code) instead of running the Agda syntax code (for .lagda.md
files) except including the line I mentioned in the previous comment and use a modeline to set the filetype. This will give you markdown highlighting but cost you Agda highlighting. You could probably recover that by duplicating the Agda syntax code only making it nested in whatever syntax group is used for code blocks by the markdown syntax highlighting.
Thank you for this awesome plugin. It saves vimmers like me from "evil" emacs :smiley:. It would be awesome if this plugin works with
*.lagda.md
as well. However my vimscript-fu is weak. I could not figure out how to make it coexist with other mardown plugins. Could you help me?