PYTHON: Project setup fixed and working, just need to add providers
This commit is contained in:
+21
-33
@@ -13,7 +13,7 @@ function M.fmt(str, ctx)
|
||||
end
|
||||
|
||||
---@param bufnr? integer Default is 0 (current buffer)
|
||||
function M.get_project_root(bufnr)
|
||||
function M.proj_root(bufnr)
|
||||
bufnr = bufnr or 0
|
||||
local root_markers = {
|
||||
".git",
|
||||
@@ -25,15 +25,28 @@ function M.get_project_root(bufnr)
|
||||
}
|
||||
return vim.fs.root(bufnr, root_markers) or vim.uv.cwd()
|
||||
end
|
||||
---
|
||||
|
||||
---@return string
|
||||
function M.get_project_name()
|
||||
return vim.fn.fnamemodify(M.get_project_root(), ":t")
|
||||
function M.proj_name()
|
||||
return vim.fn.fnamemodify(M.proj_root(), ":t")
|
||||
end
|
||||
---
|
||||
|
||||
---@param path string
|
||||
---@param ft string
|
||||
function M.init_git(path, ft)
|
||||
ft = ft and vim.trim(ft)
|
||||
if not ft or ft == "" then
|
||||
return
|
||||
end
|
||||
|
||||
local gitignore = require("vern.templates.extras.gitignore").template(ft)
|
||||
vim.fn.system({ "git", "-C", path, "init" })
|
||||
M.dump(vim.fs.joinpath(path, ".gitignore"), gitignore)
|
||||
end
|
||||
|
||||
---@param cmd table
|
||||
---@return integer, integer?
|
||||
function M.terminal(cmd, opts)
|
||||
function M.term(cmd, opts)
|
||||
opts = opts or {}
|
||||
local buf, win
|
||||
if opts.mode.type == "float" then
|
||||
@@ -56,12 +69,7 @@ function M.terminal(cmd, opts)
|
||||
|
||||
local pos = {
|
||||
row = math.floor(
|
||||
(
|
||||
ui.height
|
||||
- (vim.o.laststatus == 3 and 1 or 0)
|
||||
- vim.o.cmdheight
|
||||
- dim.height
|
||||
) / 2
|
||||
(ui.height - (vim.o.laststatus == 3 and 1 or 0) - vim.o.cmdheight - dim.height) / 2
|
||||
),
|
||||
col = math.floor((ui.width - dim.width) / 2),
|
||||
}
|
||||
@@ -74,9 +82,7 @@ function M.terminal(cmd, opts)
|
||||
row = pos.row,
|
||||
col = pos.col,
|
||||
style = "minimal",
|
||||
border = opts.mode.win.float.border.enabled
|
||||
and opts.mode.win.float.border.type
|
||||
or nil,
|
||||
border = opts.mode.win.float.border.enabled and opts.mode.win.float.border.type or nil,
|
||||
})
|
||||
end
|
||||
if opts.mode.type == "split" then
|
||||
@@ -111,12 +117,6 @@ end
|
||||
|
||||
return M
|
||||
|
||||
-- M.opts = {}
|
||||
--
|
||||
-- function M.setup(opts)
|
||||
-- M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("terminal"), opts or {})
|
||||
-- end
|
||||
--
|
||||
-- function M.exists(path)
|
||||
-- return (io.open(path, "r") ~= nil)
|
||||
-- end
|
||||
@@ -124,16 +124,4 @@ return M
|
||||
--
|
||||
--
|
||||
--
|
||||
-- ---@param path string
|
||||
-- ---@param gitignore_lines table
|
||||
-- function M.init_git(path, gitignore_lines)
|
||||
-- vim.fn.mkdir(path, "p")
|
||||
-- vim.fn.system({ "git", "-C", path, "init" })
|
||||
--
|
||||
-- if gitignore_lines and #gitignore_lines > 0 then
|
||||
-- local contents = table.concat(gitignore_lines, "\n")
|
||||
-- M.write_file({ path, ".gitignore" }, contents)
|
||||
-- end
|
||||
-- end
|
||||
----
|
||||
-- return M
|
||||
|
||||
Reference in New Issue
Block a user