Skip to content

skuzniar/nvim-cppgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Nvim-cppgen

Neovim C++ code generator.

Install

{
    "skuzniar/nvim-cppgen",
    dependencies = {
        "neovim/nvim-lspconfig"
    },
    opts =
    {
        log = {
            plugin      = 'nvim-cppgen',
            level       = 'debug',
            use_console = false
        },

        keepindent = true,

        -- Generators for Class type
        class = {
            separator = "' '",
            preamble  = function(classname)
                return '[' .. classname .. ']='
            end,
            label = function(classname, fieldname, camelized)
                return camelized .. ': '
            end,
            value = function(fieldref, type)
                return fieldref
            end
        },

        -- Generators for Enum type
        enum = {
            value = function(mnemonic, value)
                if (value) then
                    return '"' .. value .. '(' .. mnemonic .. ')' .. '"'
                else
                    return '"' .. mnemonic .. '"'
                end
            end
        },

        -- JSON serialization using cereal library
        cereal = {
            class = {
                label = function(classname, fieldname, camelized)
                    return camelized
                end,
                value = function(fieldref, type)
                    return fieldref
                end
            },
        }

        -- Switch statement generator for enum types
        switch = {
            keepindent = false,
            enum = {
                value = function(classname, fieldname)
                    return '// ' .. classname .. '::' .. fieldname
                end
            },
        }
    }
}

About

Neovim C++ code generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages