SkillAgentSearch skills...

UCM.nvim

A plugin to quickly create and manage Unreal Engine classes (.h/.cpp file pairs) from Neovim.

Install / Use

/learn @taku25/UCM.nvim
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

UCM.nvim

Unreal Class Manager 💓 Neovim

<table> <tr> <td><div align=center><img width="100%" alt="UCM New Class Interactive Demo" src="https://raw.githubusercontent.com/taku25/UCM.nvim/images/assets/main-image-new.png" /></div></td> <td><div align=center><img width="100%" alt="UCM Rename Class Interactive Demo" src="https://raw.githubusercontent.com/taku25/UCM.nvim/images/assets/main-image-delete.png" /></div></td> </tr> </table>

UCM.nvim is a Neovim plugin designed to streamline the management of Unreal Engine C++ classes. It allows you to create, switch, rename, delete, and generate implementation code for C++ classes directly from Neovim, following project-specific rules.

English | 日本語 (Japanese)


✨ Features

  • Data-Driven Architecture:
    • Centrally manage project-specific folder structures (e.g., Public/Private separation) and class creation rules via conf.lua.
    • Class creation, renaming, deletion, and header/source switching are executed based on these robust rules.
    • Note: Operations are file-system based. Renaming class symbols within the code should be handled by your LSP.
  • Seamless UI Integration:
    • Automatically detects and utilizes Telescope or fzf-lua as the frontend for new, rename, and delete commands.
    • Falls back to the native Neovim UI if no external UI plugin is installed.
  • Intelligent Implementation Generation:
    • The :UCM copy_imp command automatically generates the C++ implementation stub for the function declaration under the cursor.
    • It intelligently strips UFUNCTION macros, virtual/override keywords, and default arguments (= 0.f), while automatically adding the class scope and Super:: calls where appropriate.
  • Rider-like Code Generation:
    • :UCM create_impl: Instantly creates a function implementation in the .cpp file from a declaration in the .h file. Automatically adds Super:: calls for overrides.
    • :UCM create_decl: Generates a function declaration in the .h file from an implementation in the .cpp file.
    • :UCM add_struct: Interactively inserts a new USTRUCT definition. Can optionally fetch base struct suggestions from the project using UEP.
  • Smart Includes:
    • Automatically calculates the correct relative #include path (from module Public or Classes folders) for the current file or a selected class and copies it to the clipboard.
  • Macro Wizard:
    • Provides an intelligent completion wizard for Unreal Engine reflection macros (UPROPERTY, UFUNCTION, etc.).
    • Allows interactive multi-selection of appropriate specifiers (e.g., EditAnywhere, BlueprintReadWrite) to insert directly into your code.
<table> <tr> <td> <div align=center> <img width="100%" alt="UCM new gif" src="https://raw.githubusercontent.com/taku25/UCM.nvim/images/assets/ucmui-new.gif" /><br> <code>:UCM new</code> Command </div> </td> <td> <div align=center> <img width="100%" alt="UCM rename gif" src="https://raw.githubusercontent.com/taku25/UCM.nvim/images/assets/ucmui-rename.gif" /><br> <code>:UCM rename</code> Command </div> </td> </tr> </table>

🔧 Requirements

  • Neovim v0.11.3 or higher
  • UNL.nvim (Required)
  • Optional (Strongly recommended for an enhanced UI experience):

🚀 Installation

Install with your favorite plugin manager.

lazy.nvim

return {
  'taku25/UCM.nvim',
  dependencies = {
    "taku25/UNL.nvim", -- Required!
    -- Optional UI backends
    "nvim-telescope/telescope.nvim",
    "ibhagwan/fzf-lua",
  },
  opts = {
    -- Configure as you see fit
  },
}

⚙️ Configuration

You can customize the plugin's behavior by passing a table to the opts field.

opts = {
  -- Select the UI frontend to use
  -- "auto": Automatically selects in the order of priority: Telescope -> fzf-lua -> native
  -- "telescope": Prioritizes Telescope (requires fd)
  -- "fzf-lua": Prioritizes fzf-lua (requires fd)
  -- "native": Uses the standard vim.ui (fd is not required)
  ui_frontend = "auto",

  -- Whether to show a confirmation UI when running the :UCM new command
  confirm_on_new = true,

  -- Copyright header for new header files
  copyright_header_h = "// Copyright...",
  -- Copyright header for new source files
  copyright_header_cpp = "// Copyright..",

  -- Default parent class for :UCM new when omitted
  default_parent_class = "Actor",

  -- Templates for class creation
  template_rules = {
    {
      name = "Object",
      priority = 0,
      parent_regex = ".*", -- Default for any UObject
      template_dir = "builtin",
      header_template = "UObject.h.tpl",
      source_template = "UObject.cpp.tpl",
      class_prefix = "U",
      uclass_specifier = "",
      base_class_name = "Object",
      direct_includes = { '"UObject/Object.h"' },
    },
  },
  -- Rules for finding the corresponding source/header file
  folder_rules = {
    -- Basic Public <-> Private mapping
    { type = "header",  regex = "^[Pp]ublic$", replacement = "Private" },
    { type = "source",  regex = "^[Pp]rivate$", replacement = "Public" },
    { type = "header",  regex = "^[Cc]lasses$", replacement = "Sources" },
    { type = "source",  regex = "^[Ss]ources$", replacement = "Classes" },
    
    -- Example of an asymmetric rule
    -- { regex = "^Headers$", replacement = "Private" },
    -- { regex = "^Private$", replacement = "Headers" },
  },
}

