NvimUnitySync

May 15, 2025 ยท View on GitHub

Nvim Unity Sync is a lightweight Neovim plugin designed to enhance Unity development inside Neovim. It automatically manages .csproj files based on file events, helping you avoid the need to manually regenerate project files in Unity.

Required

โœจ Features

  • Automatically adds or removes <Compile> tags from .csproj files when .cs files are created, deleted, or renamed.
  • Hooks into nvim-tree and LSP events.
  • Offers commands to manually manage project structure.

Note that the Assembly-CSharp.csproj will be overwriten by Unity, but in this way you can work in your Unity project with lsp features like code completions without the need of unity to be open.

๐Ÿ”ง Plugin Commands

CommandDescription
:UstatusShow project status info.
:UsyncIf you have a valid unity project it will sync your files.
:UopenTry to open Unity if there is a valid project folder

๐Ÿ“‚ Installation

Install via Lazy:

{
  "apyra/nvim-unity-sync",
  config = function()
    require("unity.plugin").setup({
        -- Configs here (Optional) 
        })
  end,
  ft = "cs",
}

Available Configs

.setup({
  unity_path = "path/to/unity/Unity.exe", -- Optional, to run the :Uopen command
  unity_cs_template = false --Optional, used to insert the unity MonoBehaviour template in new .cs files
})

๐Ÿงฉ Unity Editor Integration

To make the integration even smoother, you can install the Unity-side package:

๐Ÿ“ฆ nvim-unity

This Unity package:

  • Adds a "Regenerate Project Files" button inside the Unity editor
  • Lets you set Neovim as the external script editor
  • Generates .csproj and .sln on demand

๐Ÿง‘โ€๐Ÿ’ป Contributing

PRs and suggestions welcome! This plugin is still under early development.

๐Ÿ“œ License

MIT