removed: reorganized utils code because it was unused and removed
unnecessary presets_opts calls
This commit is contained in:
@@ -2,7 +2,7 @@ local utils = require("Polydev.utils")
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.keybinds = {}
|
M.keybinds = {}
|
||||||
M.opts = nil
|
M.opts = {}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("c"), opts or {})
|
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("c"), opts or {})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ local utils = require("Polydev.utils")
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
M.keybinds = {}
|
M.keybinds = {}
|
||||||
M.opts = nil
|
M.opts = {}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("cpp"), opts or {})
|
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("cpp"), opts or {})
|
||||||
|
|||||||
@@ -389,4 +389,3 @@ function M.open_project_manager()
|
|||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
||||||
|
|||||||
+3
-15
@@ -12,15 +12,9 @@ function M.is_dir(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.get_project_root()
|
function M.get_project_root()
|
||||||
-- Get absolute path to this Lua file (or any file in your plugin)
|
local plugin_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":h:h:h")
|
||||||
local plugin_path = debug.getinfo(1, "S").source:sub(2)
|
|
||||||
local plugin_dir = vim.fn.fnamemodify(plugin_path, ":h:h:h")
|
|
||||||
|
|
||||||
-- Build the full path to your script
|
local dir = vim.fn.system(plugin_dir .. "/bash_scripts/walkup.sh"):gsub("%s+$", "")
|
||||||
local script_path = plugin_dir .. "/bash_scripts/walkup.sh"
|
|
||||||
|
|
||||||
-- Run the script and get output
|
|
||||||
local dir = vim.fn.system(script_path):gsub("%s+$", "")
|
|
||||||
return dir
|
return dir
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -39,11 +33,8 @@ end
|
|||||||
|
|
||||||
function M.init_git(path, gitignore_lines)
|
function M.init_git(path, gitignore_lines)
|
||||||
vim.fn.mkdir(path, "p")
|
vim.fn.mkdir(path, "p")
|
||||||
|
|
||||||
-- Initialize Git
|
|
||||||
vim.fn.system({ "git", "-C", path, "init" })
|
vim.fn.system({ "git", "-C", path, "init" })
|
||||||
|
|
||||||
-- Write .gitignore if provided
|
|
||||||
if gitignore_lines and #gitignore_lines > 0 then
|
if gitignore_lines and #gitignore_lines > 0 then
|
||||||
local gitignore_path = { path, ".gitignore" }
|
local gitignore_path = { path, ".gitignore" }
|
||||||
local contents = table.concat(gitignore_lines, "\n")
|
local contents = table.concat(gitignore_lines, "\n")
|
||||||
@@ -53,10 +44,7 @@ end
|
|||||||
|
|
||||||
function M.open_float_terminal(cmd)
|
function M.open_float_terminal(cmd)
|
||||||
local presets = require("Polydev.presets")
|
local presets = require("Polydev.presets")
|
||||||
local presets_opts = {}
|
local presets_opts = presets.getPresets(M.opts.preset)
|
||||||
|
|
||||||
if presets.getPresets(M.opts.preset) == nil then return nil end
|
|
||||||
presets_opts = presets.getPresets(M.opts.preset)
|
|
||||||
local ui = vim.api.nvim_list_uis()[1]
|
local ui = vim.api.nvim_list_uis()[1]
|
||||||
|
|
||||||
local width = math.max(1, math.floor(ui.width * 0.9) - presets_opts.left_padding - presets_opts.right_padding)
|
local width = math.max(1, math.floor(ui.width * 0.9) - presets_opts.left_padding - presets_opts.right_padding)
|
||||||
|
|||||||
Reference in New Issue
Block a user