jesseduffield / jesseduffield/lazygit

Project specific config merged with general config

Open
#2,378 0 comments 1 reaction 0 assignees View on GitHub
discussion
Dominant language
Go
Stars
82.4k
Forks
3k
Avg merge
2d 18h
Merged PRs (30d)
19

Description

**Topic**
For different projects I have different custom Gitlab instances and I wanted to set up the Lazygit service definition for each of them. However, I didn't want my general Lazygit config to include those.

**Your thoughts**
I came up with a way to automatically find a project specific config and use this alongside the general config and I thought I share this info here. Not sure whether there is a place for this in the config docs or not. Feel free to also just close the discussion.

```
#!/usr/bin/env bash

config_file="$HOME/.config/lazygit/config.yml"

# If there is a .lazygit.yml file in the current Git repository root, use it as well.
gitroot=$(git rev-parse --show-toplevel)
if [ -f "$gitroot/.lazygit.yml" ]; then
config_file="$config_file,$gitroot/.lazygit.yml"
fi

/opt/homebrew/bin/lazygit --use-config-file="$config_file"
```

First, I only had a simple bash function. However, as I use Lazygit in Vim, I needed to overwrite the `lazygit` command, so I created a custom command via this script.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.