Skip to content

Commit 410ff9a

Browse files
authored
disable trim lines by default (#21)
* disable trim lines by default * fix specs * fix spec
1 parent f6022e3 commit 410ff9a

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# copy_with_context.nvim
22
![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)
3-
![CI](https://github.com/zhisme/copy_with_context.nvim/actions/workflows/ci.yml/badge.svg)
3+
![Build](https://github.com/zhisme/copy_with_context.nvim/actions/workflows/ci.yml/badge.svg)
44
[![codecov](https://codecov.io/gh/zhisme/copy_with_context.nvim/graph/badge.svg?token=T9xjbvS1Za)](https://codecov.io/gh/zhisme/copy_with_context.nvim)
55
[![Hits-of-Code](https://hitsofcode.com/github/zhisme/copy_with_context.nvim)](https://hitsofcode.com/github/zhisme/copy_with_context.nvim/view)
66
![GitHub Tag](https://img.shields.io/github/v/tag/zhisme/copy_with_context.nvim)
@@ -37,7 +37,7 @@ use {
3737
absolute = '<leader>cY'
3838
},
3939
-- whether to trim lines or not
40-
trim_lines = true,
40+
trim_lines = false,
4141
context_format = '# %s:%s', -- Default format for context: "# Source file: filepath:line"
4242
})
4343
end
@@ -56,7 +56,7 @@ use {
5656
absolute = '<leader>cY'
5757
},
5858
-- whether to trim lines or not
59-
trim_lines = true,
59+
trim_lines = false,
6060
context_format = '# %s:%s', -- Default format for context: "# Source file: filepath:line"
6161
})
6262
end
@@ -128,7 +128,7 @@ require('copy_with_context').setup({
128128
absolute = '<leader>cY'
129129
},
130130
-- whether to trim lines or not
131-
trim_lines = true,
131+
trim_lines = false,
132132
context_format = '# %s:%s', -- Default format for context: "# Source file: filepath:line"
133133
-- context_format = '# Source file: %s:%s',
134134
-- Other format for context: "# Source file: /path/to/file:123"
@@ -197,8 +197,8 @@ use {
197197
absolute = '<leader>cY'
198198
},
199199
-- whether to trim lines or not
200-
trim_lines = true,
201-
context_format = '# %s:%s', -- Default format for context: "# Source file: filepath:line"
200+
trim_lines = false,
201+
context_format = '# %s:%s', -- Default format for context: "# filepath:line"
202202
-- context_format = '# Source file: %s:%s',
203203
-- Other format for context: "# Source file: /path/to/file:123"
204204
})
@@ -218,8 +218,8 @@ With lazy.nvim:
218218
absolute = '<leader>cY'
219219
},
220220
-- whether to trim lines or not
221-
trim_lines = true,
222-
context_format = '# %s:%s', -- Default format for context: "# Source file: filepath:line"
221+
trim_lines = false,
222+
context_format = '# %s:%s', -- Default format for context: "# filepath:line"
223223
-- context_format = '# Source file: %s:%s',
224224
-- Other format for context: "# Source file: /path/to/file:123"
225225
}

doc/copy_with_context.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ There is no need to call setup if you are ok with the defaults.
3838
absolute = '<leader>cY'
3939
},
4040
-- whether to trim lines or not
41-
trim_lines = true,
41+
trim_lines = false,
4242
context_format = '# %s:%s', -- format for context: "# filepath:line", example: "# /path/to/file:123"
4343
-- context_format = '# Source file: %s:%s',
4444
-- Other format for context: "# Source file: /path/to/file:123"

lua/copy_with_context/config.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ M.options = {
77
absolute = "<leader>cY",
88
},
99
context_format = "# %s:%s", -- format for context: "# filepath:line", example: "# /path/to/file:123"
10-
trim_lines = true,
10+
trim_lines = false,
1111
}
1212

1313
-- Setup function to merge user config with defaults

tests/copy_with_context/config_spec.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ describe("Config Module", function()
2828
absolute = "<leader>cY",
2929
},
3030
context_format = "# %s:%s",
31-
trim_lines = true,
31+
trim_lines = false,
3232
}, config.options)
3333
end)
3434

3535
it("merges user options with defaults", function()
3636
config.setup({
3737
mappings = { relative = "<leader>new" },
38-
trim_lines = false,
38+
trim_lines = true,
3939
})
4040

4141
assert.same({
@@ -44,7 +44,7 @@ describe("Config Module", function()
4444
absolute = "<leader>cY",
4545
},
4646
context_format = "# %s:%s",
47-
trim_lines = false,
47+
trim_lines = true,
4848
}, config.options)
4949
end)
5050
end)

tests/copy_with_context/utils_spec.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,22 @@ describe("Utility Functions", function()
105105

106106
describe("process_lines", function()
107107
local config_mock = {
108-
options = { trim_lines = true },
108+
options = { trim_lines = false },
109109
}
110110

111111
before_each(function()
112112
package.loaded["copy_with_context.config"] = config_mock
113113
end)
114114

115-
it("trims lines if config option is enabled", function()
115+
it("keeps lines unchanged if trim is disabled", function()
116116
local result = utils.process_lines({ " hello ", " world " })
117-
assert.same({ "hello", "world" }, result)
117+
assert.same({ " hello ", " world " }, result)
118118
end)
119119

120-
it("keeps lines unchanged if trim is disabled", function()
121-
config_mock.options.trim_lines = false
120+
it("trims lines if config option is enabled", function()
121+
config_mock.options.trim_lines = true
122122
local result = utils.process_lines({ " hello ", " world " })
123-
assert.same({ " hello ", " world " }, result)
123+
assert.same({ "hello", "world" }, result)
124124
end)
125125
end)
126126

0 commit comments

Comments
 (0)