docs: removed warning from c files about early build issues
This commit is contained in:
@@ -1,10 +1,5 @@
|
|||||||
### C Setup for Polydev 🛠️
|
### C Setup for Polydev 🛠️
|
||||||
|
|
||||||
#### Key Notes ⚠️
|
|
||||||
> **Important**: The first time you build a project, it might throw an error. This is expected behavior. Simply rerun the build, and if errors persist, it may be an issue with your project setup rather than the plugin.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### Keybinds 🎮
|
#### Keybinds 🎮
|
||||||
You can customize keybinds for your C projects with Polydev.
|
You can customize keybinds for your C projects with Polydev.
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,5 @@
|
|||||||
### C Setup for Polydev 🛠️
|
### C Setup for Polydev 🛠️
|
||||||
|
|
||||||
#### Key Notes ⚠️
|
|
||||||
> **Important**: The first time you build a project, it might throw an error. This is expected behavior. Simply rerun the build, and if errors persist, it may be an issue with your project setup rather than the plugin.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
#### Keybinds 🎮
|
#### Keybinds 🎮
|
||||||
You can customize keybinds for your C projects with Polydev.
|
You can customize keybinds for your C projects with Polydev.
|
||||||
|
|
||||||
|
|||||||
+9
-15
@@ -6,26 +6,23 @@ local Layout = require("nui.layout")
|
|||||||
local event = require("nui.utils.autocmd").event
|
local event = require("nui.utils.autocmd").event
|
||||||
local Path = require("plenary.path")
|
local Path = require("plenary.path")
|
||||||
|
|
||||||
---@type table
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
---@type table
|
|
||||||
M.loaded_languages = {}
|
M.loaded_languages = {}
|
||||||
|
|
||||||
---@param lang string
|
---@type table
|
||||||
---@param opts table?
|
M.keybinds = {}
|
||||||
---@return boolean
|
|
||||||
|
-- Load language opts based on filetype
|
||||||
function M.load_language_module(lang, opts)
|
function M.load_language_module(lang, opts)
|
||||||
if M.loaded_languages[lang] then return true end
|
if M.loaded_languages[lang] then return true end
|
||||||
|
|
||||||
local ok, lang_module = pcall(require, "Polydev.languages." .. lang)
|
local ok, mod = pcall(require, "Polydev.languages." .. lang)
|
||||||
if ok and lang_module.setup then
|
if not ok or type(mod.setup) ~= "function" then return false end
|
||||||
local lang_opts = opts and opts[lang] or {}
|
|
||||||
lang_module.setup(lang_opts)
|
mod.setup(opts and opts[lang] or {})
|
||||||
M.loaded_languages[lang] = lang_module
|
M.loaded_languages[lang] = mod
|
||||||
return true
|
return true
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get entries in a given path
|
-- Get entries in a given path
|
||||||
@@ -392,9 +389,6 @@ local function open_filtered_table()
|
|||||||
render()
|
render()
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type table
|
|
||||||
M.keybinds = {}
|
|
||||||
|
|
||||||
local function setupKeybinds(opts)
|
local function setupKeybinds(opts)
|
||||||
M.opts = {}
|
M.opts = {}
|
||||||
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ local M = {}
|
|||||||
---@type table
|
---@type table
|
||||||
M.opts = {}
|
M.opts = {}
|
||||||
|
|
||||||
---@type table
|
|
||||||
local presets_opts = {}
|
|
||||||
|
|
||||||
---@param opts table
|
---@param opts table
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("terminal"), opts or {})
|
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("terminal"), opts or {})
|
||||||
@@ -29,15 +26,14 @@ function M.write_file(path, content)
|
|||||||
file:write(content)
|
file:write(content)
|
||||||
file:close()
|
file:close()
|
||||||
vim.cmd("edit " .. path)
|
vim.cmd("edit " .. path)
|
||||||
print(path .. " created successfully!")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param cmd string
|
---@param cmd string
|
||||||
---@return boolean, table
|
---@return boolean?, table?, nil?
|
||||||
function M.open_float_terminal(cmd)
|
function M.open_float_terminal(cmd)
|
||||||
if presets.getPresets(M.opts.presets) ~= nil then
|
local presets_opts = {}
|
||||||
|
if presets.getPresets(M.opts.presets) == nil then return nil end
|
||||||
presets_opts = presets.getPresets(M.opts.presets)
|
presets_opts = presets.getPresets(M.opts.presets)
|
||||||
end
|
|
||||||
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)
|
||||||
@@ -59,9 +55,9 @@ function M.open_float_terminal(cmd)
|
|||||||
vim.api.nvim_set_option_value("winhighlight", "Normal:Pmenu,FloatBorder:Pmenu", { win = win })
|
vim.api.nvim_set_option_value("winhighlight", "Normal:Pmenu,FloatBorder:Pmenu", { win = win })
|
||||||
vim.api.nvim_set_option_value("cursorline", true, { win = win })
|
vim.api.nvim_set_option_value("cursorline", true, { win = win })
|
||||||
vim.api.nvim_set_option_value("scrolloff", 5, { win = win })
|
vim.api.nvim_set_option_value("scrolloff", 5, { win = win })
|
||||||
if(M.opts.number == true) then
|
if(M.opts.number) then
|
||||||
vim.api.nvim_set_option_value("number", true, { win = win })
|
vim.api.nvim_set_option_value("number", true, { win = win })
|
||||||
if(M.opts.relativenumber == true) then
|
if(M.opts.relativenumber) then
|
||||||
vim.api.nvim_set_option_value("relativenumber", true, { win = win })
|
vim.api.nvim_set_option_value("relativenumber", true, { win = win })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user