fix(utils): fixed bottom split and added sizing for splits
This commit is contained in:
+42
-35
@@ -5,39 +5,46 @@ local M = {}
|
||||
---@return table
|
||||
local function default_languages(project_root)
|
||||
return {
|
||||
rust = {
|
||||
project_root = project_root .. "/Rust",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "RustRun",
|
||||
},
|
||||
},
|
||||
java = {
|
||||
project_root = project_root .. "/Java",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "JavaRun",
|
||||
},
|
||||
},
|
||||
lua = {
|
||||
project_root = project_root .. "/Lua",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "LuaRun",
|
||||
},
|
||||
},
|
||||
c = {
|
||||
project_root = project_root .. "/C",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "CRun",
|
||||
},
|
||||
},
|
||||
cpp = {
|
||||
project_root = project_root .. "/CPP",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "CppRun",
|
||||
},
|
||||
},
|
||||
html = {
|
||||
project_root = project_root .. "/Html",
|
||||
},
|
||||
rust = {
|
||||
project_root = project_root .. "/Rust",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "RustRun",
|
||||
},
|
||||
},
|
||||
java = {
|
||||
project_root = project_root .. "/Java",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "JavaRun",
|
||||
},
|
||||
},
|
||||
lua = {
|
||||
project_root = project_root .. "/Lua",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "LuaRun",
|
||||
},
|
||||
},
|
||||
c = {
|
||||
project_root = project_root .. "/C",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "CRun",
|
||||
},
|
||||
},
|
||||
cpp = {
|
||||
project_root = project_root .. "/CPP",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "CppRun",
|
||||
},
|
||||
},
|
||||
python = {
|
||||
project_root = project_root .. "/Python",
|
||||
keybinds = {
|
||||
["<leader>pr"] = "PythonRun",
|
||||
["<leader>pb"] = "PythonPip",
|
||||
},
|
||||
},
|
||||
html = {
|
||||
project_root = project_root .. "/Html",
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
@@ -55,7 +62,7 @@ function M.setup(user_opts)
|
||||
terminal = {
|
||||
mode = "split", -- floating or split
|
||||
win = {
|
||||
type = "vertical", anchor = "right" -- type: "vertical" or "horizonal" -- anchor: "below" or "right" or "center" or "corner"
|
||||
type = "horizontal", anchor = "bottom", size = "20" -- type: "vertical" or "horizonal" -- anchor: "below" or "right" or "center" or "corner" -- size: amount of cols or rows based on percentage without percente symbol
|
||||
},
|
||||
border = {
|
||||
enabled = true,
|
||||
@@ -73,7 +80,7 @@ function M.setup(user_opts)
|
||||
|
||||
-- Inject languages into the config, respecting user overrides
|
||||
for lang, conf in pairs(langs) do
|
||||
M.user_config[lang] = vim.tbl_deep_extend("force", conf, M.user_config[lang] or {})
|
||||
M.user_config[lang] = vim.tbl_deep_extend("force", conf, M.user_config[lang] or {})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -245,7 +245,7 @@ M.extras = {
|
||||
extras("_H", ".h", file_name)
|
||||
print("Successful creation of " .. file_name .. ".h")
|
||||
end
|
||||
if lang == "cpp" then
|
||||
if lang == "cpp" then
|
||||
extras("_HPP", ".hpp", file_name)
|
||||
print("Successful creation of " .. file_name .. ".hpp")
|
||||
end
|
||||
|
||||
+6
-6
@@ -67,10 +67,10 @@ function M.manager(project_root)
|
||||
local current_view = vim.deepcopy(entries)
|
||||
|
||||
-- Create a new custom highlight group with Normal background and NormalFloat foreground
|
||||
-- vim.api.nvim_set_hl(0, "PolydevNormal", {
|
||||
-- fg = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = true }).fg,
|
||||
-- bg = vim.api.nvim_get_hl(0, { name = "Normal", link = true }).bg,
|
||||
-- })
|
||||
-- vim.api.nvim_set_hl(0, "PolydevNormal", {
|
||||
-- fg = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = true }).fg,
|
||||
-- bg = vim.api.nvim_get_hl(0, { name = "Normal", link = true }).bg,
|
||||
-- })
|
||||
|
||||
local popup, search, preview = Popup({
|
||||
enter = true,
|
||||
@@ -139,7 +139,7 @@ function M.manager(project_root)
|
||||
local lines = {}
|
||||
local fd = io.open(entry.full_path, "r")
|
||||
if fd then
|
||||
for i = 1, 100 do
|
||||
for _ = 1, 100 do
|
||||
local line = fd:read("*line")
|
||||
if not line then break end
|
||||
table.insert(lines, line)
|
||||
@@ -293,7 +293,7 @@ function M.manager(project_root)
|
||||
if not lang or lang == "" then return print("Project creation canceled") end
|
||||
opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get(lang), opts or {})
|
||||
if languages.load_language_module(lang) and templates.projects[lang] and templates.projects[lang].run then
|
||||
-- if templates.projects[lang] and templates.projects[lang].run then
|
||||
-- if templates.projects[lang] and templates.projects[lang].run then
|
||||
popup:unmount()
|
||||
vim.schedule(function()
|
||||
vim.ui.input({ prompt = "Enter project name: " }, function(project_name)
|
||||
|
||||
@@ -91,16 +91,16 @@ function M.terminal(cmd)
|
||||
end
|
||||
end
|
||||
if M.opts.win.type == "horizontal" then
|
||||
if M.opts.anchor == "bottom" then
|
||||
if M.opts.win.anchor == "bottom" then
|
||||
vim.cmd("set splitbelow")
|
||||
end
|
||||
end
|
||||
|
||||
if M.opts.win.type == "vertical" then
|
||||
vim.cmd("vsplit")
|
||||
vim.cmd(M.opts.win.size .. " vsplit")
|
||||
end
|
||||
if M.opts.win.type == "horizontal" then
|
||||
vim.cmd("split")
|
||||
vim.cmd(M.opts.win.size .. " split")
|
||||
end
|
||||
local buf = vim.api.nvim_create_buf(false, true)
|
||||
vim.api.nvim_win_set_buf(0, buf)
|
||||
|
||||
Reference in New Issue
Block a user