o
odinpkg.dev
packages / library / odin.nvim

odin.nvim

2ebeb53library

Neovim plugin for Odin

MIT · updated 2 weeks ago

odin.nvim

Neovim plugin for the Odin programming language.

The plugin provides:

  • build/test/format commands
  • per-project overrides for build/test commands
  • build errors in quickfix list
  • format-on-save
  • Tree-sitter folding
  • optional ols workspace folders for the Odin standard library
  • optional Telescope pickers for project and standard library Odin symbols
  • bundled LLDB formatters for Odin
  • health check

Getting started

See doc/odin.nvim.txt for detailed plugin documentation.

Requirements

  • Neovim 0.12 or newer
  • lazy.nvim

Installation

Using lazy.nvim:

{
  "cephei8/odin.nvim",
  lazy = false,
  opts = {},
}

Commands

Command Description
:Odin build Runs the configured build command
:Odin test Runs the configured test command
:Odin fmt Formats the current buffer using odinfmt tool

Per-project command overrides

Use vim.opt.exrc = true + per-project .nvim.lua files.

In the project's .nvim.lua file override build/test commands:

require("odin").setup({
  commands = {
    build = { "odin", "build", ".", "-debug" },
    test = { "odin", "test", ".", "-define:ODIN_TEST_SHORT_LOGS=true" },
  },
})

Commands run from the detected project root.

Telescope extension

If Telescope is installed, odin.nvim loads its optional extension during setup. You can also load it manually:

require("telescope").load_extension("odin")

To disable automatic loading:

require("odin").setup({
  telescope = {
    load_extension = false,
  },
})

Available pickers:

Picker Description
:Telescope odin project_symbols Shows workspace symbols under the current Odin project root
:Telescope odin stdlib_symbols Shows workspace symbols from the Odin standard library

Extra setup

The following is not provided by the plugin, but is needed for a full Odin programming setup:

  • syntax highlighting
  • LSP setup
  • autocomplete
  • debugging setup

Check out this blog post on how to set it up: Neovim setup for Odin.

License

This project is licensed under the terms of the MIT License.