lazygit/docs
Blake Williams 59f0650173 Add support for ~/.config/lazygit without setting XDG_CONFIG_HOME
Currently lazygit looks for its config file in `XDG_CONFIG_HOME` if it's
available, but if not it falls back to the defaults defined by the
[xdg](https://github.com/adrg/xdg) package. Unfortunately the defaults
the package falls back to isn't what CLI applications commonly fall back
to on macOS. Specifically, it looks in `~/Library/Application Support`
instead of `~/.config`.

This updates the app config logic to:

- Look for `~/.config/lazygit` first if `XDG_CONFIG_HOME` is not set
  and we're on macOS.
- Fallback to the existing `xdg` package location if the configuration
  file exists there.
- Default to `~/.config/lazygit/config.yml` if `XDG_CONFIG_HOME` is not
  set, we're on macOS, and there is no existing configuration file.

This change did feel a bit like having to thread a needle and I didn't
see any existing tests for this behavior (which is reasonable, since it's
complicated and OS dependent) so I did test a few variations of the
configuration locally by building with this change included and running
a `brew` installed lazygit.

It seemed to work properly, falling back to the existing location when
`XDG_CONFIG_HOME` isn't set, using `~/.config/lazygit` when `config.yml`
is present, and creating `~/.config/lazygit/config.yml` when it's not.

I think this should resolve https://github.com/jesseduffield/lazygit/issues/1341
2024-12-31 13:38:55 +11:00
..
dev [DATALAD RUNCMD] run codespell throughout fixing typos automagically 2024-08-27 18:03:00 +02:00
keybindings Generate keybindings 2024-09-08 15:20:52 +02:00
Config.md Add support for ~/.config/lazygit without setting XDG_CONFIG_HOME 2024-12-31 13:38:55 +11:00
Custom_Command_Keybindings.md Expose SelectedCommit to custom commands, deprecate Selected{Local,Reflog,Sub}Commit 2024-08-17 11:26:31 +02:00
Custom_Pagers.md Add missing closing quote 2024-08-27 10:16:53 +02:00
Fixup_Commits.md Update user doc 2024-06-01 08:31:18 +02:00
Range_Select.md Add range selection ability on list contexts 2024-01-19 10:47:21 +11:00
README.md Normalize line endings of docs/README.md 2024-07-01 08:36:57 +02:00
Searching.md Add filtering docs 2023-07-03 12:54:14 +10:00
Stacked_Branches.md chore: fix some comments and typos 2024-04-28 09:44:59 +02:00
Undoing.md Add undo demo 2023-08-12 16:15:50 +10:00