Apply some recommendations from git dx book

This commit is contained in:
Maximilian Friedersdorff 2024-12-02 12:13:41 +00:00
parent 82e3fa9114
commit 911dd07d1e
9 changed files with 114 additions and 37 deletions

View file

@ -4,12 +4,28 @@
status = always status = always
interactive = always interactive = always
diff = true diff = true
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
frag = magenta bold
meta = yellow bold
new = green bold
old = red bold
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
[status]
short = true
branch = true
[user] [user]
name = Maximilian Friedersdorff name = Maximilian Friedersdorff
email = {{ .email | quote }} email = "max@gwairfelin.com"
[core] [includeIf "gitdir:~/src/esl/"]
editor = nvim path = ~/.config/git/config-esl
excludesfile = {{ .chezmoi.homeDir }}/.gitignore
[diff] [diff]
tool = vimdiff tool = vimdiff
[merge] [merge]
@ -22,10 +38,9 @@
hist = log --graph --full-history --all --pretty=format:'%Cred%h%Creset %G? %ad %s %C(bold blue)<%an>%Creset %C(yellow)%d%Creset' --date=short hist = log --graph --full-history --all --pretty=format:'%Cred%h%Creset %G? %ad %s %C(bold blue)<%an>%Creset %C(yellow)%d%Creset' --date=short
struct = log --graph --full-history --all --pretty=format:'%ad %s %Creset %C(yellow)%d%Creset' --date=short --simplify-by-decoration struct = log --graph --full-history --all --pretty=format:'%ad %s %Creset %C(yellow)%d%Creset' --date=short --simplify-by-decoration
co = checkout co = checkout
ci = commit c = commit
st = status s = status
br = branch d = diff
df = diff
commit = commit -S commit = commit -S
vt = tag -v vt = tag -v
tag = tag -s tag = tag -s
@ -43,3 +58,5 @@
smtpserverport = 587 smtpserverport = 587
[mergetool "vimdiff"] [mergetool "vimdiff"]
cmd = nvim -d $LOCAL $BASE $REMOTE $MERGED -c "$wincmd w" -c "wincmd J" cmd = nvim -d $LOCAL $BASE $REMOTE $MERGED -c "$wincmd w" -c "wincmd J"
[help]
autoCorrect = immediate

View file

@ -0,0 +1,2 @@
[user]
email = "maximilian.friedersdorff@envsys.co.uk"

View file

@ -0,0 +1,52 @@
## VIM specific patterns
# Swap
[._]*.s[a-v][a-z]
!*.svg # comment out if you don't need vector files
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
*~
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
## Linux specific patterns
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
## Python specific settings
# Rope project settings
.ropeproject
# Distribution / packaging
.Python
build/
dist/
*.egg
*.egg-info/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

View file

@ -0,0 +1,2 @@
[status]
disabled = false

View file

@ -1,6 +0,0 @@
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~

29
home/dot_shell_aliases Normal file
View file

@ -0,0 +1,29 @@
if [ -x /usr/bin/dircolors ]; then
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
function la {
ls_out=$(\ls -lah --color=always "$@")
let "allowed_lines = $(tput lines) - 3"
if [ $(echo "$ls_out" | wc -l) -le $allowed_lines ]; then
echo "$ls_out"
else
echo "$ls_out" | less -r
fi
}
function search() {
quoted=$(python -c "import urllib.parse, sys; print(urllib.parse.quote_plus(' '.join(sys.argv[1:])))" "${@}")
w3m "https://duckduckgo.com/?q=${quoted}"
}
alias black='black --line-length 99'
alias cdtmp='cd $(mktemp -d)'
alias g='git'

View file

@ -18,13 +18,6 @@ export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quo
export EDITOR="nvim" export EDITOR="nvim"
export TMPDIR="/tmp/${USER}" export TMPDIR="/tmp/${USER}"
export GIT_PS1_SHOWDIRTYSTATE=true
export GIT_PS1_SHOWSTASHSTATE=true
export GIT_PS1_SHOWUNTRACKEDFILEDS=true
export GIT_PS1_SHOWUPSTREAM="verbose"
export GIT_PS1_DESCRIBE_STYLE="branch"
export GIT_PS1_SHOWCOLORHINTS="color"
eval $(dircolors ~/.dir_colors) eval $(dircolors ~/.dir_colors)
export GPG_TTY=$(tty) export GPG_TTY=$(tty)

View file

@ -28,16 +28,6 @@ unsetopt beep notify
bindkey -v bindkey -v
# End of lines configured by zsh-newuser-install # End of lines configured by zsh-newuser-install
# Prompt
NEWLINE=$'\n'
setopt prompt_subst
p="%(?;%F{green};%F{red})[%h]%f "
p+="%F{red}%B%n%b%f@%F{red}%B%m%b%f"
p+=":%F{blue}%~%f"
p+="${NEWLINE}%(!.#.$) "
virtual_env() { virtual_env() {
if [ -n "${VIRTUAL_ENV+1}" ]; then if [ -n "${VIRTUAL_ENV+1}" ]; then
home_rel_path=$(echo ${VIRTUAL_ENV} | sed "s;^${HOME};~;") home_rel_path=$(echo ${VIRTUAL_ENV} | sed "s;^${HOME};~;")
@ -45,11 +35,6 @@ virtual_env() {
fi fi
} }
source ~/.git-prompt.sh
precmd () {
__git_ps1 "" "$(virtual_env)${p}" "${NEWLINE}[%s]${NEWLINE}"
}
bindkey '^R' history-incremental-search-backward bindkey '^R' history-incremental-search-backward
if [[ -f ~/.shell_aliases ]]; then if [[ -f ~/.shell_aliases ]]; then
@ -106,3 +91,5 @@ scrot() {
grim -g "$(slurp)" "$tmp_file" grim -g "$(slurp)" "$tmp_file"
echo "$tmp_file" echo "$tmp_file"
} }
eval "$(starship init zsh)"

View file

@ -11,4 +11,5 @@ sudo pacman -Syu --needed \
firefox \ firefox \
claws-mail \ claws-mail \
tmux \ tmux \
age age \
starship