Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
- Fix: Correctly center floating terminal when no borders are used.
- Set terminal window as `nolist`.
- Add `fixed_height` & `fixed_width` options to control whether terminal size should be preserved on new splits.
- Do not ignore wildcard patterns when expanding `dir`.

## 1.0.0 - 2025-11-21

Expand Down
2 changes: 1 addition & 1 deletion lua/ergoterm/instance.lua
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ function Terminal:_compute_dir()
elseif self.dir == nil then
dir = vim.loop.cwd()
else
dir = vim.fn.expand(self.dir)
dir = vim.fn.expand(self.dir, true)
if vim.fn.isdirectory(dir) == 0 then
utils.notify(
string.format("%s is not a directory", dir),
Expand Down
3 changes: 2 additions & 1 deletion spec/ergoterm/commands_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ describe("M.new", function()
local original_expand = vim.fn.expand
local original_isdirectory = vim.fn.isdirectory
--- @diagnostic disable: duplicate-set-field
vim.fn.expand = function(path) return path end
--- @diagnostic disable-next-line: unused-vararg
vim.fn.expand = function(path, ...) return path end
vim.fn.isdirectory = function(_) return 1 end
--- @diagnostic enable: duplicate-set-field

Expand Down
8 changes: 8 additions & 0 deletions spec/ergoterm/instance_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ describe(":new", function()
assert.equal("/tmp", term:get_state("dir"))
end)

it("initializes directory even when it matches wildignore pattern", function()
test_helpers.with_option("wildignore", "**/tmp", function()
local term = Terminal:new({ dir = "/tmp" })

assert.equal("/tmp", term:get_state("dir"))
end)
end)

it("errors if dir is not a valid directory", function()
local result = test_helpers.mocking_notify(function()
Terminal:new({ dir = "/invalid" })
Expand Down
3 changes: 2 additions & 1 deletion spec/ergoterm/utils_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ describe(".get_dir", function()
---@diagnostic disable: duplicate-set-field
utils.git_dir = function() return "/git/dir" end
vim.loop.cwd = function() return "/current/dir" end
vim.fn.expand = function(arg) return "/expanded/" .. arg end
--- @diagnostic disable-next-line: unused-vararg
vim.fn.expand = function(arg, ...) return "/expanded/" .. arg end
vim.fn.isdirectory = function(_) return 1 end
end)

Expand Down