Setup wizard¶
:CodeArtSetup asks a few questions and writes user/settings.lua for you. It is the quickest way to get started after installing:
git clone https://github.com/artart222/CodeArt ~/.config/nvim
nvim # then run :CodeArtSetup
It only runs when you call it. While user/settings.lua is missing or still the unedited example, the dashboard shows the hint Run :CodeArtSetup to pick your languages, theme and plugins.
The questions¶
The questions open in the picker CodeArt uses for menus (Telescope or snacks, see Picker). Pressing Esc (or closing the menu) on any question cancels the wizard and changes nothing.
| Question | What it sets |
|---|---|
| Languages: pick each pack to switch it on or off, then Done | languages (see Language packs); your own packs in user/languages/ are listed too |
Theme: move through the list to preview each theme live, Enter to pick it |
config.colorscheme. If you cancel, your old theme comes back |
| Picker: Telescope or the snacks.nvim picker | config.picker |
| File tree: neo-tree or none | disable_plugins.neo_tree |
| Optional plugins: pick each one to switch it on or off, then Done | disable_plugins.<name> for lspsaga, outline, trouble, toggleterm, gitsigns, fugitive, todo-comments, colorizer, scrollview, smooth scrolling, better-escape, nvim-dap (with nvim-dap-ui), neotest and overseer; sessions writes config.sessions.enabled, and the editing and git extras write config.extras.editing / config.extras.git |
| Format on save | config.conform.format_on_save ({ timeout_ms = 500, lsp_fallback = true } or false) |
Then it shows the resulting user/settings.lua in a window next to the question Write user/settings.lua / Cancel, with a one-line list of the changes. Nothing is written until you pick Write. Restart Neovim to apply the new settings; the theme is applied right away.
The theme preview needs a UI: Telescope and snacks preview each theme as you move. Other vim.ui.select menus apply the theme you pick and ask whether to keep it.
Your existing file is kept¶
If user/settings.lua exists, the wizard:
- copies it to
user/settings.lua.bak(replacing an older.bak), - changes only the keys whose value changed. Everything else stays exactly as it was: comments, order, your functions (
config.lsp,config.other_configs), your own plugins and key maps, - edits each value where it is written, or adds the key to the table it belongs to (
M.config = { ... },return { config = { ... } }, or a newM.languages = ...line beforereturn M).
The file is edited with Neovim's bundled Lua parser, so it works on the layouts the docs and user_settings.example.lua use:
local M = {}
M.config = { picker = "telescope" }
return M
return {
languages = { "lua" },
config = { picker = "telescope" },
}
The CodeArtSetup block¶
When a key cannot be edited in place (for example M.config = vim.tbl_extend(...), a table built by a function call), the wizard writes the changes into a marked block at the top of the file instead, and makes the file's return merge it in:
-- >>> CodeArtSetup: written by :CodeArtSetup. These values override the rest of this file. >>>
local codeart_setup = {
config = {
picker = "snacks",
},
}
-- <<< CodeArtSetup <<<
local M = {}
M.config = vim.tbl_extend("force", {}, { picker = "telescope" })
return require("codeart.setup").merge(M, codeart_setup)
Values in the block win over the rest of the file. Running :CodeArtSetup again updates the same block. To go back to a plain file, move the values where you want them and delete the block and the merge call.
If the file has a syntax error, the wizard stops without writing anything; fix the file first (:checkhealth codeart shows the error).
The theme setting¶
config.colorscheme is new in 2.5. It is applied after config.other_configs, so it wins over a vim.cmd("colorscheme ...") there. Leave it unset to keep choosing the theme in other_configs. See Themes.