| English | 简体中文 |
- Provide UI interface for you to quickly configure, compile and clean up xmake.
- automatically generates
compile_commands.json
for lsp use when savingxmake.lua
files - All external command calls are executed asynchronously without worrying about performance issues.
Set Menu | Set Toolchain |
---|---|
![]() |
![]() |
Set Build Mode | Build Target |
![]() |
![]() |
{
"Mythos-404/xmake.nvim"
lazy = true,
event = "BufReadPost xmake.lua",
config = true,
dependencies = { "MunifTanjim/nui.nvim", "nvim-lua/plenary.nvim" },
}
The plugin uses the new command execution function
vim.system
so your version of neovim must be built after this commit! If this function is not supported you can use xmake.nvim from the v1 branch.
{
files_path = vim.fn.stdpath("cache") ... "/xmake_", -- project data saved by plugin
compile_command = { -- compile_command file generation configuration
lsp = "clangd", -- generate compile_commands file for which lsp to read
dir = ".vscode", -- location of the generated file
},
menu = { -- interface configuration
size = { width = 25, height = 20 }, -- interface size
bottom_text_format = "%s(%s)", -- interface formatting string Generated by default: `"xmake_test(debug)"`
border_style = { "╭", "─", "╮", "│", "╯", "─", "╰", "│" }, -- interface border see nui.nvim documentation for more detail
},
debug = false, -- Enable to provide more detailed error output.
work_dir = vim.fn.getcwd(), -- Get the work directory.
}
XmakeSetMenu
General Selection PageXmakeSetToolchain
toolchain selectionXmakeSetMode
compile mode selectionXmakeSetTarget
target selectionXmakeSetPlat
Target platform selectionXmakeSetArch
Target architecture selectionXmakeBuild
Build targetXmakeBuildAll
Build all targets.XmakeBuildTarget
Builds a specific target.XmakeClean
Cleans up a target.XmakeCleanAll
Cleans all targets.XmakeCleanTarget
Cleans the specified target.
Use with nvim-dap
to get the compiled output path of a target.
dap.configurations.cpp = {
{
name = "Launch file",
type = "codelldb",
request = "launch",
program = function()
return require("xmake.project_config").info.target.exec_path
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
},
}
Used in conjunction with state line plugins such as lualine.nvim
, an example of lualine.nvim
is provided here
local xmake_component = {
function()
local xmake = require("xmake.project_config").info
if xmake.target.tg == "" then
return ""
end
return xmake.target.tg .. "(" .. xmake.mode .. ")"
end,
cond = function()
return vim.o.columns > 100
end,
on_click = function()
require("xmake.project_config._menu").init() -- Add the on-click ui
end,
}
require("lualine").setup({
sections = {
lualine_y = {
xmake_component
}
}
})
- Run function (in UI)
- Run the target
- Run multiple targets
- Input when running
- Monitor the success of the run