Skip to content

anmonteiro/ocaml.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocaml.nvim

Tools for working with OCaml. Status is very work in progress and likely to break. Use at your own risk (but feel free to file issues)

Just some utilties for working with ppx_rapper.

If you're not using OCaml (you should be) then this plugin is worthless to you.

Installation

Plug 'tjdevries/ocaml.nvim', {'do': ':lua require("ocaml").update()'}

And then, you'll probably need to do this before you load nvim-treesitter (if you want to use ensure_installed, but I do my best to make this not required)

requre('ocaml').setup()

Feature: Highlighting

  • Automatically highlight code from ppx_wraper:
let create_query =
  [%rapper
    get_one
      {|
      INSERT INTO resources (name)
      VALUES (%string{name})
      RETURNING @int{id}
    |}]
;;

You can customize the colors by doing something like:

hi! link @rapper_argument @parameter
hi! link @rapper_return @type
  • Automatically highlight code from %graphql:
module SomeGraphql = [%graphql
  {| mutation deposit($account: String, $amount: UInt64) {
    changeBalance(account: $account) {
      payment {
        id
      }
    }
  } |}
];

You just need to have graphql grammar installed.

Feature: Easily update types in .ml/.mli files

You can map a function to easily update the corresponding type in your .ml or .mli files, by doing:

-- Use <leader>out to update the type
vim.keymap.set("n", "<leader>out", require('ocaml.actions').update_interface_type, { desc = "[O]caml [U]pdate [T]ype" })

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scheme 53.6%
  • Lua 46.4%