rework: open_float_terminal uses table instead of string
fix: all languages now use proper terminal setup
This commit is contained in:
@@ -1,26 +1,18 @@
|
||||
local utils = require("Polydev.utils")
|
||||
local M = {}
|
||||
|
||||
M.keybinds = {}
|
||||
M.opts = {}
|
||||
|
||||
function M.setup(opts)
|
||||
M.opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("lua"), opts or {})
|
||||
for key, command in pairs(M.opts.keybinds) do
|
||||
M.keybinds[command] = key
|
||||
end
|
||||
|
||||
function M.setup(user_opts)
|
||||
local opts = vim.tbl_deep_extend("force", {}, require("Polydev.configs").get("lua"), user_opts or {})
|
||||
vim.api.nvim_create_user_command("LuaRun", M.run, {})
|
||||
|
||||
if M.keybinds.LuaRun then
|
||||
vim.keymap.set("n", M.keybinds.LuaRun, ":LuaRun<CR>", { silent = true })
|
||||
for key, _ in pairs(opts.keybinds) do
|
||||
vim.keymap.set("n", key, ":LuaRun<CR>", { silent = true })
|
||||
end
|
||||
end
|
||||
|
||||
function M.run()
|
||||
local init_lua_path = utils.get_project_root() .. "/lua/" .. utils.get_project_name() .. "/init.lua"
|
||||
if vim.fn.filereadable(init_lua_path) == 1 then
|
||||
utils.open_float_terminal("lua " .. init_lua_path)
|
||||
utils.open_float_terminal({ "lua " .. init_lua_path })
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user