⚡ Usage

" Directly create a new class.
:UCM new <ClassName> <ParentClass> [TargetDir]

" Directly delete a class file (extension is optional).
:UCM delete <Relative/Path/To/File>

" Directly rename a class file (extension is optional).
:UCM rename <Relative/Path/To/File> <NewName>

" Move a class to a new directory.
:UCM move <Source/File/Path> <Target/Dir>

" Switch between the header (.h) and source (.cpp) file.
:UCM switch

" Generates the implementation code for the function declaration under the cursor and copies it to the clipboard.
:UCM copy_imp

" Copy the correct relative #include path for the current file to the clipboard.
:UCM copy_include

" Pick a class from the project list and copy its #include path.
:UCM copy_include!

" Insert specifiers for the current macro context (e.g. UPROPERTY).
:UCM specifiers

" Force open the macro type selector (UPROPERTY/UFUNCTION/etc) and insert specifiers.
:UCM specifiers!

" Show a flat list of symbols (functions, properties, etc.) in the current file for quick navigation.
:UCM symbols

" Interactively insert a new USTRUCT definition (can select parent struct via UEP)
:UCM add_struct

### Class/Struct Creation Commands

#### `:UCM new`
Create a new class or struct. Lets you interactively select a parent from both classes and structs in your project.

:UCM new <Name> <Parent> [TargetDir]

If no arguments are provided, a UI will prompt for the name and parent (class or struct).

#### `:UCM new_class`
Create a new class. Lets you select only from classes as the parent.

:UCM new_class <ClassName> <ParentClass> [TargetDir]

If no arguments are provided, a UI will prompt for the class name and parent class.

#### `:UCM new_struct`
Create a new struct. Lets you select only from structs as the parent.

:UCM new_struct <StructName> <ParentStruct> [TargetDir]

If no arguments are provided, a UI will prompt for the struct name and parent struct.

" Create function implementation in source (.cpp) from declaration in header (.h) (Rider-like)
:UCM create_impl

" Create function declaration in header (.h) from implementation in source (.cpp) (Rider-like)
:UCM create_decl

🤖 API & Automation Examples

You can use the UCM.api module to integrate with file explorers like Neo-tree. Please check the documentation for all APIs via :help ucm.

🌲 Create, delete, and rename classes from Neo-tree

opts = {
  close_if_last_window  = true,
  -- Example Neo-tree key mapping settings
  filesystem = {
    use_libuv_file_watcher = true,
    window = {
      mappings = {
        ["<leader>n"] = function(state)
          local node = state.tree:get_node()
          require("UCM.api").new_class({ target_dir = node.path })
        end,
        ["<leader>d"] = function(state)
          -- Just pass the path from Neo-tree as an argument!
          local node = state.tree:get_node()
          require("UCM.api").delete_class({ file_path = node.path })
        end,
        ["<leader>r"] = function(state)
          local node = state.tree:get_node()
          require("UCM.api").rename_class({ file_path = node.path })
        end,
      },
    },
  },
},

Others

Unreal Engine Related Plugins:

  • UnrealDev.nvim
    • Recommended: An all-in-one suite to install and manage all these Unreal Engine related plugins at once.
  • UNX.nvim
    • Standard: A dedicated explorer and sidebar optimized for Unreal Engine development. It visualizes project structure, class hierarchies, and profiling insights without depending on external file tree plugins.
  • UEP.nvim
    • Analyzes .uproject to simplify file navigation.
  • UEA.nvim
    • Finds Blueprint usages of C++ classes.
  • UBT.nvim
    • Use Build, GenerateClangDataBase, etc., asynchronously from Neovim.
  • [UCM.nvim](https://github.com/taku25/U
View on GitHub
GitHub Stars5
CategoryDevelopment
Updated1mo ago
Forks2

Languages

Lua

Security Score

90/100

Audited on Feb 12, 2026

No findings