From 38284658dd82177fe5ba925816f96c19e96e8940 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Thu, 22 May 2025 08:12:27 -0400 Subject: [PATCH] chore: removing redundant code --- lua/Polydev/languages.lua | 8 +++++--- lua/Polydev/ui.lua | 6 ------ lua/Polydev/utils.lua | 7 +++---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/lua/Polydev/languages.lua b/lua/Polydev/languages.lua index 606f8d0..be8662e 100644 --- a/lua/Polydev/languages.lua +++ b/lua/Polydev/languages.lua @@ -95,12 +95,14 @@ M.languages = { local success = vim.v.shell_error == 0 if not success then - local term_buf = utils.terminal({ cmd }) - vim.api.nvim_set_option_value("modifiable", true, { win = term_buf }) + local term_buf, term_win = utils.terminal({ cmd }) + + vim.api.nvim_set_option_value("modifiable", true, { buf = term_buf }) vim.api.nvim_buf_set_lines(term_buf, 0, -1, false, vim.list_extend({ "Error during compilation:" }, vim.split(output, "\n", { trimempty = true })) ) - vim.api.nvim_set_option_value("modifiable", false, { win = term_buf }) + vim.api.nvim_set_option_value("modifiable", false, { buf = term_buf }) + end if success then local run_cmd = "cd '" .. build_dir .. "' && ./" .. utils.get_project_name() diff --git a/lua/Polydev/ui.lua b/lua/Polydev/ui.lua index d59f584..df5fe2a 100644 --- a/lua/Polydev/ui.lua +++ b/lua/Polydev/ui.lua @@ -66,12 +66,6 @@ function M.manager(project_root) local entries = get_entries(cwd) 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, - -- }) - local popup, search, preview = Popup({ enter = true, focusable = true, diff --git a/lua/Polydev/utils.lua b/lua/Polydev/utils.lua index f722be3..e524d2b 100644 --- a/lua/Polydev/utils.lua +++ b/lua/Polydev/utils.lua @@ -76,10 +76,7 @@ function M.terminal(cmd) style = "minimal", border = M.opts.border.enabled and M.opts.border.type, }) - vim.api.nvim_set_option_value("winblend", vim.o.pumblend, { win = win }) vim.api.nvim_set_option_value("winhighlight", "Normal:PolydevNormal,FloatBorder:PolydevBorder", { win = win }) - vim.api.nvim_set_option_value("cursorline", true, { win = win }) - vim.api.nvim_set_option_value("scrolloff", 5, { win = win }) vim.fn.jobstart(table.concat(cmd, "/"), { term = true }) vim.api.nvim_buf_set_keymap(buf, "n", "", "i:q", { noremap = true, silent = true }) return buf, win @@ -103,11 +100,13 @@ function M.terminal(cmd) vim.cmd(M.opts.win.size .. " split") end local buf = vim.api.nvim_create_buf(false, true) + local win = vim.api.nvim_get_current_win() + vim.api.nvim_win_set_buf(0, buf) vim.fn.jobstart(table.concat(cmd, "/"), { term = true }) vim.api.nvim_buf_set_keymap(buf, "n", "", "i:q", { noremap = true, silent = true }) - return buf + return buf, win end return 0 end