# vim:ft=gotmpl
# $DOTFILES/common/gitconfig.example
# Date: 2024-12-22
# Author: js0ny

# Location:
# Windows: %USERPROFILE%\.gitconfig
# *nix: ~/.config/git/config
# Linking: (Note that this file is an example, only copy this then edit)
# cp $DOTFILES/common/gitconfig.example ~/.config/git/config
[user]
	name = {{ .username }}
	email = {{ .email }}
[alias]
	cl = clone
	clnh = clone --depth 1 # Clone with no history
	cma = commit -am # Add and commit
	logs = log --oneline --graph --decorate --all # Show logs
	last = log -1 HEAD # Show last commit
	undo = reset --hard HEAD # Undo the last commit
[core]
	editor = nvim
	pager = delta
    # autocrlf:
    # true: Keep crlf in Windows, lf in *nix
    # input: Keep lf in all platforms
	autocrlf = input
	safecrlf = true
	excludesfile = $XDG_CONFIG_HOME/git/ignore
	quotePath = false # zh-CN: 解决中文路径问题
	eol = lf
[core]
{{- if eq .chezmoi.os "windows" }}
	editor = vim
{{- else }}
	editor = nvim
{{- end }}
	pager = delta
[interactive]
	diffFilter = delta --color-only
[delta]
	navigate = true
	dark = true
    features = catppuccin-mocha # Colorscheme
[diff]
    tool = nvimdiff
[difftool]
    prompt = false
[difftool "nvimdiff"]
    cmd = "nvim -d \"$LOCAL\" \"$REMOTE\""
[merge]
    tool = nvimdiff
[mergetool]
    prompt = false
[mergetool "nvimdiff"]
    cmd = "nvim -d \"$LOCAL\" \"$MERGED\" \"$REMOTE\""
[color]
	ui = auto
[pull]
	ff = only
[init]
	defaultBranch = master
[filter "lfs"]
	clean = git-lfs clean -- %f
	smudge = git-lfs smudge -- %f
	process = git-lfs filter-process
	required = true
# Force ssh
# Don't use ssh in GitHub since ssh-agent doesn't work in non-interactive environment
# While GitHub holds many plugins, it's better to use https
# This prevents from Neovide `publickey` error when installing plugins
# [url "git@github.com:"]
# 	insteadOf = https://github.com/
[url "git@codeberg.org:"]
	insteadOf = https://codeberg.org/
