summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlen <alen@dotfiles.xyz>2023-09-09 16:37:16 +0400
committerAlen <alen@dotfiles.xyz>2023-09-09 16:37:16 +0400
commit4936224263dcbb3e27671d3f88c7b558813f9575 (patch)
tree3c12c0df12078287e173fbd8631b58dd5160309f
parent45bc2e16f335035a114406bea7d8ef5129a775ac (diff)
Add .gitconfig
-rw-r--r--.chezmoi.toml.tmpl14
-rw-r--r--dot_gitconfig.tmpl121
-rw-r--r--dot_gitignore_global46
-rw-r--r--dot_gittemplates/commit17
4 files changed, 198 insertions, 0 deletions
diff --git a/.chezmoi.toml.tmpl b/.chezmoi.toml.tmpl
new file mode 100644
index 0000000..b32744b
--- /dev/null
+++ b/.chezmoi.toml.tmpl
@@ -0,0 +1,14 @@
+{{- $defaultPager := "less" -}}
+{{- if lookPath "delta" -}}
+    {{- $defaultPager = "delta" -}}
+{{- end -}}
+{{- $defaultName := .chezmoi.username | title -}}
+{{- $defaultEmail := printf "%s@%s" .chezmoi.username .chezmoi.hostname -}}
+
+[diff]
+    pager = {{ promptString "chezmoi pager" $defaultPager | quote }}
+
+[data.git]
+    name = {{ promptString "git name" $defaultName | quote }}
+    email = {{ promptString "git email" $defaultEmail | quote }}
+    pager = {{ promptString "git pager" $defaultPager | quote }}
diff --git a/dot_gitconfig.tmpl b/dot_gitconfig.tmpl
new file mode 100644
index 0000000..b65f2ff
--- /dev/null
+++ b/dot_gitconfig.tmpl
@@ -0,0 +1,121 @@
+[user]
+    email = {{ .git.email }}
+    name = {{ .git.name }}
+
+[core]
+    autocrlf = {{ if eq .chezmoi.os "windows" -}} true
+               {{- else -}}                       input
+               {{- end }}
+    excludesFile = ~/.gitignore_global
+    pager = {{ .git.pager }}
+    whitespace = trailing-space,space-before-tab
+
+[credential]
+    helper = {{ if eq .chezmoi.os "darwin" -}}        osxkeychain
+             {{- else if eq .chezmoi.os "windows" -}} manager
+             {{- else -}}                             store
+             {{- end }}
+
+[init]
+    templatedir = ~/.gittemplates
+    defaultBranch = main
+
+[pull]
+    ff = only
+
+[push]
+     default = current
+
+[apply]
+    whitespace = fix
+
+[commit]
+    verbose = true
+    template = ~/.gittemplates/commit
+
+[status]
+    showUntrackedFiles = all
+
+[log]
+    decorate = full
+
+[interactive]
+    diffFilter = {{ if eq .git.pager "delta" -}} delta --color-only --features=interactive
+                 {{- else -}}                    less --use-color
+                 {{- end }}
+
+[grep]
+    extendedRegexp = true
+    lineNumber = true
+
+[merge]
+    conflictstyle = diff3
+
+[diff]
+    colorMoved = default
+    renames = copies
+    mnemonicprefix = true
+
+[filter "lfs"]
+     clean = git-lfs clean -- %f
+     smudge = git-lfs smudge -- %f
+     process = git-lfs filter-process
+     required = true
+
+[lfs]
+     concurrenttransfers = 32
+
+[rerere]
+    enabled = true
+
+[alias]
+    lg  = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) %C(green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --all
+    lgs = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) %C(green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)%n' --all --stat
+    lgl = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) %C(cyan)%aD%C(reset) %C(green)(%ar)%C(reset)%C(auto)%d%C(reset)%n%C(white)%s%C(reset) %C(dim white)- %an%C(reset)%n' --all --stat
+
+    a = add
+    aa = add --all
+
+    c = commit -v
+    cv = commit -v
+    ca = commit -v --amend
+
+    cl = clean -id
+    prc = !"git reset --hard && git clean -dffx"
+
+    d = diff
+    dt = diff-tree --no-commit-id --name-only -r
+
+    fa = fetch --all --prune
+    fo = fetch origin
+
+    l = pull
+
+    p = push
+    pf = push --force-with-lease
+    pff = push --force
+
+    r = rebase
+    ri = rebase --interactive
+
+    sb = status -sb
+    ss = status -s
+
+    co = checkout
+
+[delta]
+    navigate = true
+    features = decorations
+[delta "interactive"]
+    keep-plus-minus-markers = false
+[delta "decorations"]
+    line-numbers = true
+    commit-decoration-style = bold yellow box ul
+    # commit-style = raw
+    file-style = ul yellow
+    file-decoration-style = none
+    hunk-header-decoration-style = blue box ul
+    hunk-header-file-style = brightyellow
+    hunk-header-line-number-style = green
+    hunk-header-style = file line-number syntax
+    navigate = true
diff --git a/dot_gitignore_global b/dot_gitignore_global
new file mode 100644
index 0000000..cdc48f2
--- /dev/null
+++ b/dot_gitignore_global
@@ -0,0 +1,46 @@
+# OS things
+.DS_Store
+.DS_Store?
+.Spotlight-V100
+.Trashes
+ehthumbs.db
+Thumbs.db
+.snapshots/
+
+# Temporary data files
+*.pkl
+*.temp
+*.sqlite
+*.db
+
+# Commonly used dev files
+/_ipython.py
+/.env
+
+# IDE
+/.idea/
+/.vscode/
+
+# Basic Python stuff for one-off doodles
+__pycache__/
+/venv/
+.py[cod]
+
+# Basic node stuff for one-off doodles
+/node_modules/
+
+# Compiled files
+*.com
+*.class
+*.dll
+*.exe
+*.o
+*.so
+
+# Archives
+*.7z
+*.dmg
+*.gz
+*.rar
+*.tar
+*.zip
diff --git a/dot_gittemplates/commit b/dot_gittemplates/commit
new file mode 100644
index 0000000..7f78cf8
--- /dev/null
+++ b/dot_gittemplates/commit
@@ -0,0 +1,17 @@
+
+# How to Write a Git Commit Message (https://cbea.ms/git-commit/)
+#
+# A properly formed Git commit subject line should always be able to
+# complete the following sentence:
+#   If applied, this commit will <your subject line here>
+#
+# [Add/Fix/Remove/Update/Refactor/Document/Style]: [issue #id] [summary]
+#
+# The seven rules of a great Git commit message
+#   1. Separate subject from body with a blank line
+#   2. Limit the subject line to 50 characters
+#   3. Capitalize the subject line
+#   4. Do not end the subject line with a period
+#   5. Use the imperative mood in the subject line
+#   6. Wrap the body at 72 characters
+#   7. Use the body to explain what and why vs. how