lsp based prolog neovim support
  • Vim Script 79.4%
  • Lua 20.6%
Find a file
2026-06-09 22:00:50 -07:00
docs The lua module is renamed and verified working. 2026-06-09 19:20:59 -07:00
ftdetect init 2026-06-03 20:09:58 -07:00
ftplugin init 2026-06-03 20:09:58 -07:00
indent init 2026-06-03 20:09:58 -07:00
lua/plgl The lua module is renamed and verified working. 2026-06-09 19:20:59 -07:00
syntax syntax 2026-06-03 21:27:55 -07:00
.gitignore init 2026-06-03 20:09:58 -07:00
LICENSE init 2026-06-03 20:09:58 -07:00
README.md readme 2026-06-09 22:00:50 -07:00

patch-prolog.nvim

Neovim support for ISO Prolog as implemented by patch-prolog (the plg* toolchain and plgl language server).

Features

  • Filetype detection.pl, .plg, .pro are detected as prolog (overrides Neovim's built-in Perl mapping for .pl; see patch-prolog/docs/OPERATORS.md for the upstream rationale).
  • Syntax highlighting — comments (% line, /* */ block), strings, quoted atoms, numbers, variables, the full ISO operator table, common built-ins, and stdlib predicates.
  • Auto-indentation — bodies indent after :-, parens/brackets indent on open and dedent on close.
  • LSP integration — drives plgl over stdio for real-time diagnostics (parse errors, plus warnings for calls to undefined predicates with did-you-mean suggestions), completion (built-ins + stdlib + buffer-defined predicates), hover (one-line docs for built-ins, clause heads for user-defined predicates), and goto-definition.

Requirements

  • Neovim 0.10+ (for vim.lsp.start and vim.filetype.add).
  • plgl binary on your PATH.

Installing plgl

Build from source — the toolchain isn't on crates.io yet. The LSP server links only the parser (no clang needed); install just it with:

git clone https://git.navicore.tech/navicore/patch-prolog
cd patch-prolog
cargo install --path crates/lsp

Or install the whole toolchain (the plgc compiler + the plgl server) in one step with the repo's justfile:

just install

Verify with plgl --version.

Installation

lazy.nvim

{
  "navicore/patch-prolog.nvim",
  ft = "prolog",
  opts = {},
}

Manual

require("plgl").setup({})

With options

require("plgl").setup({
  -- Override the binary path/args (default: { "plgl" }).
  cmd = { "plgl" },

  -- Standard LSP hooks — same shape as any other lspconfig client.
  on_attach = function(client, bufnr)
    -- e.g. local map = vim.keymap.set
    -- map("n", "gd", vim.lsp.buf.definition, { buffer = bufnr })
    -- map("n", "K",  vim.lsp.buf.hover,      { buffer = bufnr })
  end,
  capabilities = vim.lsp.protocol.make_client_capabilities(),
})

Reporting issues

License

MIT.