Added OCAml and Markdown lua support

This commit is contained in:
Zain Siddavatam 2026-01-08 17:46:57 +05:30
parent 4df59fd01a
commit 39ae20d3ae
3 changed files with 43 additions and 0 deletions

17
lsp/ocamllsp.lua Normal file
View File

@ -0,0 +1,17 @@
return {
cmd = { 'ocamllsp' },
filetypes = {
'ocaml',
'ocaml.interface',
'ocaml.menhir',
'ocaml.ocamllex',
'dune',
'reason',
},
root_markers = {
{ 'dune-project', 'dune-workspace' },
{ '*.opam', 'esy.json', 'package.json' },
'.git',
},
settings = {},
}

17
lua/custom/init.lua Normal file
View File

@ -0,0 +1,17 @@
-- Minimal OCaml behavior: ocp-indent for typing, ocamlformat via ocamllsp on save.
-- 1) Disable ancient builtin ocaml indent script (we will use ocp-indent)
-- 4) Format-on-save: use only ocamllsp to format the buffer before write.
-- Keeps formatting deterministic and avoids other formatters stepping in.
vim.api.nvim_create_autocmd('BufWritePre', {
pattern = { '*.ml', '*.mli' },
callback = function()
if vim.bo.filetype == 'ocaml' then
vim.lsp.buf.format {
async = false,
filter = function(client)
return client.name == 'ocamllsp'
end,
}
end
end,
})

View File

@ -0,0 +1,9 @@
return {
'MeanderingProgrammer/render-markdown.nvim',
dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.nvim' }, -- if you use the mini.nvim suite
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-mini/mini.icons' }, -- if you use standalone mini plugins
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
---@module 'render-markdown'
---@type render.md.UserConfig
opts = {},
}