chore(actions.create_project): now has a list over manually typing for

easier creation
This commit is contained in:
DarthMooMancer committed 2026-11-08 23:57:52 -05:00
1 parent adbd2bc0e9
commit 1c13c8cbe2
28 files changed
+1151 -929

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
module com.DarthMooMancer.test_2
go 1.27.3
+43 -43
View File
@@ -3,50 +3,50 @@ local actions = require("vern-nvim.core.actions")
---@type VernCoreConfig ---@type VernCoreConfig
return { return {
workspace_root = "~/personal/Projects", workspace_root = "~/personal/Projects",
env = { env = {
--- In documentation, make recommendation to change to username or name instead of company --- In documentation, make recommendation to change to username or name instead of company
author = "company", author = "company",
},
keybinds = {
["<leader>pc"] = {
user_command = "VernCreateProject",
desc = "Creates a new project",
action = actions.create_project,
}, },
keybinds = { ["<leader>pf"] = {
["<leader>pc"] = { user_command = "VernCreateFile",
user_command = "VernCreateProject", desc = "Creates a new project file based on current buffer filetype",
desc = "Creates a new project", action = actions.create_file,
action = actions.create_project,
},
["<leader>pf"] = {
user_command = "VernCreateFile",
desc = "Creates a new project file based on current buffer filetype",
action = actions.create_file,
},
["<leader>pr"] = {
user_command = "VernRunProject",
desc = "Builds and runs project based on current buffer filetype",
action = actions.run,
},
}, },
terminal = { ["<leader>pr"] = {
mode = { user_command = "VernRunProject",
type = "split", --- (float)|(split) desc = "Builds and runs project based on current buffer filetype",
win = { action = actions.run,
float = {
padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
},
border = {
enabled = true,
type = vim.o.winborder, -- defaults to neovim winborder
},
},
split = {
direction = "horizontal", --- (vertical)|(horizontal)
anchor = "bottom", --- (right)|(bottom)
size = "20",
},
},
},
}, },
},
terminal = {
mode = {
type = "split", --- (float)|(split)
win = {
float = {
padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
},
border = {
enabled = true,
type = vim.o.winborder, -- defaults to neovim winborder
},
},
split = {
direction = "horizontal", --- (vertical)|(horizontal)
anchor = "bottom", --- (right)|(bottom)
size = "20",
},
},
},
},
} }
+200 -195
View File
@@ -6,217 +6,222 @@ local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.template" ---@module "vern-nvim.core.template"
local templates = require("vern-nvim.core.template") local templates = require("vern-nvim.core.template")
---@module "vern-nvim.providers.web"
local providers = require("vern-nvim.providers.web")
---Imitate create_file so you can skip over and use for each filetype ---Imitate create_file so you can skip over and use for each filetype
M.create_project = function(opts) M.create_project = function(opts)
opts = opts or {} opts = opts or {}
vim.ui.input( local ft = ""
{ prompt = "Project language (e.g. python): ", completion = "filetype" }, local items = {
function(ft) "cpp",
ft = ft and vim.trim(ft) "c",
if not ft or vim.trim(ft) == "" then "rust",
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, { "python",
title = "Vern Project", "go",
}) "lua",
return "java",
end "web - not yet implemented",
local ok, langs = pcall(require, "vern-nvim.langs." .. ft) }
if not ok or type(langs) ~= "table" then return end vim.ui.select(items, {
local args = vim.tbl_deep_extend("force", {}, langs, opts or {}) prompt = "Select available language:",
if not args[ft] or type(args[ft]) ~= "table" then return end format_item = function(item) return item end,
vim.ui.input({ prompt = "Enter project name: " }, function(pname) }, function(choice, _)
pname = pname and vim.trim(pname) if choice then ft = vim.trim(choice) end
if not pname or pname == "" then return end local ok, langs = pcall(require, "vern-nvim.langs." .. ft)
local root = vim.fs.joinpath( if not ok or type(langs) ~= "table" then
vim.fn.expand(args.workspace_root), -- vim.notify("Empty or nil ft", vim.log.levels.WARN, {
args[ft].root, -- title = "Vern Project",
pname -- })
) return
end
local args = vim.tbl_deep_extend("force", {}, langs, opts or {})
if not args[ft] or type(args[ft]) ~= "table" then return end
if ft == "web" then
if type(langs.create_project) == "function" then
langs.create_project()
end
return
else
vim.ui.input({ prompt = "Enter project name: " }, function(pname)
pname = pname and vim.trim(pname)
if not pname or pname == "" then return end
local root = vim.fs.joinpath(
vim.fn.expand(args.workspace_root),
args[ft].root,
pname
)
local ctx = { local ctx = {
project_name = pname, project_name = pname,
company_name = args.env.author, company_name = args.env.author,
file_name = "", file_name = "",
} }
vim.fn.mkdir(root, "p") vim.fn.mkdir(root, "p")
local dirs = args[ft].dirs
local tpl = args[ft].templates or {} if type(dirs) == "table" and next(dirs) then
local dirs = args[ft].dirs for _, dir in pairs(dirs) do
if type(dirs) == "table" and next(dirs) then local path = vim.fs.normalize(
for _, dir in pairs(dirs) do vim.fs.joinpath(root, fs.fmt_path(dir, nil, ctx))
local path = vim.fs.normalize( )
vim.fs.joinpath(root, fs.fmt_path(dir, nil, ctx)) vim.fn.mkdir(path, "p")
) end
vim.fn.mkdir(path, "p")
end
end
local bin
local project = tpl.project
if type(project) == "table" and next(project) then
for tbl_name, tbl in pairs(project) do
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
local path = fs.fmt_path(raw_path, args[ft].dirs, ctx)
if tbl_name == "primary" then
bin = vim.fs.joinpath(root, path)
end
if tbl.kind then
local abs_file_path =
vim.fs.normalize(vim.fs.joinpath(root, path))
local abs_dir_path = vim.fs.dirname(abs_file_path)
if
abs_dir_path ~= root
and not vim.startswith(root, abs_dir_path)
then
vim.fn.mkdir(abs_dir_path, "p")
end
fs.write(
abs_file_path,
templates.fetch(tbl.kind_path, tbl.kind, ctx)
)
end
end
end
local extras = tpl.extras
if type(extras) == "table" and next(extras) then
for _, tbl in pairs(extras) do
if tbl.enabled ~= false and tbl.kind then
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
local path =
fs.fmt_path(raw_path, args[ft].dirs, ctx)
local abs_file_path =
vim.fs.normalize(vim.fs.joinpath(root, path))
local abs_dir_path = vim.fs.dirname(abs_file_path)
if
abs_dir_path ~= root
and not vim.startswith(root, abs_dir_path)
then
vim.fn.mkdir(abs_dir_path, "p")
end
fs.write(
abs_file_path,
templates.fetch(tbl.kind_path, tbl.kind, ctx)
)
end
end
end
if type(langs.create_project) == "function" then
langs.create_project(root)
end
--- Init git
local gitignore =
require("vern-nvim.templates.extras.gitignore").template(ft)
local obj = vim.system({ "git", "-C", root, "init" }):wait()
if obj.code ~= 0 then
vim.notify(
"Git init failed " .. obj.stderr,
vim.log.levels.ERROR,
{ title = "Vern Git" }
)
end
fs.write(vim.fs.joinpath(root, ".gitignore"), gitignore)
--- Init Readme
local readme = require("vern-nvim.templates.extras.readme")
fs.write(vim.fs.joinpath(root, "README.md"), readme)
if bin then vim.cmd.edit(vim.fn.fnameescape(bin)) end
vim.notify(
"Project: " .. pname .. " has been created!",
vim.log.levels.INFO,
{ title = "Vern Project" }
)
end)
end end
)
local function write(tpl)
if type(tpl) == "table" and next(tpl) then
for _, tbl in pairs(tpl) do
local raw_path = vim.fs.joinpath(tbl.path, tbl.name)
local path = fs.fmt_path(raw_path, args[ft].dirs, ctx)
if tbl.enabled ~= false and tbl.kind then
local abs_file_path =
vim.fs.normalize(vim.fs.joinpath(root, path))
local abs_dir_path = vim.fs.dirname(abs_file_path)
if
abs_dir_path ~= root
and not vim.startswith(root, abs_dir_path)
then
vim.fn.mkdir(abs_dir_path, "p")
end
fs.write(
abs_file_path,
templates.fetch(tbl.kind_path, tbl.kind, ctx)
)
end
end
end
end
local tpl = args[ft].templates or {}
local bin
local project = tpl.project
if type(project) == "table" and next(project) then
for tbl_name, tbl in pairs(project) do
if tbl_name == "primary" then
bin = vim.fs.joinpath(
root,
fs.fmt_path(
vim.fs.joinpath(tbl.path, tbl.name),
args[ft].dirs,
ctx
)
)
end
end
end
write(project)
write(tpl.extras)
if type(langs.create_project) == "function" then
langs.create_project(root)
end
--- Init git
local gitignore =
require("vern-nvim.templates.extras.gitignore").template(ft)
local obj = vim.system({ "git", "-C", root, "init" }):wait()
if obj.code ~= 0 then
vim.notify(
"Git init failed " .. obj.stderr,
vim.log.levels.ERROR,
{ title = "Vern Git" }
)
end
fs.write(vim.fs.joinpath(root, ".gitignore"), gitignore)
--- Init Readme
local readme = require("vern-nvim.templates.extras.readme")
fs.write(vim.fs.joinpath(root, "README.md"), readme)
if bin then vim.cmd.edit(vim.fn.fnameescape(bin)) end
vim.notify(
"Project: " .. pname .. " has been created!",
vim.log.levels.INFO,
{ title = "Vern Project" }
)
end)
end
end)
end end
M.create_file = function(opts) M.create_file = function(opts)
opts = opts or {} opts = opts or {}
local filetype = vim.bo.filetype local filetype = vim.bo.filetype
local ft_ok, config = pcall(require, "vern-nvim.langs." .. filetype) local ft_ok, config = pcall(require, "vern-nvim.langs." .. filetype)
if not filetype or filetype == "" or not ft_ok or type(config) ~= "table" then
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
title = "Vern File",
})
return
else
local args = vim.tbl_deep_extend("force", {}, config, opts or {})
---@type VernCreateFile ---@type VernCreateFile
if local cf = args.create_file
not filetype local function function_write(mod, fname)
or filetype == "" local raw_path = vim.fs.joinpath(mod.path, mod.name)
or not ft_ok local context = {
or type(config) ~= "table" project_name = fs.name(),
then company_name = args.env.author,
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, { file_name = fname,
title = "Vern File", }
}) local path = fs.fmt_path(raw_path, args[filetype].dirs or {}, context)
return local full_path = vim.fs.joinpath(fs.root(), path)
else fs.write(full_path, templates.fetch(mod.kind_path, mod.kind, context))
local args = vim.tbl_deep_extend("force", {}, config, opts or {}) vim.cmd.edit(vim.fn.fnameescape(full_path))
local cf = args.create_file vim.notify(
local function function_write(mod, fname) fname .. " has been created!",
local raw_path = vim.fs.joinpath(mod.path, mod.name) vim.log.levels.INFO,
local context = { { title = "Vern File" }
project_name = fs.name(), )
company_name = args.env.author,
file_name = fname,
}
local path =
fs.fmt_path(raw_path, args[filetype].dirs or {}, context)
local full_path = vim.fs.joinpath(fs.root(), path)
fs.write(
full_path,
templates.fetch(mod.kind_path, mod.kind, context)
)
vim.cmd.edit(vim.fn.fnameescape(full_path))
vim.notify(
fname .. " has been created!",
vim.log.levels.INFO,
{ title = "Vern File" }
)
end
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
fname = fname and vim.trim(fname)
if not fname or fname == "" then return end
local done = function(mod)
if not mod or vim.tbl_isempty(mod) then return end
function_write(mod, fname)
end
if cf and type(cf) == "function" then
cf(args, done)
else
done(args[filetype].templates.file.source)
end
end)
end end
vim.ui.input({ prompt = "Enter file name: " }, function(fname)
fname = fname and vim.trim(fname)
if not fname or fname == "" then return end
local done = function(mod)
if not mod or vim.tbl_isempty(mod) then return end
function_write(mod, fname)
end
if cf and type(cf) == "function" then
cf(args, done)
else
done(args[filetype].templates.file.source)
end
end)
end
end end
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
local filetype = vim.bo.filetype local filetype = vim.bo.filetype
local ft_ok, action = pcall(require, "vern-nvim.langs." .. filetype) local ft_ok, action = pcall(require, "vern-nvim.langs." .. filetype)
if if
not filetype not filetype
or filetype == "" or filetype == ""
or not ft_ok or not ft_ok
or type(action.run) ~= "function" or type(action.run) ~= "function"
then then
vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, { vim.notify("Unknown Filetype: " .. filetype, vim.log.levels.WARN, {
title = "Vern Run", title = "Vern Run",
}) })
return return
else else
local args = vim.tbl_deep_extend( local args = vim.tbl_deep_extend(
"force", "force",
{}, {},
opts, opts,
require("vern-nvim.langs." .. filetype) require("vern-nvim.langs." .. filetype)
) )
action.run(args) action.run(args)
end end
end end
return M return M
+16 -23
View File
@@ -7,29 +7,22 @@ local term = require("vern-nvim.core.terminal")
---@param build_cmd string ---@param build_cmd string
---@param run_cmd string ---@param run_cmd string
M.compile = function(opts, build_cmd, run_cmd) M.compile = function(opts, build_cmd, run_cmd)
vim.system({ "sh", "-c", build_cmd }, { text = true }, function(obj) vim.system({ "sh", "-c", build_cmd }, { text = true }, function(obj)
if obj.code ~= 0 then if obj.code ~= 0 then
vim.schedule(function() vim.schedule(function()
local error_obj = (obj.stderr ~= "" and obj.stderr) local error_obj = (obj.stderr ~= "" and obj.stderr) or obj.stdout or ""
or obj.stdout local error_lines = vim.list_extend(
or "" { "Error During compilation" },
local error_lines = vim.list_extend( vim.split(error_obj, "\n", { trimempty = true })
{ "Error During compilation" }, )
vim.split(error_obj, "\n", { trimempty = true }) local buf, _ =
) term.open({ "echo 'compilation failed'" }, opts.terminal, true)
local buf, _ = term.open( term.set_lines(buf, error_lines)
{ "echo 'compilation failed'" }, end)
opts.terminal, else
true vim.schedule(function() term.open({ run_cmd }, opts.terminal, false) end)
) end
term.set_lines(buf, error_lines) end)
end)
else
vim.schedule(
function() term.open({ run_cmd }, opts.terminal, false) end
)
end
end)
end end
return M return M
+25 -25
View File
@@ -5,45 +5,45 @@ local M = {}
---@param ctx table<string, string> Strings to replace raw names like {project_name} with ---@param ctx table<string, string> Strings to replace raw names like {project_name} with
---@return string path Fully replaced path ---@return string path Fully replaced path
function M.fmt_path(raw_path, dir_tbl, ctx) function M.fmt_path(raw_path, dir_tbl, ctx)
--- Replace the {dirs.<key>} --- Replace the {dirs.<key>}
raw_path = raw_path:gsub( raw_path = raw_path:gsub(
"{dirs%.([%w_]+)}", "{dirs%.([%w_]+)}",
function(dir_key) return dir_tbl and dir_tbl[dir_key] or dir_key end function(dir_key) return dir_tbl and dir_tbl[dir_key] or dir_key end
) )
--- Replace the {<key>} --- Replace the {<key>}
local path = raw_path:gsub( local path = raw_path:gsub(
"{([%w_]+)}", "{([%w_]+)}",
function(key) return ctx and ctx[key] or ("{" .. key .. "}") end function(key) return ctx and ctx[key] or ("{" .. key .. "}") end
) )
return path return path
end end
---@param path string ---@param path string
---@param content string ---@param content string
function M.write(path, content) function M.write(path, content)
local file = assert(io.open(path, "w"), "Error creating file: " .. path) local file = assert(io.open(path, "w"), "Error creating file: " .. path)
file:write(content) file:write(content)
file:close() file:close()
end end
---@return string ---@return string
function M.name() return vim.fs.basename(M.proj_root()) or "" end function M.name() return vim.fs.basename(M.root()) or "" end
---@param bufnr? integer Default is 0 (current buffer) ---@param bufnr? integer Default is 0 (current buffer)
---@return string ---@return string
function M.root(bufnr) function M.root(bufnr)
bufnr = bufnr or 0 bufnr = bufnr or 0
local root_markers = { local root_markers = {
".git", ".git",
"pyproject.toml", "pyproject.toml",
"setup.py", "setup.py",
"Makefile", "Makefile",
"CMakeLists", "CMakeLists",
"Cargo.toml", "Cargo.toml",
} }
return vim.fs.root(bufnr, root_markers) or vim.uv.cwd() or "." return vim.fs.root(bufnr, root_markers) or vim.uv.cwd() or "."
end end
return M return M
+15 -21
View File
@@ -1,9 +1,9 @@
local M = {} local M = {}
local registers = { local registers = {
project_name = "__PROJECT_NAME__", project_name = "__PROJECT_NAME__",
company_name = "__COMPANY_NAME__", company_name = "__COMPANY_NAME__",
file_name = "__FILE_NAME__", file_name = "__FILE_NAME__",
} }
---@param kind_path string Filetype of template ---@param kind_path string Filetype of template
@@ -11,27 +11,21 @@ local registers = {
---@param context table<string, string> A string to replace temp values in template ---@param context table<string, string> A string to replace temp values in template
---@return string Content Formatted string ---@return string Content Formatted string
function M.fetch(kind_path, kind, context) function M.fetch(kind_path, kind, context)
kind, context = kind or "", context or {} kind, context = kind or "", context or {}
if not kind or kind == "" then if not kind or kind == "" then return "" end
return "" local ok, mod = pcall(require, kind_path)
end if not ok or type(mod) ~= "table" or not mod[kind] then return "" end
local ok, mod = pcall(require, kind_path)
if not ok or type(mod) ~= "table" or not mod[kind] then
return ""
end
local template = mod[kind] or "" local template = mod[kind] or ""
context = context or {} context = context or {}
if ok and type(mod) == "table" then if ok and type(mod) == "table" then
for key, placeholder in pairs(registers) do for key, placeholder in pairs(registers) do
local value = context[key] local value = context[key]
if value then if value then template = string.gsub(template, placeholder, value) end
template = string.gsub(template, placeholder, value)
end
end
end end
return template end
return template
end end
return M return M
+76 -76
View File
@@ -5,92 +5,92 @@ local M = {}
---@param scratch boolean ---@param scratch boolean
---@return integer, integer? ---@return integer, integer?
function M.open(cmd, opts, scratch) function M.open(cmd, opts, scratch)
opts = opts or {} opts = opts or {}
local buf, win local buf, win
if opts.mode.type == "float" then if opts.mode.type == "float" then
local ui = vim.api.nvim_list_uis()[1] local ui = vim.api.nvim_list_uis()[1]
local dim = { local dim = {
width = math.max( width = math.max(
1, 1,
math.floor(ui.width * 0.9) math.floor(ui.width * 0.9)
- opts.mode.win.float.padding.left - opts.mode.win.float.padding.left
- opts.mode.win.float.padding.right - opts.mode.win.float.padding.right
), ),
height = math.max( height = math.max(
1, 1,
math.floor(ui.height * 0.9) math.floor(ui.height * 0.9)
- opts.mode.win.float.padding.top - opts.mode.win.float.padding.top
- opts.mode.win.float.padding.bottom - opts.mode.win.float.padding.bottom
), ),
} }
local pos = { local pos = {
row = math.floor( row = math.floor(
( (
ui.height ui.height
- (vim.o.laststatus == 3 and 1 or 0) - (vim.o.laststatus == 3 and 1 or 0)
- vim.o.cmdheight - vim.o.cmdheight
- dim.height - dim.height
) / 2 ) / 2
), ),
col = math.floor((ui.width - dim.width) / 2), col = math.floor((ui.width - dim.width) / 2),
} }
buf = vim.api.nvim_create_buf(false, true) buf = vim.api.nvim_create_buf(false, true)
win = vim.api.nvim_open_win(buf, true, { win = vim.api.nvim_open_win(buf, true, {
relative = "editor", relative = "editor",
width = dim.width, width = dim.width,
height = dim.height, height = dim.height,
row = pos.row, row = pos.row,
col = pos.col, col = pos.col,
style = "minimal", style = "minimal",
border = opts.mode.win.float.border.enabled border = opts.mode.win.float.border.enabled
and opts.mode.win.float.border.type and opts.mode.win.float.border.type
or nil, or nil,
}) })
if scratch then return buf, win end if scratch then return buf, win end
end
if opts.mode.type == "split" then
if opts.mode.win.split.direction == "vertical" then
if opts.mode.win.split.anchor == "right" then
vim.cmd("set splitright")
end
vim.cmd(opts.mode.win.split.size .. " vsplit")
end end
if opts.mode.type == "split" then if opts.mode.win.split.direction == "horizontal" then
if opts.mode.win.split.direction == "vertical" then if opts.mode.win.split.anchor == "bottom" then
if opts.mode.win.split.anchor == "right" then vim.cmd("set splitbelow")
vim.cmd("set splitright") end
end vim.cmd(opts.mode.win.split.size .. " split")
vim.cmd(opts.mode.win.split.size .. " vsplit")
end
if opts.mode.win.split.direction == "horizontal" then
if opts.mode.win.split.anchor == "bottom" then
vim.cmd("set splitbelow")
end
vim.cmd(opts.mode.win.split.size .. " split")
end
buf = vim.api.nvim_create_buf(false, true)
win = vim.api.nvim_get_current_win()
vim.api.nvim_win_set_buf(0, buf)
if scratch then return buf, win end
end end
local full_cmd = type(cmd) == "table" and table.concat(cmd, " ") or cmd
vim.fn.jobstart(full_cmd, { term = true }) buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_buf_set_keymap( win = vim.api.nvim_get_current_win()
buf,
"n", vim.api.nvim_win_set_buf(0, buf)
"<ESC>", if scratch then return buf, win end
"i<C-\\><C-n>:q<CR>", end
{ noremap = true, silent = true } local full_cmd = type(cmd) == "table" and table.concat(cmd, " ") or cmd
) vim.fn.jobstart(full_cmd, { term = true })
return buf, win vim.api.nvim_buf_set_keymap(
buf,
"n",
"<ESC>",
"i<C-\\><C-n>:q<CR>",
{ noremap = true, silent = true }
)
return buf, win
end end
---@param buf integer ---@param buf integer
---@param lines table ---@param lines table
function M.set_lines(buf, lines) function M.set_lines(buf, lines)
if buf and vim.api.nvim_buf_is_valid(buf) then if buf and vim.api.nvim_buf_is_valid(buf) then
vim.api.nvim_set_option_value("modifiable", true, { buf = buf }) vim.api.nvim_set_option_value("modifiable", true, { buf = buf })
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines) vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
vim.api.nvim_set_option_value("modifiable", false, { buf = buf }) vim.api.nvim_set_option_value("modifiable", false, { buf = buf })
end end
end end
return M return M
+48 -58
View File
@@ -6,70 +6,60 @@ local defaults = require("vern-nvim.config.defaults")
---@type VernCoreConfig ---@type VernCoreConfig
M.opts = vim.deepcopy(defaults) M.opts = vim.deepcopy(defaults)
---@class VernUserConfig
---@field workspace_root? string
---@field keybinds? table<string, VernKeybindItem>
---@field terminal? VernTerminalConfig | table
---@param user_opts? VernUserConfig ---@param user_opts? VernUserConfig
function M.setup(user_opts) function M.setup(user_opts)
---@type VernCoreConfig ---@type VernCoreConfig
M.opts = vim.tbl_deep_extend("force", {}, defaults, user_opts or {}) M.opts = vim.tbl_deep_extend("force", {}, defaults, user_opts or {})
for key, def in pairs(M.opts.keybinds or {}) do for key, def in pairs(M.opts.keybinds or {}) do
if type(def.action) == "function" then if type(def.action) == "function" then
vim.api.nvim_create_user_command( vim.api.nvim_create_user_command(
def.user_command, def.user_command,
function() def.action(M.opts) end, function() def.action(M.opts) end,
{ nargs = "*", desc = def.desc } { nargs = "*", desc = def.desc }
) )
vim.keymap.set("n", key, function() def.action(M.opts) end, { vim.keymap.set("n", key, function() def.action(M.opts) end, {
silent = true, silent = true,
desc = def.desc, desc = def.desc,
}) })
end
end end
end
local group = local group =
vim.api.nvim_create_augroup("VernAutocommands", { clear = true }) vim.api.nvim_create_augroup("VernAutocommands", { clear = true })
vim.api.nvim_create_autocmd("FileType", { vim.api.nvim_create_autocmd("FileType", {
group = group, group = group,
pattern = "*", pattern = "*",
callback = function(args) callback = function(args)
local ft = vim.bo[args.buf].filetype local ft = vim.bo[args.buf].filetype
if not ft or ft == "" then return end if not ft or ft == "" then return end
local ok, mod = pcall(require, "vern-nvim.langs." .. ft) local ok, mod = pcall(require, "vern-nvim.langs." .. ft)
if not ok then return end if not ok then return end
local opts = vim.tbl_deep_extend("force", {}, mod, M.opts or {}) local opts = vim.tbl_deep_extend("force", {}, mod, M.opts or {})
if opts[ft] and opts[ft].keybinds ~= nil then if opts[ft] and opts[ft].keybinds ~= nil then
for key, def in pairs(opts[ft].keybinds or {}) do for key, def in pairs(opts[ft].keybinds or {}) do
if type(def.action) == "function" then if type(def.action) == "function" then
vim.api.nvim_buf_create_user_command( vim.api.nvim_buf_create_user_command(
args.buf, args.buf,
def.user_command, def.user_command,
function() def.action(opts) end, function() def.action(opts) end,
{ nargs = "*", desc = def.desc } { nargs = "*", desc = def.desc }
) )
vim.keymap.set( vim.keymap.set("n", key, function() def.action(opts) end, {
"n", buffer = args.buf,
key, silent = true,
function() def.action(opts) end, desc = def.desc,
{ })
buffer = args.buf, end
silent = true, end
desc = def.desc, end
} if ok and type(mod.attach) == "function" then
) mod.attach(args.buf, opts)
end end
end end,
end desc = "Attach languages to buffer",
if ok and type(mod.attach) == "function" then })
mod.attach(args.buf, opts)
end
end,
desc = "Attach languages to buffer",
})
end end
return M return M
+70 -70
View File
@@ -1,5 +1,5 @@
---@module "vern-nvim.core.fs" ---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.fs") local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.compile" ---@module "vern-nvim.core.compile"
local comp = require("vern-nvim.core.compile") local comp = require("vern-nvim.core.compile")
@@ -10,92 +10,92 @@ M.attach = nil
---@param root string ---@param root string
M.create_project = function(root) M.create_project = function(root)
local build_cmd = "cd " local build_cmd = "cd "
.. root .. root
.. " && cmake -S . -B build && cmake --build build" .. " && cmake -S . -B build && cmake --build build"
local _ = vim.system({ "sh", "-c", build_cmd }):wait() local _ = vim.system({ "sh", "-c", build_cmd }):wait()
end end
---@type VernCreateFile ---@type VernCreateFile
---@param opts VernCConfig ---@param opts VernCConfig
M.create_file = function(opts, continue) M.create_file = function(opts, continue)
opts = opts or {} opts = opts or {}
local file = vim.tbl_get(opts, "c", "templates", "file") local file = vim.tbl_get(opts, "c", "templates", "file")
local items = { "source", "header" } local items = { "source", "header" }
vim.ui.select(items, { vim.ui.select(items, {
prompt = "Select type:", prompt = "Select type:",
format_item = function(item) return item end, format_item = function(item) return item end,
}, function(choice, _) }, function(choice, _)
if choice == items[1] then return continue(file.source) end if choice == items[1] then return continue(file.source) end
if choice == items[2] then return continue(file.header) end if choice == items[2] then return continue(file.header) end
continue(nil) continue(nil)
end) end)
end end
---@param opts? VernCConfig Takes a table for the runtime ---@param opts? VernCConfig Takes a table for the runtime
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
local build_dir = vim.fn.fnameescape((fs.root() or ".") .. "/build") local build_dir = vim.fn.fnameescape(fs.root() .. "/build")
local build_cmd = string.format("cd %s && cmake --build .", build_dir) local build_cmd = string.format("cd %s && cmake --build .", build_dir)
local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name()) local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name())
comp.compile(opts, build_cmd, run_cmd) comp.compile(opts, build_cmd, run_cmd)
end end
---@type VernLanguageConfig ---@type VernLanguageConfig
M.c = { M.c = {
root = "C", root = "C",
dirs = { dirs = {
src = "src", src = "src",
include = "include/{project_name}", include = "include/{project_name}",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.c",
kind = "main",
kind_path = "vern-nvim.templates.c",
},
manifest = {
path = ".",
name = "CMakeLists.txt",
kind = "CmakeLists",
kind_path = "vern-nvim.templates.c",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.c",
},
}, },
keybinds = nil, file = {
templates = { header = {
project = { path = "{dirs.include}",
primary = { name = "{file_name}.h",
path = "{dirs.src}", kind = "header",
name = "main.c", kind_path = "vern-nvim.templates.c",
kind = "main", },
kind_path = "vern-nvim.templates.c", source = {
}, path = "{dirs.src}",
manifest = { name = "{file_name}.c",
path = ".", kind = "source",
name = "CMakeLists.txt", kind_path = "vern-nvim.templates.c",
kind = "CmakeLists", },
kind_path = "vern-nvim.templates.c",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.c",
},
},
file = {
header = {
path = "{dirs.include}",
name = "{file_name}.h",
kind = "header",
kind_path = "vern-nvim.templates.c",
},
source = {
path = "{dirs.src}",
name = "{file_name}.c",
kind = "source",
kind_path = "vern-nvim.templates.c",
},
},
extras = {
linter = {
path = ".",
name = ".clang-tidy",
kind = "linter",
kind_path = "vern-nvim.templates.c",
enabled = false,
},
},
}, },
extras = {
linter = {
path = ".",
name = ".clang-tidy",
kind = "linter",
kind_path = "vern-nvim.templates.c",
enabled = false,
},
},
},
} }
return M return M
+69 -69
View File
@@ -10,92 +10,92 @@ M.attach = nil
---@param root string ---@param root string
M.create_project = function(root) M.create_project = function(root)
local build_cmd = "cd " local build_cmd = "cd "
.. root .. root
.. " && cmake -S . -B build && cmake --build build" .. " && cmake -S . -B build && cmake --build build"
local _ = vim.system({ "sh", "-c", build_cmd }):wait() local _ = vim.system({ "sh", "-c", build_cmd }):wait()
end end
---@type VernCreateFile ---@type VernCreateFile
---@param opts VernCPPConfig ---@param opts VernCPPConfig
M.create_file = function(opts, continue) M.create_file = function(opts, continue)
opts = opts or {} opts = opts or {}
local file = vim.tbl_get(opts, "cpp", "templates", "file") local file = vim.tbl_get(opts, "cpp", "templates", "file")
local items = { "source", "header" } local items = { "source", "header" }
vim.ui.select(items, { vim.ui.select(items, {
prompt = "Select type:", prompt = "Select type:",
format_item = function(item) return item end, format_item = function(item) return item end,
}, function(choice, _) }, function(choice, _)
if choice == items[1] then return continue(file.source) end if choice == items[1] then return continue(file.source) end
if choice == items[2] then return continue(file.header) end if choice == items[2] then return continue(file.header) end
continue(nil) continue(nil)
end) end)
end end
---@param opts? VernCPPConfig Takes a table for the runtime ---@param opts? VernCPPConfig Takes a table for the runtime
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
local build_dir = vim.fn.fnameescape((fs.root() or ".") .. "/build") local build_dir = vim.fn.fnameescape(fs.root() .. "/build")
local build_cmd = string.format("cd %s && cmake --build .", build_dir) local build_cmd = string.format("cd %s && cmake --build .", build_dir)
local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name()) local run_cmd = string.format("cd %s && ./%s", build_dir, fs.name())
comp.compile(opts, build_cmd, run_cmd) comp.compile(opts, build_cmd, run_cmd)
end end
---@type VernLanguageConfig ---@type VernLanguageConfig
M.cpp = { M.cpp = {
root = "CPP", root = "CPP",
dirs = { dirs = {
src = "src", src = "src",
include = "include/{project_name}", include = "include/{project_name}",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.cpp",
kind = "main",
kind_path = "vern-nvim.templates.cpp",
},
manifest = {
path = ".",
name = "CMakeLists.txt",
kind = "CmakeLists",
kind_path = "vern-nvim.templates.cpp",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.cpp",
},
}, },
keybinds = nil, file = {
templates = { header = {
project = { path = "{dirs.include}",
primary = { name = "{file_name}.hpp",
path = "{dirs.src}", kind = "header",
name = "main.cpp", kind_path = "vern-nvim.templates.cpp",
kind = "main", },
kind_path = "vern-nvim.templates.cpp", source = {
}, path = "{dirs.src}",
manifest = { name = "{file_name}.cpp",
path = ".", kind = "source",
name = "CMakeLists.txt", kind_path = "vern-nvim.templates.cpp",
kind = "CmakeLists", },
kind_path = "vern-nvim.templates.cpp",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.cpp",
},
},
file = {
header = {
path = "{dirs.include}",
name = "{file_name}.hpp",
kind = "header",
kind_path = "vern-nvim.templates.cpp",
},
source = {
path = "{dirs.src}",
name = "{file_name}.cpp",
kind = "source",
kind_path = "vern-nvim.templates.cpp",
},
},
extras = {
linter = {
path = ".",
name = ".clang-tidy",
kind = "linter",
kind_path = "vern-nvim.templates.cpp",
enabled = false,
},
},
}, },
extras = {
linter = {
path = ".",
name = ".clang-tidy",
kind = "linter",
kind_path = "vern-nvim.templates.cpp",
enabled = false,
},
},
},
} }
return M return M
+77
View File
@@ -0,0 +1,77 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
local M = {}
M.attach = nil
M.create_project = function(root)
local obj = vim
.system({
"go",
"mod",
"init",
"com.DarthMooMancer." .. vim.fs.basename(root),
})
:wait()
if obj.code ~= 0 then
vim.notify(
"Go init failed" .. obj.stderr,
vim.log.levels.ERROR,
{ title = "Vern Go" }
)
end
end
---@type VernCreateFile
M.create_file = nil
---@param opts VernPythonConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
local root = fs.root()
-- local context = {
-- project_name = fs.name(),
-- company_name = opts.env.author,
-- file_name = "",
-- }
-- local bin = vim.tbl_get(opts.python.templates.project.primary)
--
-- local exe = vim.fs.joinpath(bin.path, bin.name)
-- local exe_path = fs.fmt_path(exe, opts.python.dirs, context)
-- local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
term.open({ "go run ", root .. "/main.go" }, opts.terminal or {}, false)
end
---@type VernLanguageConfig
M.go = {
root = "Go",
dirs = {
src = "",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "main.go",
kind = "main",
kind_path = "vern-nvim.templates.go",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.go",
kind = "module",
kind_path = "vern-nvim.templates.go",
},
},
extras = nil,
},
}
return M
+54 -54
View File
@@ -15,67 +15,67 @@ M.create_file = nil
---@param opts VernJavaConfig Takes a table for the runtime ---@param opts VernJavaConfig Takes a table for the runtime
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
local root = fs.root() local root = fs.root()
local context = { local context = {
project_name = fs.name()(), project_name = fs.name(),
company_name = opts.env.author, company_name = opts.env.author,
file_name = "", file_name = "",
} }
local src_root = vim.fs.joinpath( local src_root = vim.fs.joinpath(
root, root,
fs.fmt_path(opts.java.dirs.src, opts.java.dirs, context) fs.fmt_path(opts.java.dirs.src, opts.java.dirs, context)
) )
local build_dir = root .. "/bin" local build_dir = root .. "/bin"
local build_cmd = string.format( local build_cmd = string.format(
"javac -d %s -sourcepath %s $(find %s -name '*java')", "javac -d %s -sourcepath %s $(find %s -name '*java')",
build_dir, build_dir,
src_root, src_root,
src_root src_root
) )
local run_cmd = string.format( local run_cmd = string.format(
"java -cp %s com.%s.%s.Main", "java -cp %s com.%s.%s.Main",
build_dir, build_dir,
context.company_name, context.company_name,
context.project_name context.project_name
) )
comp.compile(opts, build_cmd, run_cmd) comp.compile(opts, build_cmd, run_cmd)
end end
---@type VernLanguageConfig ---@type VernLanguageConfig
M.java = { M.java = {
root = "Java", root = "Java",
dirs = { dirs = {
src = "src/com/{company_name}/{project_name}", src = "src/com/{company_name}/{project_name}",
bin = "bin", bin = "bin",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "Main.java",
kind = "main",
kind_path = "vern-nvim.templates.java",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.java",
},
}, },
keybinds = nil, file = {
templates = { source = {
project = { path = "{dirs.src}",
primary = { name = "{file_name}.java",
path = "{dirs.src}", kind = "source",
name = "Main.java", kind_path = "vern-nvim.templates.java",
kind = "main", },
kind_path = "vern-nvim.templates.java",
},
style = {
path = ".",
name = ".clang-format",
kind = "format",
kind_path = "vern-nvim.templates.java",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.java",
kind = "source",
kind_path = "vern-nvim.templates.java",
},
},
extras = nil,
}, },
extras = nil,
},
} }
return M return M
+33 -33
View File
@@ -1,5 +1,5 @@
---@module "vern-nvim.core.fs" ---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.fs") local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal" ---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal") local term = require("vern-nvim.core.terminal")
@@ -15,45 +15,45 @@ M.create_file = nil
---@param opts VernLuaConfig Takes a table for the runtime ---@param opts VernLuaConfig Takes a table for the runtime
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
term.open({ term.open({
"lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"), "lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"),
}, opts.terminal or {}, false) }, opts.terminal or {}, false)
end end
---@type VernLanguageConfig ---@type VernLanguageConfig
M.lua = { M.lua = {
root = "Lua", root = "Lua",
dirs = { dirs = {
src = "lua/{project_name}", src = "lua/{project_name}",
},
keybinds = nil,
templates = {
project = {
primary = {
path = "{dirs.src}",
name = "init.lua",
kind = "main",
kind_path = "vern-nvim.templates.lua",
},
style = {
path = ".",
name = "stylua.toml",
kind = "format",
kind_path = "vern-nvim.templates.lua",
},
}, },
keybinds = nil, file = {
templates = { source = {
project = { path = "{dirs.src}",
primary = { name = "{file_name}.lua",
path = "{dirs.src}", kind = "source",
name = "init.lua", kind_path = "vern-nvim.templates.lua",
kind = "init", },
kind_path = "vern-nvim.templates.lua",
},
style = {
path = ".",
name = "stylua.toml",
kind = "format",
kind_path = "vern-nvim.templates.lua",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.lua",
kind = "source",
kind_path = "vern-nvim.templates.lua",
},
},
extras = nil,
}, },
extras = nil,
},
} }
return M return M
+102 -103
View File
@@ -1,5 +1,5 @@
---@module "vern-nvim.core.fs" ---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.fs") local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal" ---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal") local term = require("vern-nvim.core.terminal")
@@ -7,30 +7,30 @@ local term = require("vern-nvim.core.terminal")
local M = {} local M = {}
M.attach = function() M.attach = function()
local root = fs.root() local root = fs.root()
if not root then return end if not root then return end
local venv_dir = nil local venv_dir = nil
if vim.uv.fs_stat(root .. "/venv/bin/python") then if vim.uv.fs_stat(root .. "/venv/bin/python") then
venv_dir = root .. "/venv" venv_dir = root .. "/venv"
elseif vim.uv.fs_stat(root .. "/.venv/bin/python") then elseif vim.uv.fs_stat(root .. "/.venv/bin/python") then
venv_dir = root .. "/.venv" venv_dir = root .. "/.venv"
end end
if venv_dir then if venv_dir then
vim.env.VIRTUAL_ENV = venv_dir vim.env.VIRTUAL_ENV = venv_dir
vim.env.PATH = venv_dir .. "/bin:" .. vim.env.PATH vim.env.PATH = venv_dir .. "/bin:" .. vim.env.PATH
end end
end end
---@param root string ---@param root string
M.create_project = function(root) M.create_project = function(root)
local obj = vim.system({ "python3", "-m", "venv", root .. "/venv" }):wait() local obj = vim.system({ "python3", "-m", "venv", root .. "/venv" }):wait()
if obj.code ~= 0 then if obj.code ~= 0 then
vim.notify( vim.notify(
"Virtual environment failed to initialize " .. obj.stderr, "Virtual environment failed to initialize " .. obj.stderr,
vim.log.levels.ERROR, vim.log.levels.ERROR,
{ title = "Vern Python" } { title = "Vern Python" }
) )
end end
end end
---@type VernCreateFile ---@type VernCreateFile
@@ -38,102 +38,101 @@ M.create_file = nil
---@param opts VernPythonConfig Takes a table for the runtime ---@param opts VernPythonConfig Takes a table for the runtime
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
local root = fs.root() or "." local root = fs.root()
local context = { local context = {
project_name = fs.name(), project_name = fs.name(),
company_name = opts.env.author, company_name = opts.env.author,
file_name = "", file_name = "",
} }
local bin = opts.python.templates.project.primary local bin = vim.tbl_get(opts.python.templates.project.primary)
local exe = vim.fs.joinpath(bin.path, bin.name) local exe = vim.fs.joinpath(bin.path, bin.name)
or "src/{project_name}/main.py" local exe_path = fs.fmt_path(exe, opts.python.dirs, context)
local exe_path = fs.fmt_path(exe, opts.python.dirs, context) local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
local full_path = vim.fs.joinpath(vim.fn.expand(root), exe_path)
term.open({ "python3 " .. full_path }, opts.terminal or {}, false) term.open({ "python3 " .. full_path }, opts.terminal or {}, false)
end end
M.pip_install = function() M.pip_install = function()
vim.ui.input({ prompt = "Enter pip module: " }, function(mod) vim.ui.input({ prompt = "Enter pip module: " }, function(mod)
mod = mod and vim.trim(mod) mod = mod and vim.trim(mod)
if not mod or mod == "" then if not mod or mod == "" then
vim.notify( vim.notify(
"Pip Cancelled", "Pip Cancelled",
vim.log.levels.WARN, vim.log.levels.WARN,
{ title = "Vern Python" } { title = "Vern Python" }
) )
return return
end end
vim.notify( vim.notify(
"Installing " .. mod, "Installing " .. mod,
vim.log.levels.INFO,
{ title = "Vern Python" }
)
vim.system({ "pip", "install", mod }, { text = true }, function(obj)
vim.schedule(function()
if obj.code ~= 0 then
vim.notify(
"Pip failed: " .. obj.stderr,
vim.log.levels.WARN,
{ title = "Vern Python" }
)
else
vim.notify(
"Pip installed " .. mod,
vim.log.levels.INFO, vim.log.levels.INFO,
{ title = "Vern Python" } { title = "Vern Python" }
) )
vim.system({ "pip", "install", mod }, { text = true }, function(obj) end
vim.schedule(function() end)
if obj.code ~= 0 then
vim.notify(
"Pip failed: " .. obj.stderr,
vim.log.levels.WARN,
{ title = "Vern Python" }
)
else
vim.notify(
"Pip installed " .. mod,
vim.log.levels.INFO,
{ title = "Vern Python" }
)
end
end)
end)
end) end)
end)
end end
---@type VernLanguageConfig ---@type VernLanguageConfig
M.python = { M.python = {
root = "Python", root = "Python",
dirs = { dirs = {
src = "src/{project_name}", src = "src/{project_name}",
},
keybinds = {
["<leader>pi"] = {
user_command = "VernPythonPip",
desc = "Install python packages for environment",
action = M.pip_install,
}, },
keybinds = { },
["<leader>pi"] = { templates = {
user_command = "VernPythonPip", project = {
desc = "Install python packages for environment", primary = {
action = M.pip_install, path = "{dirs.src}",
}, name = "main.py",
kind = "main",
kind_path = "vern-nvim.templates.python",
},
manifest = {
path = ".",
name = "pyproject.toml",
kind = "pyproject",
kind_path = "vern-nvim.templates.python",
},
pkg_init = {
path = "{dirs.src}",
name = "__init__.py",
kind = "__init__",
kind_path = "vern-nvim.templates.python",
},
}, },
templates = { file = {
project = { source = {
primary = { path = "{dirs.src}",
path = "{dirs.src}", name = "{file_name}.py",
name = "main.py", kind = "module",
kind = "main", kind_path = "vern-nvim.templates.python",
kind_path = "vern-nvim.templates.python", },
},
manifest = {
path = ".",
name = "pyproject.toml",
kind = "pyproject",
kind_path = "vern-nvim.templates.python",
},
pkg_init = {
path = "{dirs.src}",
name = "__init__.py",
kind = "__init__",
kind_path = "vern-nvim.templates.python",
},
},
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.py",
kind = "module",
kind_path = "vern-nvim.templates.python",
},
},
extras = nil,
}, },
extras = nil,
},
} }
return M return M
+35 -33
View File
@@ -1,5 +1,5 @@
---@module "vern-nvim.core.fs" ---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.fs") local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal" ---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal") local term = require("vern-nvim.core.terminal")
@@ -9,17 +9,19 @@ local M = {}
M.attach = nil M.attach = nil
M.create_project = function(root) M.create_project = function(root)
local obj = vim.system({ local obj = vim
"cargo", .system({
"init", "cargo",
vim.fn.expand(root), "init",
"--name", vim.fn.expand(root),
vim.fs.basename(root), "--name",
}):wait() vim.fs.basename(root),
})
:wait()
if obj.code ~= 0 then if obj.code ~= 0 then
vim.notify("Cargo init failed:" .. obj.stderr, vim.log.levels.ERROR) vim.notify("Cargo init failed:" .. obj.stderr, vim.log.levels.ERROR)
end end
end end
---@type VernCreateFile ---@type VernCreateFile
@@ -27,33 +29,33 @@ M.create_file = nil
---@param opts VernRustConfig Takes a table for the runtime ---@param opts VernRustConfig Takes a table for the runtime
M.run = function(opts) M.run = function(opts)
opts = opts or {} opts = opts or {}
term.open( term.open(
{ "cd " .. fs.root() .. " && cargo run" }, { "cd " .. fs.root() .. " && cargo run" },
opts.terminal or {}, opts.terminal or {},
false false
) )
end end
---@type VernLanguageConfig ---@type VernLanguageConfig
M.rust = { M.rust = {
root = "Rust", root = "Rust",
dirs = nil, dirs = nil,
keybinds = nil, keybinds = nil,
templates = { templates = {
project = { project = {
primary = { path = "src", name = "main.rs" }, primary = { path = "src", name = "main.rs" },
},
file = {
source = {
path = "src",
name = "{file_name}.rs",
kind = "source",
kind_path = "vern-nvim.templates.rust",
},
},
extras = nil,
}, },
file = {
source = {
path = "src",
name = "{file_name}.rs",
kind = "source",
kind_path = "vern-nvim.templates.rust",
},
},
extras = nil,
},
} }
return M return M
+59
View File
@@ -0,0 +1,59 @@
---@module "vern-nvim.core.fs"
local fs = require("vern-nvim.core.fs")
---@module "vern-nvim.core.terminal"
local term = require("vern-nvim.core.terminal")
---@module "vern-nvim.providers.web"
local providers = require("vern-nvim.providers.web")
local M = {}
M.attach = nil
M.create_project = function(opts, continue)
opts = opts or {}
local provider = vim.tbl_get(opts, "web", "providers")
if vim.trim(provider) == "bun" then
local items = { "Vanilla", "Tailwind", "Shadcn" }
vim.ui.select(items, {
prompt = "Select scaffold from Bun:",
format_item = function(item) return item end,
}, function(choice, _)
if choice then return continue(choice) end
end)
end
end
---@type VernCreateFile
M.create_file = nil
---@param opts VernWebConfig Takes a table for the runtime
M.run = function(opts)
opts = opts or {}
-- term.open({
-- "lua " .. vim.fs.joinpath(fs.root(), "lua", fs.name(), "/init.lua"),
-- }, opts.terminal or {}, false)
end
---@type VernLanguageConfig
M.web = {
root = "Web",
dirs = nil,
providers = "bun", --- "bun"|"deno"|"vanilla"
keybinds = nil,
templates = {
project = nil,
file = {
source = {
path = "{dirs.src}",
name = "{file_name}.lua",
kind = "source",
kind_path = "vern-nvim.templates.lua",
},
},
extras = nil,
},
}
return M
+10
View File
@@ -0,0 +1,10 @@
--- Providers for bun
---
--[[ React
--react
--react=tailwind
--react=shadcn
--]]
Whitespace-only changes.
+81 -81
View File
@@ -1,115 +1,115 @@
return { return {
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: MAIN (Entrypoint) template: main (entrypoint)
File: main.c file: main.c
Target: src/main.c target: src/main.c
===================================================================== --]] ===================================================================== --]]
main = vim.trim([=[ main = vim.trim([=[
#include <stdio.h> #include <stdio.h>
int int
main() main()
{ {
char* str = "Hello World"; char* str = "hello world";
printf("%s\n", str); printf("%s\n", str);
return 0; return 0;
} }
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CLANG-FORMAT (Code formatter) template: clang-format (code formatter)
File: .clang-format file: .clang-format
Target: .clang-format target: .clang-format
===================================================================== --]] ===================================================================== --]]
format = vim.trim([=[ format = vim.trim([=[
--- ---
BasedOnStyle: Google basedonstyle: google
Standard: Latest standard: latest
UseTab: Always usetab: always
TabWidth: 8 tabwidth: 8
IndentWidth: 8 indentwidth: 8
BreakBeforeBraces: Allman breakbeforebraces: allman
SpaceBeforeCpp11BracedList: true spacebeforecpp11bracedlist: true
SeparateDefinitionBlocks: Always separatedefinitionblocks: always
Cpp11BracedListStyle: false cpp11bracedliststyle: false
BreakAfterReturnType: TopLevel breakafterreturntype: toplevel
ReflowComments: Always reflowcomments: always
AllowShortFunctionsOnASingleLine: All allowshortfunctionsonasingleline: all
AllowShortIfStatementsOnASingleLine: AllIfsAndElse allowshortifstatementsonasingleline: allifsandelse
AllowShortLoopsOnASingleLine: true allowshortloopsonasingleline: true
IndentAccessModifiers: false # Indent access specifiers by one level indentaccessmodifiers: false # indent access specifiers by one level
AccessModifierOffset: -4 # Optional: adjust offset relative to the class indentation level accessmodifieroffset: -4 # optional: adjust offset relative to the class indentation level
IndentGotoLabels: InnerIndent indentgotolabels: innerindent
DerivePointerAlignment: false derivepointeralignment: false
PointerAlignment: Left pointeralignment: left
IndentPPDirectives: AfterHash indentppdirectives: afterhash
SortIncludes: CaseSensitive sortincludes: casesensitive
IncludeBlocks: Preserve includeblocks: preserve
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CMAKELISTS (Spec / Build Manifest) template: cmakelists (spec / build manifest)
File: CMakeLists.txt file: cmakelists.txt
Target: CMakeLists.txt target: cmakelists.txt
===================================================================== --]] ===================================================================== --]]
CmakeLists = vim.trim([=[ cmakelists = vim.trim([=[
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(version 3.16)
project(__PROJECT_NAME__ LANGUAGES C) project(__project_name__ languages c)
set(CMAKE_C_STANDARD 23) set(cmake_c_standard 23)
set(CMAKE_C_STANDARD_REQUIRED ON) set(cmake_c_standard_required on)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(cmake_export_compile_commands on)
set(LIB_SOURCES set(lib_sources
# Add your other types here as you implement them: # add your other types here as you implement them:
# src/example1.c # src/example1.c
# src/example2.c # src/example2.c
) )
if(LIB_SOURCES) if(lib_sources)
add_library(__PROJECT_NAME__ STATIC ${LIB_SOURCES}) add_library(__project_name__ static ${lib_sources})
target_include_directories(__PROJECT_NAME__ target_include_directories(__project_name__
PUBLIC public
${CMAKE_CURRENT_SOURCE_DIR}/include ${cmake_current_source_dir}/include
) )
endif() endif()
add_executable(__PROJECT_NAME___bin src/main.c) add_executable(__project_name___bin src/main.c)
set_target_properties(__PROJECT_NAME___bin PROPERTIES OUTPUT_NAME "__PROJECT_NAME__") set_target_properties(__project_name___bin properties output_name "__project_name__")
if(TARGET __PROJECT_NAME__) if(target __project_name__)
target_link_libraries(__PROJECT_NAME___bin PRIVATE __PROJECT_NAME__) target_link_libraries(__project_name___bin private __project_name__)
endif() endif()
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: HEADER (Standalone File) template: header (standalone file)
File: {name}.h file: {name}.h
Target: include/{project_name}/{name}.h target: include/{project_name}/{name}.h
===================================================================== --]] ===================================================================== --]]
header = vim.trim([=[ header = vim.trim([=[
#ifndef __FILE_NAME___H #ifndef __file_name___h
#define __FILE_NAME___H #define __file_name___h
// Code // code
#endif /* __FILE_NAME___H */ #endif /* __file_name___h */
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: SOURCE (Standalone File) template: source (standalone file)
File: {name}.c file: {name}.c
Target: src/{name}.c target: src/{name}.c
===================================================================== --]] ===================================================================== --]]
source = vim.trim([=[ source = vim.trim([=[
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CLANG_TIDY (LINTER) template: clang_tidy (linter)
File: .clang-tidy file: .clang-tidy
Target: .clang-tidy target: .clang-tidy
===================================================================== --]] ===================================================================== --]]
linter = vim.trim([=[ linter = vim.trim([=[
Checks: > checks: >
-*, -*,
clang-analyzer-*, clang-analyzer-*,
bugprone-*, bugprone-*,
@@ -126,12 +126,12 @@ Checks: >
-bugprone-narrowing-conversions, -bugprone-narrowing-conversions,
-readability-identifier-length -readability-identifier-length
CheckOptions: checkoptions:
readability-identifier-naming.VariableCase: lower_case readability-identifier-naming.variablecase: lower_case
readability-identifier-naming.FunctionCase: lower_case readability-identifier-naming.functioncase: lower_case
readability-identifier-naming.StructCase: lower_case readability-identifier-naming.structcase: lower_case
readability-identifier-naming.EnumCase: CamelCase readability-identifier-naming.enumcase: camelcase
readability-identifier-naming.EnumConstantCase: UPPER_CASE readability-identifier-naming.enumconstantcase: upper_case
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE readability-identifier-naming.macrodefinitioncase: upper_case
]=]) .. "\n", ]=]) .. "\n",
} }
+12 -12
View File
@@ -1,10 +1,10 @@
return { return {
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: MAIN (Entrypoint) TEMPLATE: MAIN (Entrypoint)
File: main.cpp File: main.cpp
Target: src/main.cpp Target: src/main.cpp
===================================================================== --]] ===================================================================== --]]
main = vim.trim([=[ main = vim.trim([=[
#include <iostream> #include <iostream>
int int
@@ -16,12 +16,12 @@ main()
} }
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CLANG-FORMAT (Code formatter) TEMPLATE: CLANG-FORMAT (Code formatter)
File: .clang-format File: .clang-format
Target: .clang-format Target: .clang-format
===================================================================== --]] ===================================================================== --]]
format = vim.trim([=[ format = vim.trim([=[
--- ---
BasedOnStyle: Google BasedOnStyle: Google
Standard: Latest Standard: Latest
@@ -47,12 +47,12 @@ SortIncludes: CaseSensitive
IncludeBlocks: Preserve IncludeBlocks: Preserve
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CMAKELISTS (Spec / Build Manifest) TEMPLATE: CMAKELISTS (Spec / Build Manifest)
File: CMakeLists.txt File: CMakeLists.txt
Target: CMakeLists.txt Target: CMakeLists.txt
===================================================================== --]] ===================================================================== --]]
CmakeLists = vim.trim([=[ CmakeLists = vim.trim([=[
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(__PROJECT_NAME__ LANGUAGES CXX) project(__PROJECT_NAME__ LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
@@ -81,12 +81,12 @@ if(TARGET __PROJECT_NAME__)
endif() endif()
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: HEADER (Standalone File) TEMPLATE: HEADER (Standalone File)
File: {name}.hpp File: {name}.hpp
Target: include/{project_name}/{name}.hpp Target: include/{project_name}/{name}.hpp
===================================================================== --]] ===================================================================== --]]
header = vim.trim([=[ header = vim.trim([=[
#ifndef __FILE_NAME___HPP #ifndef __FILE_NAME___HPP
#define __FILE_NAME___HPP #define __FILE_NAME___HPP
@@ -95,20 +95,20 @@ endif()
#endif /* __FILE_NAME___HPP */ #endif /* __FILE_NAME___HPP */
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: SOURCE (Standalone File) TEMPLATE: SOURCE (Standalone File)
File: {name}.cpp File: {name}.cpp
Target: src/{name}.cpp Target: src/{name}.cpp
===================================================================== --]] ===================================================================== --]]
source = vim.trim([=[ source = vim.trim([=[
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CLANG_TIDY (LINTER) TEMPLATE: CLANG_TIDY (LINTER)
File: .clang-tidy File: .clang-tidy
Target: .clang-tidy Target: .clang-tidy
===================================================================== --]] ===================================================================== --]]
linter = vim.trim([=[ linter = vim.trim([=[
Checks: > Checks: >
-*, -*,
clang-analyzer-*, clang-analyzer-*,
+11 -11
View File
@@ -2,7 +2,7 @@ local M = {}
---@param lang string ---@param lang string
M.template = function(lang) M.template = function(lang)
local base = [=[ local base = [=[
.DS_Store .DS_Store
.vscode/ .vscode/
@@ -12,8 +12,8 @@ M.template = function(lang)
.env.* .env.*
]=] ]=]
local lang_block = { local lang_block = {
python = vim.trim([=[ python = vim.trim([=[
__pycache__/ __pycache__/
build/ build/
dist/ dist/
@@ -23,26 +23,26 @@ venv/
.pytest_cache/ .pytest_cache/
]=]), ]=]),
c = vim.trim([=[ c = vim.trim([=[
build/ build/
.cache/ .cache/
]=]), ]=]),
cpp = vim.trim([=[ cpp = vim.trim([=[
build/ build/
.cache/ .cache/
]=]), ]=]),
lua = vim.trim([=[ lua = vim.trim([=[
luac.out luac.out
]=]), ]=]),
java = vim.trim([=[ java = vim.trim([=[
bin/ bin/
*.class *.class
*.jar *.jar
]=]), ]=]),
rust = vim.trim([=[ rust = vim.trim([=[
debug debug
target target
**/*.rs.bk **/*.rs.bk
@@ -51,10 +51,10 @@ target
rustc-ice-*.txt rustc-ice-*.txt
#.idea/ #.idea/
]=]), ]=]),
} }
local extra = (lang and lang_block[lang]) or "" local extra = (lang and lang_block[lang]) or ""
return base .. extra return base .. extra
end end
return M return M
+25
View File
@@ -0,0 +1,25 @@
return {
--[[ =====================================================================
template: main (entrypoint)
file: main.go
target: main.go
===================================================================== --]]
main = vim.trim([=[
package main
import ("fmt")
func main() {
fmt.Println("Hello World")
}
]=]) .. "\n",
--[[ =====================================================================
template: source (standalone file)
file: {name}.go
target: {name}.go
===================================================================== --]]
--- Add boilder plate
source = vim.trim([=[
]=]) .. "\n",
}
+6 -6
View File
@@ -1,10 +1,10 @@
return { return {
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: MAIN (Entrypoint) TEMPLATE: MAIN (Entrypoint)
File: Main.java File: Main.java
Target: src/com/company/app/Main.java Target: src/com/company/app/Main.java
===================================================================== --]] ===================================================================== --]]
main = vim.trim([=[ main = vim.trim([=[
package com.__COMPANY_NAME__.__PROJECT_NAME__; package com.__COMPANY_NAME__.__PROJECT_NAME__;
public class Main { public class Main {
@@ -15,12 +15,12 @@ public class Main {
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: CLANG-FORMAT (Code formatter) TEMPLATE: CLANG-FORMAT (Code formatter)
File: .clang-format File: .clang-format
Target: .clang-format Target: .clang-format
===================================================================== --]] ===================================================================== --]]
format = vim.trim([=[ format = vim.trim([=[
--- ---
Language: Java Language: Java
BasedOnStyle: Google BasedOnStyle: Google
@@ -39,12 +39,12 @@ SortIncludes: CaseSensitive
IncludeBlocks: Preserve IncludeBlocks: Preserve
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: SOURCE (Standalone File) TEMPLATE: SOURCE (Standalone File)
File: {name}.java File: {name}.java
Target: src/com/company/app/{name}.java Target: src/com/company/app/{name}.java
===================================================================== --]] ===================================================================== --]]
source = vim.trim([=[ source = vim.trim([=[
package com.__COMPANY_NAME__.__PROJECT_NAME__; package com.__COMPANY_NAME__.__PROJECT_NAME__;
public class __FILE_NAME__ { public class __FILE_NAME__ {
+58
View File
@@ -0,0 +1,58 @@
return {
--[[ =====================================================================
template: main (entrypoint)
file: init.lua
target: lua/init.lua
===================================================================== --]]
main = vim.trim([=[
local M = {}
---@param opts? table
function M.setup(opts)
M.opts = opts or {}
end
return M
]=]) .. "\n",
--[[ =====================================================================
template: stylua (code formatter)
file: stylua.toml
target: stylua.toml
===================================================================== --]]
format = vim.trim([=[
# stylua.toml
# How many characters per line before wrapping
column_width = 80
# Indentation style: "Tabs" or "Spaces"
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 4
# Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle"
quote_style = "AutoPreferDouble"
# Call parentheses: "Always", "NoSingleString", "None", "Input"
# "None" removes parens when a single string/table literal is passed: fn "arg" / fn { ... }
# "Always" keeps them strictly standard: fn("arg") / fn({ ... })
call_parentheses = "Always"
# Sorting and formatting behavior
# collapse_simple_statement = "Never"
collapse_simple_statement = "Always"
]=]) .. "\n",
--[[ =====================================================================
template: source (standalone file)
file: {name}.lua
target: lua/{name}.lua
===================================================================== --]]
source = vim.trim([=[
local M = {}
return M
]=]) .. "\n",
}
+8 -8
View File
@@ -1,10 +1,10 @@
return { return {
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: MAIN (Entrypoint) TEMPLATE: MAIN (Entrypoint)
File: main.py File: main.py
Target: src/{project_name}/main.py Target: src/{project_name}/main.py
===================================================================== --]] ===================================================================== --]]
main = vim.trim([=[ main = vim.trim([=[
def main() -> None: def main() -> None:
print("Hello from __PROJECT_NAME__!") print("Hello from __PROJECT_NAME__!")
@@ -13,23 +13,23 @@ if __name__ == "__main__":
main() main()
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: INIT (Package Anchor) TEMPLATE: INIT (Package Anchor)
File: __init__.py File: __init__.py
Target: src/{project_name}/__init__.py Target: src/{project_name}/__init__.py
===================================================================== --]] ===================================================================== --]]
__init__ = vim.trim([=[ __init__ = vim.trim([=[
# __PROJECT_NAME__ init # __PROJECT_NAME__ init
__all__: list[str] = [] __all__: list[str] = []
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: PYPROJECT (Spec / Build Manifest) TEMPLATE: PYPROJECT (Spec / Build Manifest)
File: pyproject.toml File: pyproject.toml
Target: pyproject.toml Target: pyproject.toml
===================================================================== --]] ===================================================================== --]]
pyproject = vim.trim([=[ pyproject = vim.trim([=[
[build-system] [build-system]
requires = ["hatchling"] requires = ["hatchling"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
@@ -46,12 +46,12 @@ dependencies = []
__PROJECT_NAME__ = "__PROJECT_NAME__.main:main" __PROJECT_NAME__ = "__PROJECT_NAME__.main:main"
]=]) .. "\n", ]=]) .. "\n",
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: MODULE (Standalone File) TEMPLATE: MODULE (Standalone File)
File: {name}.py File: {name}.py
Target: src/{project_name}/{name}.py Target: src/{project_name}/{name}.py
===================================================================== --]] ===================================================================== --]]
module = vim.trim([=[ module = vim.trim([=[
""" """
Module: __FILE_NAME__ Module: __FILE_NAME__
""" """
+2 -2
View File
@@ -1,9 +1,9 @@
return { return {
--[[ ===================================================================== --[[ =====================================================================
TEMPLATE: SOURCE (Standalone File) TEMPLATE: SOURCE (Standalone File)
File: {name}.rs File: {name}.rs
Target: src/{name}.rs Target: src/{name}.rs
===================================================================== --]] ===================================================================== --]]
source = vim.trim([=[ source = vim.trim([=[
]=]) .. "\n", ]=]) .. "\n",
} }
+12 -5
View File
@@ -2,13 +2,17 @@
---@alias SplitDirection "vertical" | "horizontal" ---@alias SplitDirection "vertical" | "horizontal"
---@alias SplitAnchorType "right" | "bottom" ---@alias SplitAnchorType "right" | "bottom"
---@class VernCreateFile ---@alias VernCreateFile fun(opts: any, continue: fun(mod: VernFileLayout|nil))
---@field func? fun(opts: any, continue: fun(mod: VernFileLayout|nil)): any?
---@class VernUserConfig
---@field workspace_root? string
---@field keybinds? table<string, VernKeybindItem>
---@field terminal? VernTerminalConfig | table
---@class VernKeybindItem ---@class VernKeybindItem
---@field user_command string ---@field user_command string
---@field desc string ---@field desc string
---@field action function ---@field action fun(opts: VernCoreConfig)
---@class VernFloatWindowConfig ---@class VernFloatWindowConfig
---@field padding { left: integer, right: integer, top: integer, bottom: integer } ---@field padding { left: integer, right: integer, top: integer, bottom: integer }
@@ -46,7 +50,7 @@
---@field kind_path? string ---@field kind_path? string
---@class VernExtrasLayout : VernFileLayout ---@class VernExtrasLayout : VernFileLayout
---@field enabled boolean ---@field enabled? boolean
---@class VernLanguageTemplates ---@class VernLanguageTemplates
---@field project table<string, VernFileLayout>|nil ---@field project table<string, VernFileLayout>|nil
@@ -70,9 +74,12 @@
---@class VernLuaConfig : VernCoreConfig ---@class VernLuaConfig : VernCoreConfig
---@field lua? VernLanguageConfig ---@field lua? VernLanguageConfig
---
---@class VernJavaConfig : VernCoreConfig ---@class VernJavaConfig : VernCoreConfig
---@field java? VernLanguageConfig ---@field java? VernLanguageConfig
---@class VernRustConfig : VernCoreConfig ---@class VernRustConfig : VernCoreConfig
---@field rust? VernLanguageConfig ---@field rust? VernLanguageConfig
---@class VernWebConfig : VernCoreConfig
---@field web? VernLanguageConfig
+1 -1
View File
@@ -6,7 +6,7 @@ column_width = 80
# Indentation style: "Tabs" or "Spaces" # Indentation style: "Tabs" or "Spaces"
line_endings = "Unix" line_endings = "Unix"
indent_type = "Spaces" indent_type = "Spaces"
indent_width = 4 indent_width = 2
# Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle" # Quote styling: "AutoPreferDouble", "AutoPreferSingle", "ForceDouble", "ForceSingle"
quote_style = "AutoPreferDouble" quote_style = "AutoPreferDouble"