chore: removing redundant code
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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", "<ESC>", "i<C-\\><C-n>:q<CR>", { 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", "<ESC>", "i<C-\\><C-n>:q<CR>", { noremap = true, silent = true })
|
||||
return buf
|
||||
return buf, win
|
||||
end
|
||||
return 0
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user