-
-
Notifications
You must be signed in to change notification settings - Fork 89
Description
Is your feature request related to a problem? Please describe.
When using the copy() function to copy a request as a cURL command, the body content is replaced with a file reference (@filename) if it exceeds 1000 characters. This threshold is hardcoded and cannot be configured by the user.
This can be frustrating when:
- You want to always inline the body regardless of size for portability
- You need to share curl commands with others who don't have access to the referenced file
Describe the solution you'd like
Make the body size threshold configurable via the plugin's opts configuration. For example:
require("kulala").setup({
copy = {
body_max_size = 1000, -- default: 1000, set to -1 to always inline
}
})The relevant code is in [lua/kulala/ui/init.lua at line 558](https://github.com/mistweaverco/kulala.nvim/blob/main/lua/kulala/ui/init.lua#L558):
body = #body > 1000 and flag or bodyThis should reference a config value instead of the hardcoded 1000.
Additional context
The copy() function is defined at lua/kulala/ui/init.lua:543-568. The specific logic that determines whether to use the file reference or inline body is:
if previous_flag == "--data-binary" or previous_flag == "--data-urlencode" then
local body = FS.read_file(flag:sub(2), true) or "[could not read file]"
body = #body > 1000 and flag or body -- <-- hardcoded threshold
cmd = ("%s%s %s "):format(cmd, previous_flag, vim.fn.shellescape(body))
end