diff --git a/lua/nvchad/term/init.lua b/lua/nvchad/term/init.lua index 12b37433..ee5f2f45 100644 --- a/lua/nvchad/term/init.lua +++ b/lua/nvchad/term/init.lua @@ -93,23 +93,27 @@ local function create(opts) local buf_exists = opts.buf opts.buf = opts.buf or vim.api.nvim_create_buf(false, true) - -- handle cmd opt + -- handle cmd and flag local shell = vim.o.shell - local cmd = shell + local shellcmdflag = vim.o.shellcmdflag + local cmd = { shell } - if opts.cmd and opts.buf then - cmd = { shell, "-c", format_cmd(opts.cmd) .. "; " .. shell } - else - cmd = { shell } + for flag in string.gmatch(shellcmdflag, "%S+") do + table.insert(cmd, flag) + end + + table.insert(cmd, shell) + + if vim.uv.os_uname().sysname:find "Windows" ~= nil then + table.insert(cmd, "-NoLogo") end M.display(opts) save_term_info(opts.buf, opts) - opts.termopen_opts = vim.tbl_extend("force", opts.termopen_opts or {}, { detach = false }) if not buf_exists then - vim.fn.termopen(cmd, opts.termopen_opts) + vim.fn.jobstart(cmd, { term = true }) end vim.g.nvhterm = opts.pos == "sp"