GithubHelp home page GithubHelp logo

Support for `*.lagda.md`? about agda-vim HOT 3 CLOSED

derekelkins avatar derekelkins commented on September 27, 2024
Support for `*.lagda.md`?

from agda-vim.

Comments (3)

derekelkins avatar derekelkins commented on September 27, 2024

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.

from agda-vim.

tgeng avatar tgeng commented on September 27, 2024

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?

from agda-vim.

derekelkins avatar derekelkins commented on September 27, 2024

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.

from agda-vim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.