From 6602c4da84e7fad360983f5a1dc7818ba4d1c091 Mon Sep 17 00:00:00 2001 From: Konstantin Bukley Date: Thu, 20 Mar 2025 15:59:13 +0200 Subject: [PATCH] dotfiles: sync --- Brewfile | 1 + alacritty/.config/alacritty/alacritty.toml | 8 +- bash/.bash_profile | 2 - bash/.bashrc | 119 +++++++++++++++++---- git/.gitconfig | 14 ++- 5 files changed, 118 insertions(+), 26 deletions(-) diff --git a/Brewfile b/Brewfile index c63b0eb..ec959bb 100644 --- a/Brewfile +++ b/Brewfile @@ -27,6 +27,7 @@ brew 'jq' brew 'kubectl' brew 'kubectx' brew 'mas' +brew 'ncdu' brew 'neovim' brew 'nmap' brew 'node' diff --git a/alacritty/.config/alacritty/alacritty.toml b/alacritty/.config/alacritty/alacritty.toml index ad5fa91..1590568 100644 --- a/alacritty/.config/alacritty/alacritty.toml +++ b/alacritty/.config/alacritty/alacritty.toml @@ -1,4 +1,3 @@ -live_config_reload = true [colors] draw_bold_text_with_bright_colors = true @@ -114,7 +113,7 @@ hide_when_typing = true [selection] semantic_escape_chars = ",│`|:\"' ()[]{}<>" -[shell] +[terminal.shell] args = ["-l", "-c", "/opt/homebrew/bin/tmux attach || /opt/homebrew/bin/tmux"] program = "/bin/bash" @@ -130,3 +129,8 @@ lines = 24 [window.padding] x = 0 y = 0 + +[general] +live_config_reload = true + +[terminal] diff --git a/bash/.bash_profile b/bash/.bash_profile index 8d2ca68..ec9ae94 100644 --- a/bash/.bash_profile +++ b/bash/.bash_profile @@ -1,3 +1 @@ if [ -f ~/.bashrc ]; then . ~/.bashrc; fi - -[ -f /opt/homebrew/opt/asdf/libexec/asdf.sh ] && . /opt/homebrew/opt/asdf/libexec/asdf.sh diff --git a/bash/.bashrc b/bash/.bashrc index c5d4575..0826bb4 100644 --- a/bash/.bashrc +++ b/bash/.bashrc @@ -1,12 +1,12 @@ -[ -f /opt/homebrew/opt/asdf/libexec/asdf.sh ] \ - && . /opt/homebrew/opt/asdf/libexec/asdf.sh -[ -f /etc/bash_completion ] && . /etc/bash_completion -[ -f ~/.fzf.bash ] && . ~/.fzf.bash -[ -f ~/.cargo/env ] && . ~/.cargo/env +[ -f /opt/homebrew/opt/asdf/libexec/asdf.sh ] && + . /opt/homebrew/opt/asdf/libexec/asdf.sh +[ -f /etc/bash_completion ] && . /etc/bash_completion +[ -f ~/.fzf.bash ] && . ~/.fzf.bash +[ -f ~/.cargo/env ] && . ~/.cargo/env [ -f ~/Syncthing/secrets.sh ] && . ~/Syncthing/secrets.sh if [ -x /usr/libexec/path_helper ]; then - eval `/usr/libexec/path_helper -s` + eval $(/usr/libexec/path_helper -s) fi # Save 10,000 lines of history in memory @@ -55,10 +55,10 @@ export FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES alias ~='cd ~' -alias l='exa' -alias ls='exa' -alias ll='exa -l' -alias tree='exa --tree' +alias l='eza' +alias ls='eza' +alias ll='eza -l' +alias tree='eza --tree' alias vim='nvim' alias vi='nvim' alias v='nvim' @@ -72,12 +72,14 @@ alias md='mkdir -p' alias gco='git checkout' alias gcom='git checkout master' alias gcob='git checkout -b' +# TODO: git checkout --track origin/$1 +# alias gcot='git checkout' alias gd='git diff' alias gdc='git diff --cached' alias gdn='git diff --no-index' alias gc='git commit' alias gca='git commit --amend' -alias gcw='git commit -m "wip"' +alias gcw='git commit --no-verify -m "wip"' alias gs='git status -sb' alias ga='git add' alias grm='git rm' @@ -91,8 +93,8 @@ alias gl='git lg' alias gr='git reset' alias gr1='git reset HEAD~1' # alias gh='git lg -1' -function gcm () { - git commit -m "$*" +function gcm() { + git commit --no-verify -m "$*" } alias fs='foreman start' @@ -138,16 +140,86 @@ alias oclean="fd . '/Users/madundead/Syncthing/Obsidian/Personal' | rg sync-conf alias proxy='kubectl port-forward -n staging svc/tinyproxy-svc 8888:8888' -fzf_kill() { - local pids=$( - ps -f -u $USER | sed 1d | fzf --multi | tr -s [:blank:] | cut -d' ' -f3 - ) - if [[ -n $pids ]]; then - echo "$pids" | xargs kill -9 "$@" - fi +# Experimental +alias ports='lsof -iTCP -sTCP:LISTEN -n -P' + +o() { + files="$(fzf --print0 --preview "bat --theme ansi --color always {}")" + if [ -z "$files" ]; then + return + fi + echo -n "$files" | xargs -0 -o "$EDITOR" } -alias fkill='fzf_kill' +man() { + env \ + LESS_TERMCAP_mb=$(printf "\\e[1;31m") \ + LESS_TERMCAP_md=$(printf "\\e[1;31m") \ + LESS_TERMCAP_me=$(printf "\\e[0m") \ + LESS_TERMCAP_se=$(printf "\\e[0m") \ + LESS_TERMCAP_so=$(printf "\\e[1;44;33m") \ + LESS_TERMCAP_ue=$(printf "\\e[0m") \ + LESS_TERMCAP_us=$(printf "\\e[0;32m") \ + man "$@" +} + +function ex { + if [ $# -eq 0 ]; then + # display usage if no parameters given + echo "Usage: ex ." + echo " ex [path/file_name_2.ext] [path/file_name_3.ext]" + fi + for n in "$@"; do + if [ ! -f "$n" ]; then + echo "'$n' - file doesn't exist" + return 1 + fi + + case "${n%,}" in + *.cbt | *.tar.bz2 | *.tar.gz | *.tar.xz | *.tbz2 | *.tgz | *.txz | *.tar) + tar zxvf "$n" + ;; + *.lzma) unlzma ./"$n" ;; + *.bz2) bunzip2 ./"$n" ;; + *.cbr | *.rar) unrar x -ad ./"$n" ;; + *.gz) gunzip ./"$n" ;; + *.cbz | *.epub | *.zip) unzip ./"$n" ;; + *.z) uncompress ./"$n" ;; + *.7z | *.apk | *.arj | *.cab | *.cb7 | *.chm | *.deb | *.iso | *.lzh | *.msi | *.pkg | *.rpm | *.udf | *.wim | *.xar | *.vhd) + 7z x ./"$n" + ;; + *.xz) unxz ./"$n" ;; + *.exe) cabextract ./"$n" ;; + *.cpio) cpio -id <./"$n" ;; + *.cba | *.ace) unace x ./"$n" ;; + *.zpaq) zpaq x ./"$n" ;; + *.arc) arc e ./"$n" ;; + *.cso) ciso 0 ./"$n" ./"$n.iso" && + extract "$n.iso" && \rm -f "$n" ;; + *.zlib) zlib-flate -uncompress <./"$n" >./"$n.tmp" && + mv ./"$n.tmp" ./"${n%.*zlib}" && rm -f "$n" ;; + *.dmg) + hdiutil mount ./"$n" -mountpoint "./$n.mounted" + ;; + *.tar.zst) tar -I zstd -xvf ./"$n" ;; + *.zst) zstd -d ./"$n" ;; + *) + echo "ex: '$n' - unknown archive method" + return 1 + ;; + esac + done +} + +fkill() { + local pids=$( + ps -f -u $USER | sed 1d | fzf --multi | tr -s [:blank:] | cut -d' ' -f3 + ) + if [[ -n $pids ]]; then + echo "$pids" | xargs kill -9 "$@" + fi +} +alias fk='fkill' # Homebrew stuff export MANPATH=/usr/local/share/man:$MANPATH @@ -162,6 +234,11 @@ export PATH="/opt/homebrew/opt/arm-gcc-bin@8/bin:$PATH" export PATH="/usr/local/sbin:$PATH" export PATH="/usr/local/opt/avr-gcc@8/bin:$PATH" export PATH="/usr/local/opt/arm-gcc-bin@8/bin:$PATH" +export PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH" + +# bun +export BUN_INSTALL="$HOME/.bun" +export PATH=$BUN_INSTALL/bin:$PATH export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" diff --git a/git/.gitconfig b/git/.gitconfig index 28a1b1d..b7ffd5c 100644 --- a/git/.gitconfig +++ b/git/.gitconfig @@ -83,6 +83,8 @@ excludesfile = ~/.gitignore_global attributesfile = ~/.gitattributes + ignorecase = false + # Treat spaces before tabs and all kinds of trailing whitespace as an error # [default] trailing-space: looks for spaces at the end of a line # [default] space-before-tab: looks for spaces before tabs at the beginning of a line @@ -160,7 +162,6 @@ insteadOf = "github:" [url "git@gist.github.com:"] - insteadOf = "gst:" pushInsteadOf = "gist:" pushInsteadOf = "git://gist.github.com/" @@ -170,3 +171,14 @@ [diff-so-fancy] markEmptyLines = false + +[merge] + tool = nvim + +[mergetool] + keepBackup = false + +[mergetool "nvim"] + cmd = nvim -d $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J' +[pull] + default = current