Skip to content

Commit

Permalink
fix(lazygit): enable boolean values in config (#377)
Browse files Browse the repository at this point in the history
## Description

Using boolean value inside `config` resulted in error `attempt to
concatenate a boolean value` inside `to_yaml` function.
This PR fixes it by converting boolean values to string

Example config:
```
lazygit = {
    config = {
        gui = {
            showFileTree = false,
        },
    },
},
```
## Related Issue(s)

## Screenshots

![image](https://github.com/user-attachments/assets/eea8eec6-2008-4ded-9222-6f7c9b9d4390)
  • Loading branch information
NevLext authored Dec 31, 2024
1 parent 7861e62 commit ec34684
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lua/snacks/lazygit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ local function update_config(opts)
local config = vim.tbl_deep_extend("force", { gui = { theme = theme } }, opts.config or {})

local function yaml_val(val)
if type(val) == "boolean" then
return tostring(val)
end
return type(val) == "string" and not val:find("^\"'`") and ("%q"):format(val) or val
end

Expand Down

0 comments on commit ec34684

Please sign in to comment.