Skip to content

Commit b3f2b1c

Browse files
Allow passing env in :TermNew
1 parent 087a475 commit b3f2b1c

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.
88
- BREAKING: Rename `.get_last_focused()` to `.get_target_for_bang()`.
99
- Added `scrollback` setting to configure terminal scrollback buffer size.
1010
- Added `clear` option to `term:send()` to clear the terminal before sending input.
11+
- Allow passing `env.` settings in `:TermNew`
1112

1213
## 0.9.0 - 2025-11-07
1314

lua/ergoterm/commandline.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ local p = {
1515
M.nested_table_settings = {
1616
size = { "below", "above", "left", "right" },
1717
float_opts = { "title_pos", "width", "height", "relative", "border", "zindex", "title", "row", "col" },
18+
env = {},
1819
meta = {}
1920
}
2021

@@ -63,6 +64,7 @@ end
6364
---@field size Size?
6465
---@field float_opts FloatOpts?
6566
---@field tags string[]?
67+
---@field env table<string, string>?
6668
---@field meta table<string, string|number>?
6769

6870
---@see https://stackoverflow.com/a/27007701
@@ -358,6 +360,8 @@ M._all_options = {
358360

359361
tags = function() return {} end,
360362

363+
["env."] = function() return {} end,
364+
361365
["meta."] = function() return {} end
362366
}
363367

@@ -372,6 +376,7 @@ M._term_new_options = {
372376
persist_mode = M._all_options.persist_mode,
373377
persist_size = M._all_options.persist_size,
374378
auto_list = M._all_options.auto_list,
379+
["env."] = M._all_options["env."],
375380
start_in_insert = M._all_options.start_in_insert,
376381
sticky = M._all_options.sticky,
377382
cleanup_on_success = M._all_options.cleanup_on_success,

lua/ergoterm/commands.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ function M.new(args)
3939
vim.validate("float_opts", parsed.float_opts, "table", true)
4040
vim.validate("tags", parsed.tags, "table", true)
4141
vim.validate("meta", parsed.meta, "table", true)
42+
vim.validate("env", parsed.env, "table", true)
4243
return require("ergoterm").Terminal:new({
4344
cmd = parsed.cmd,
4445
dir = parsed.dir,
@@ -59,7 +60,8 @@ function M.new(args)
5960
size = parsed.size,
6061
float_opts = parsed.float_opts,
6162
tags = parsed.tags,
62-
meta = parsed.meta
63+
meta = parsed.meta,
64+
env = parsed.env
6365
}):focus()
6466
end
6567

spec/ergoterm/commandline_spec.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ describe("commandline.term_new_complete", function()
209209
assert.is_true(vim.tbl_contains(result, "float_opts.title="))
210210
assert.is_true(vim.tbl_contains(result, "tags="))
211211
assert.is_true(vim.tbl_contains(result, "meta.="))
212+
assert.is_true(vim.tbl_contains(result, "env.="))
212213
end)
213214

214215
it("completes boolean values for auto_scroll", function()

0 commit comments

Comments
 (0)