diff --git a/lsp/ocamllsp.lua b/lsp/ocamllsp.lua new file mode 100644 index 00000000..bf7200a4 --- /dev/null +++ b/lsp/ocamllsp.lua @@ -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 = {}, +} diff --git a/lua/custom/init.lua b/lua/custom/init.lua new file mode 100644 index 00000000..2272d4c8 --- /dev/null +++ b/lua/custom/init.lua @@ -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, +}) diff --git a/lua/custom/plugins/render-markdown.lua b/lua/custom/plugins/render-markdown.lua new file mode 100644 index 00000000..90afa565 --- /dev/null +++ b/lua/custom/plugins/render-markdown.lua @@ -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 = {}, +}