Skip to content

Commit

Permalink
feat: add clear_env option (#598)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcying authored Aug 8, 2024
1 parent 8ed0f52 commit 16a2873
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ require("toggleterm").setup{
persist_mode = true, -- if set to true (default) the previous terminal mode will be remembered
direction = 'vertical' | 'horizontal' | 'tab' | 'float',
close_on_exit = true, -- close the terminal window when the process exits
clear_env = false, -- use only environmental variables from `env`, passed to jobstart()
-- Change the default shell. Can be a string or a function returning a string
shell = vim.o.shell,
auto_scroll = true, -- automatically scroll to the bottom on terminal output
Expand Down
2 changes: 2 additions & 0 deletions lua/toggleterm/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local function shade(color, factor) return colors.shade_color(color, factor) end
--- @field persist_size boolean
--- @field persist_mode boolean
--- @field close_on_exit boolean
--- @field clear_env boolean
--- @field direction '"horizontal"' | '"vertical"' | '"float"'
--- @field shading_factor number
--- @field shading_ratio number
Expand All @@ -49,6 +50,7 @@ local config = {
persist_size = true,
persist_mode = true,
close_on_exit = true,
clear_env = false,
direction = "horizontal",
shading_factor = constants.shading_amount,
shading_ratio = constants.shading_ratio,
Expand Down
2 changes: 1 addition & 1 deletion lua/toggleterm/terminal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function Terminal:new(term)
term.id = id or next_id()
term.display_name = term.display_name
term.float_opts = vim.tbl_deep_extend("keep", term.float_opts or {}, conf.float_opts)
term.clear_env = term.clear_env
term.clear_env = vim.F.if_nil(term.clear_env, conf.clear_env)
term.auto_scroll = vim.F.if_nil(term.auto_scroll, conf.auto_scroll)
term.env = vim.F.if_nil(term.env, conf.env)
term.hidden = vim.F.if_nil(term.hidden, false)
Expand Down

0 comments on commit 16a2873

Please sign in to comment.