diff --git a/.config/autorandr/delta-tls/config b/.config/autorandr/delta-tls/config new file mode 100644 index 0000000..e5aa834 --- /dev/null +++ b/.config/autorandr/delta-tls/config @@ -0,0 +1,33 @@ +output DisplayPort-1-0 +off +output HDMI-A-1-0 +off +output DisplayPort-1-2 +off +output eDP +crtc 0 +gamma 1.0:0.833:0.769 +mode 1920x1080 +pos 0x0 +primary +rate 240.00 +x-prop-max_bpc 16 +x-prop-non_desktop 0 +x-prop-scaling_mode None +x-prop-tearfree auto +x-prop-underscan off +x-prop-underscan_hborder 0 +x-prop-underscan_vborder 0 +output DisplayPort-1-1 +crtc 4 +gamma 1.0:0.833:0.769 +mode 1920x1080 +pos 1920x0 +rate 60.00 +x-prop-max_bpc 8 +x-prop-non_desktop 0 +x-prop-scaling_mode None +x-prop-tearfree auto +x-prop-underscan off +x-prop-underscan_hborder 0 +x-prop-underscan_vborder 0 diff --git a/.config/autorandr/delta-tls/setup b/.config/autorandr/delta-tls/setup new file mode 100644 index 0000000..bfc12cb --- /dev/null +++ b/.config/autorandr/delta-tls/setup @@ -0,0 +1,2 @@ +DisplayPort-1-1 00ffffffffffff004c2d200d34415743191e010380341d782a9315a655519c27115054bfef80714f81c0810081809500a9c0b3000101023a801871382d40582c450009252100001e000000fd00324b1e5111000a202020202020000000fc00533234463335300a2020202020000000ff0048345a4e3630323031370a20200114020311814690041f13120365030c001000011d00bc52d01e20b828554009252100001e8c0ad090204031200c4055000925210000188c0ad08a20e02d10103e9600092521000018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000081 +eDP 00ffffffffffff004d105d1500000000171f0104a522137807de50a3544c99260f505400000001010101010101010101010101010101edec80a0703887403020350058c2100000183c3b80a0703887403020350058c210000018000000100000000000000000000000000000000000fc004c513135364d314a5730330a2000c3 diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index eec0aeb..6f5cd18 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -69,3 +69,5 @@ vim.cmd("source ~/.config/nvim/epitech.vim") -- remove trailing whitespaces vim.keymap.set("n", "e", "exe getline(line('.'))") vim.keymap.set("n", "f", "%s/\\s\\+$//e") +vim.keymap.set("n", "n", "nzz") +vim.keymap.set("n", "p", "pzz") diff --git a/.config/nvim/pack/plugins/opt/telescope b/.config/nvim/pack/plugins/opt/telescope index 4522d7e..20bf205 160000 --- a/.config/nvim/pack/plugins/opt/telescope +++ b/.config/nvim/pack/plugins/opt/telescope @@ -1 +1 @@ -Subproject commit 4522d7e3ea75ffddabdc39957168a8a7060b5df0 +Subproject commit 20bf20500c95208c3ac0ef07245065bf94dcab15 diff --git a/.config/zsh/.p10k.zsh b/.config/zsh/.p10k.zsh index 71a42a6..0a9683d 100644 --- a/.config/zsh/.p10k.zsh +++ b/.config/zsh/.p10k.zsh @@ -1,7 +1,7 @@ -# Generated by Powerlevel10k configuration wizard on 2022-12-16 at 08:55 CET. -# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 30611. +# Generated by Powerlevel10k configuration wizard on 2023-11-07 at 21:34 CET. +# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 03275. # Wizard options: nerdfont-complete + powerline, small icons, unicode, lean, 1 line, -# compact, few icons, concise, instant_prompt=off. +# compact, few icons, concise, instant_prompt=quiet. # Type `p10k configure` to generate another config. # # Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate @@ -84,10 +84,12 @@ nordvpn # nordvpn connection status, linux only (https://nordvpn.com/) ranger # ranger shell (https://github.com/ranger/ranger) nnn # nnn shell (https://github.com/jarun/nnn) + lf # lf shell (https://github.com/gokcehan/lf) xplr # xplr shell (https://github.com/sayanarijit/xplr) vim_shell # vim shell indicator (:sh) midnight_commander # midnight commander shell (https://midnight-commander.org/) nix_shell # nix shell (https://nixos.org/nixos/nix-pills/developing-with-nix-shell.html) + chezmoi_shell # chezmoi shell (https://www.chezmoi.io/) # vpn_ip # virtual private network indicator # load # CPU load # disk_usage # disk usage @@ -530,9 +532,9 @@ ###################[ command_execution_time: duration of the last command ]################### # Show duration of the last command if takes at least this many seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=0 + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_THRESHOLD=3 # Show this many fractional digits. Zero means round to seconds. - typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=2 + typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_PRECISION=0 # Execution time color. typeset -g POWERLEVEL9K_COMMAND_EXECUTION_TIME_FOREGROUND=101 # Duration format: 1d 2h 3m 4s. @@ -717,6 +719,12 @@ # Custom icon. # typeset -g POWERLEVEL9K_NNN_VISUAL_IDENTIFIER_EXPANSION='⭐' + ######################[ lf: lf shell (https://github.com/gokcehan/lf) ]####################### + # lf shell color. + typeset -g POWERLEVEL9K_LF_FOREGROUND=72 + # Custom icon. + # typeset -g POWERLEVEL9K_LF_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################[ xplr: xplr shell (https://github.com/sayanarijit/xplr) ]################## # xplr shell color. typeset -g POWERLEVEL9K_XPLR_FOREGROUND=72 @@ -739,12 +747,21 @@ # Nix shell color. typeset -g POWERLEVEL9K_NIX_SHELL_FOREGROUND=74 + # Display the icon of nix_shell if PATH contains a subdirectory of /nix/store. + # typeset -g POWERLEVEL9K_NIX_SHELL_INFER_FROM_PATH=false + # Tip: If you want to see just the icon without "pure" and "impure", uncomment the next line. # typeset -g POWERLEVEL9K_NIX_SHELL_CONTENT_EXPANSION= # Custom icon. # typeset -g POWERLEVEL9K_NIX_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################[ chezmoi_shell: chezmoi shell (https://www.chezmoi.io/) ]################## + # chezmoi shell color. + typeset -g POWERLEVEL9K_CHEZMOI_SHELL_FOREGROUND=33 + # Custom icon. + # typeset -g POWERLEVEL9K_CHEZMOI_SHELL_VISUAL_IDENTIFIER_EXPANSION='⭐' + ##################################[ disk_usage: disk usage ]################################## # Colors for different levels of disk usage. typeset -g POWERLEVEL9K_DISK_USAGE_NORMAL_FOREGROUND=35 @@ -974,6 +991,11 @@ ##############[ nvm: node.js version from nvm (https://github.com/nvm-sh/nvm) ]############### # Nvm color. typeset -g POWERLEVEL9K_NVM_FOREGROUND=70 + # If set to false, hide node version if it's the same as default: + # $(nvm version current) == $(nvm version default). + typeset -g POWERLEVEL9K_NVM_PROMPT_ALWAYS_SHOW=false + # If set to false, hide node version if it's equal to "system". + typeset -g POWERLEVEL9K_NVM_SHOW_SYSTEM=true # Custom icon. # typeset -g POWERLEVEL9K_NVM_VISUAL_IDENTIFIER_EXPANSION='⭐' @@ -1176,7 +1198,7 @@ #############[ kubecontext: current kubernetes context (https://kubernetes.io/) ]############# # Show kubecontext only when the command you are typing invokes one of these tools. # Tip: Remove the next line to always show kubecontext. - typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|kxn|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold' + typeset -g POWERLEVEL9K_KUBECONTEXT_SHOW_ON_COMMAND='kubectl|kxn|helm|kubens|kubectx|oc|istioctl|kogito|k9s|helmfile|flux|fluxctl|stern|kubeseal|skaffold|kubent|kubecolor|cmctl|sparkctl' # Kubernetes context classes for the purpose of using different colors, icons and expansions with # different contexts. @@ -1474,7 +1496,7 @@ typeset -g POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION= # Regular expression for the VPN network interface. Run `ifconfig` or `ip -4 a show` while on VPN # to see the name of the interface. - typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun)|tailscale)[0-9]*' + typeset -g POWERLEVEL9K_VPN_IP_INTERFACE='(gpd|wg|(.*tun)|tailscale)[0-9]*|(zt.*)' # If set to true, show one segment per matching network interface. If set to false, show only # one segment corresponding to the first matching network interface. # Tip: If you set it to true, you'll probably want to unset POWERLEVEL9K_VPN_IP_CONTENT_EXPANSION. @@ -1614,7 +1636,7 @@ # - verbose: Enable instant prompt and print a warning when detecting console output during # zsh initialization. Choose this if you've never tried instant prompt, haven't # seen the warning, or if you are unsure what this all means. - typeset -g POWERLEVEL9K_INSTANT_PROMPT=off + typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet # Hot reload allows you to change POWERLEVEL9K options after Powerlevel10k has been initialized. # For example, you can type POWERLEVEL9K_BACKGROUND=red and see your prompt turn red. Hot reload diff --git a/.config/zsh/.zshrc b/.config/zsh/.zshrc index 4dc05c6..69e4dbd 100644 --- a/.config/zsh/.zshrc +++ b/.config/zsh/.zshrc @@ -1,17 +1,64 @@ -ZSH_THEME="powerlevel10k/powerlevel10k" -CASE_SENSITIVE="true" -zstyle ':omz:update' mode disabled +autoload -U compinit colors -plugins=(vi-mode colored-man-pages git gitignore) - -# doesn't work in .zshenv fpath=("$ZDOTDIR/completions" $fpath) -. "$ZSH"/oh-my-zsh.sh +compinit -d "$XDG_CACHE_HOME/.zcompdump-$ZSH_VERSION" -. "$ZDOTDIR"/.docker_aliases -. "$ZDOTDIR"/.kubectl_aliases -. "$ZDOTDIR"/.zsh_aliases +colors +. "$ZDOTDIR"/powerlevel10k/powerlevel10k.zsh-theme . "$ZDOTDIR/.p10k.zsh" +. "$ZDOTDIR/inputrc.zsh" + +for f in "$ZDOTDIR"/aliases/*; do + . "$f" +done + +setopt INTERACTIVE_COMMENTS +setopt LONG_LIST_JOBS + +setopt AUTO_MENU +setopt COMPLETE_IN_WORD +unsetopt FLOW_CONTROL + +setopt AUTO_CD + +setopt HIST_IGNORE_DUPS +setopt HIST_IGNORE_SPACE +setopt SHARE_HISTORY + +################# TODO ################3 +export PAGER=less +export LESS_TERMCAP_mb="${fg_bold[red]}" +export LESS_TERMCAP_md="${fg_bold[red]}" +export LESS_TERMCAP_me="${reset_color}" +export LESS_TERMCAP_so="${fg_bold[yellow]}${bg[blue]}" +export LESS_TERMCAP_se="${reset_color}" +export LESS_TERMCAP_us="${fg_bold[green]}" +export LESS_TERMCAP_ue="${reset_color}" + +. <(dircolors) +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" + +# fixme - the load process here seems a bit bizarre +zmodload -i zsh/complist + +WORDCHARS='' + +# should this be in keybindings? +bindkey -M menuselect '^o' accept-and-infer-next-history +zstyle ':completion:*:*:*:*:*' menu select + +zstyle ':completion:*' matcher-list 'r:|=*' 'l:|=* r:|=*' + +# Complete . and .. special directories +zstyle ':completion:*' special-dirs true + +zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01' + +# disable named-directories autocompletion +zstyle ':completion:*:cd:*' tag-order local-directories directory-stack path-directories + +# automatically load bash completion functions +autoload -U +X bashcompinit && bashcompinit # vim: ft=zsh diff --git a/.config/zsh/.docker_aliases b/.config/zsh/aliases/docker.zsh similarity index 100% rename from .config/zsh/.docker_aliases rename to .config/zsh/aliases/docker.zsh diff --git a/.config/zsh/.zsh_aliases b/.config/zsh/aliases/general.zsh similarity index 56% rename from .config/zsh/.zsh_aliases rename to .config/zsh/aliases/general.zsh index a91d9d5..a3c7fe7 100644 --- a/.config/zsh/.zsh_aliases +++ b/.config/zsh/aliases/general.zsh @@ -1,8 +1,8 @@ # system -alias update='sudo pacman -Syu && config submodule update --remote --recursive --init' +alias update='sudo pacman -Syu && flatpak update && config submodule update --remote --recursive --init' alias pac='sudo pacman' alias vi='$EDITOR' -alias qcp='qmv -o tabsize=4' +alias qcp='qcp -o tabsize=4' alias qmv='qmv -o tabsize=4' # conf @@ -12,19 +12,14 @@ alias wconf='(cd "$XDG_CONFIG_HOME/sway" && $EDITOR .)' alias zconf='(cd "$ZDOTDIR/" && $EDITOR .) && . "$ZDOTDIR/.zshrc"' # dev -gi() { - curl -Lf "https://www.gitignore.io/api/${(j:,:)@}" -} alias valgrind='epitest valgrind' -# compatibility -alias ssh='TERM=linux ssh' - # alias function coloralias() { $1 $(echo - "${@:2}" | sed 's/--color=\w\+/--color=always/') } +alias _='sudo ' alias sudo='sudo ' alias watch='coloralias watch -c -- ' alias xargs='xargs ' @@ -41,4 +36,21 @@ function tmp() { cd "$(mktemp -dt "$1"XXX)" } +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' +alias -g ......='../../../../..' + +alias ls='ls --color=tty' +alias lsa='ls -lah' +alias l='ls -lah' +alias ll='ls -lh' +alias la='ls -lAh' + +alias diff='diff --color' + +alias grep="grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}" +alias egrep="grep -E --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}" +alias fgrep="grep -F --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}" + # vim: ft=zsh diff --git a/.config/zsh/aliases/git.zsh b/.config/zsh/aliases/git.zsh new file mode 100644 index 0000000..3daff53 --- /dev/null +++ b/.config/zsh/aliases/git.zsh @@ -0,0 +1,247 @@ +function gi() { + curl -fL https://www.toptal.com/developers/gitignore/api/"${(j:,:)@}" +} + +function current_branch() { + git branch | awk '$1 == "*" {print $2}' +} + +function grename() { + if [[ -z "$1" || -z "$2" ]]; then + echo "Usage: $0 old_branch new_branch" + return 1 + fi + + # Rename branch locally + git branch -m "$1" "$2" + # Rename branch in origin remote + if git push origin :"$1"; then + git push --set-upstream origin "$2" + fi +} + +alias ggpur='ggu' +alias g='git' +alias ga='git add' +alias gaa='git add --all' +alias gapa='git add --patch' +alias gau='git add --update' +alias gav='git add --verbose' +alias gam='git am' +alias gama='git am --abort' +alias gamc='git am --continue' +alias gamscp='git am --show-current-patch' +alias gams='git am --skip' +alias gap='git apply' +alias gapt='git apply --3way' +alias gbs='git bisect' +alias gbsb='git bisect bad' +alias gbsg='git bisect good' +alias gbsn='git bisect new' +alias gbso='git bisect old' +alias gbsr='git bisect reset' +alias gbss='git bisect start' +alias gbl='git blame -w' +alias gb='git branch' +alias gba='git branch --all' +alias gbd='git branch --delete' +alias gbD='git branch --delete --force' + +alias gbgd='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -d' +alias gbgD='LANG=C git branch --no-color -vv | grep ": gone\]" | awk '"'"'{print $1}'"'"' | xargs git branch -D' +alias gbm='git branch --move' +alias gbnm='git branch --no-merged' +alias gbr='git branch --remote' +alias ggsup='git branch --set-upstream-to=origin/$(current_branch)' +alias gbg='LANG=C git branch -vv | grep ": gone\]"' +alias gco='git checkout' +alias gcor='git checkout --recurse-submodules' +alias gcb='git checkout -b' +alias gcp='git cherry-pick' +alias gcpa='git cherry-pick --abort' +alias gcpc='git cherry-pick --continue' +alias gclean='git clean --interactive -d' +alias gcl='git clone --recurse-submodules' + +function gccd() { + gcl "$@" && cd "$(basename "$_")" +} +compdef _git gccd=git-clone + +alias gcam='git commit --all --message' +alias gcas='git commit --all --signoff' +alias gcasm='git commit --all --signoff --message' +alias gcs='git commit --gpg-sign' +alias gcss='git commit --gpg-sign --signoff' +alias gcssm='git commit --gpg-sign --signoff --message' +alias gcmsg='git commit --message' +alias gcsm='git commit --signoff --message' +alias gc='git commit --verbose' +alias gca='git commit --verbose --all' +alias gca!='git commit --verbose --all --amend' +alias gcan!='git commit --verbose --all --no-edit --amend' +alias gcans!='git commit --verbose --all --signoff --no-edit --amend' +alias gc!='git commit --verbose --amend' +alias gcn!='git commit --verbose --no-edit --amend' +alias gcf='git config --list' +alias gdct='git describe --tags $(git rev-list --tags --max-count=1)' +alias gd='git diff' +alias gdca='git diff --cached' +alias gdcw='git diff --cached --word-diff' +alias gds='git diff --staged' +alias gdw='git diff --word-diff' + +function gdv() { + git diff -w "$@" | view - +} +compdef _git gdv=git-diff + +alias gdup='git diff @{upstream}' + +alias gdt='git diff-tree --no-commit-id --name-only -r' +alias gf='git fetch' +# --jobs= was added in git 2.8 +alias gfa='git fetch --all --prune --jobs=10' +alias gfo='git fetch origin' +alias gg='git gui citool' +alias gga='git gui citool --amend' +alias ghh='git help' +alias glgg='git log --graph' +alias glgga='git log --graph --decorate --all' +alias glgm='git log --graph --max-count=10' +alias glods='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset" --date=short' +alias glod='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset"' +alias glola='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --all' +alias glols='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset" --stat' +alias glol='git log --graph --pretty="%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset"' +alias glo='git log --oneline --decorate' +alias glog='git log --oneline --decorate --graph' +alias gloga='git log --oneline --decorate --graph --all' + +# Pretty log messages +function _git_log_prettily() { + if ! [ -z $1 ]; then + git log --pretty=$1 + fi +} +compdef _git _git_log_prettily=git-log + +alias glp='_git_log_prettily' +alias glg='git log --stat' +alias glgp='git log --stat --patch' +alias gignored='git ls-files -v | grep "^[[:lower:]]"' +alias gfg='git ls-files | grep' +alias gm='git merge' +alias gma='git merge --abort' +alias gms="git merge --squash" +alias gmtl='git mergetool --no-prompt' +alias gmtlvim='git mergetool --no-prompt --tool=vimdiff' + +alias gl='git pull' +alias gpr='git pull --rebase' +alias gprv='git pull --rebase -v' +alias gpra='git pull --rebase --autostash' +alias gprav='git pull --rebase --autostash -v' + +function ggu() { + [[ "$#" != 1 ]] && local b="$(current_branch)" + git pull --rebase origin "${b:=$1}" +} +compdef _git ggu=git-checkout + +alias ggpull='git pull origin "$(current_branch)"' + +function ggl() { + if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then + git pull origin "${*}" + else + [[ "$#" == 0 ]] && local b="$(current_branch)" + git pull origin "${b:=$1}" + fi +} +compdef _git ggl=git-checkout + +alias gluc='git pull upstream $(current_branch)' +alias gp='git push' +alias gpd='git push --dry-run' + +function ggf() { + [[ "$#" != 1 ]] && local b="$(current_branch)" + git push --force origin "${b:=$1}" +} +compdef _git ggf=git-checkout + +alias gpf!='git push --force' +alias gpf='git push --force-with-lease --force-if-includes' + +function ggfl() { + [[ "$#" != 1 ]] && local b="$(current_branch)" + git push --force-with-lease origin "${b:=$1}" +} +compdef _git ggfl=git-checkout + +alias gpsup='git push --set-upstream origin $(current_branch)' +alias gpsupf='git push --set-upstream origin $(current_branch) --force-with-lease --force-if-includes' +alias gpv='git push --verbose' +alias gpoat='git push origin --all && git push origin --tags' +alias gpod='git push origin --delete' +alias ggpush='git push origin "$(current_branch)"' +alias gpu='git push upstream' +alias grb='git rebase' +alias grba='git rebase --abort' +alias grbc='git rebase --continue' +alias grbi='git rebase --interactive' +alias grbo='git rebase --onto' +alias grbs='git rebase --skip' +alias gr='git remote' +alias grv='git remote --verbose' +alias gra='git remote add' +alias grrm='git remote remove' +alias grmv='git remote rename' +alias grset='git remote set-url' +alias grup='git remote update' +alias grh='git reset' +alias gru='git reset --' +alias grhh='git reset --hard' +alias grhk='git reset --keep' +alias grhs='git reset --soft' +alias gpristine='git reset --hard && git clean --force -dfx' +alias groh='git reset origin/$(current_branch) --hard' +alias grs='git restore' +alias grss='git restore --source' +alias grst='git restore --staged' +alias grev='git revert' +alias grm='git rm' +alias grmc='git rm --cached' +alias grt='cd "$(git rev-parse --show-toplevel || echo .)"' +alias gcount='git shortlog --summary --numbered' +alias gsh='git show' +alias gsps='git show --pretty=short --show-signature' +alias gstall='git stash --all' +alias gstaa='git stash apply' +alias gstc='git stash clear' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gsta='git stash push' +alias gsts='git stash show --patch' +alias gst='git status' +alias gss='git status --short' +alias gsb='git status --short --branch' +alias gsi='git submodule init' +alias gsu='git submodule update' +alias gsw='git switch' +alias gswc='git switch --create' +alias gta='git tag --annotate' +alias gts='git tag --sign' +alias gtv='git tag | sort -V' +alias gignore='git update-index --assume-unchanged' +alias gunignore='git update-index --no-assume-unchanged' +alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' +alias gwt='git worktree' +alias gwta='git worktree add' +alias gwtls='git worktree list' +alias gwtmv='git worktree move' +alias gwtrm='git worktree remove' +alias gstu='gsta --include-untracked' +alias gtl='gtl(){ git tag --sort=-v:refname -n --list "${1}*" }; noglob gtl' diff --git a/.config/zsh/.kubectl_aliases b/.config/zsh/aliases/kubectl.zsh similarity index 100% rename from .config/zsh/.kubectl_aliases rename to .config/zsh/aliases/kubectl.zsh diff --git a/.config/zsh/completions/_gi b/.config/zsh/completions/_gi new file mode 100644 index 0000000..492a817 --- /dev/null +++ b/.config/zsh/completions/_gi @@ -0,0 +1,10 @@ +#compdef gi + +_gitignoreio_get_command_list() { + curl -sfL https://www.toptal.com/developers/gitignore/api/list | tr "," "\n" +} + +_gi () { + compset -P '*,' + compadd -S '' `_gitignoreio_get_command_list` +} diff --git a/.config/zsh/custom/themes/powerlevel10k b/.config/zsh/custom/themes/powerlevel10k deleted file mode 160000 index 4306167..0000000 --- a/.config/zsh/custom/themes/powerlevel10k +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 430616734aa06ff3def48cb511fb43db7466a64e diff --git a/.config/zsh/inputrc.zsh b/.config/zsh/inputrc.zsh new file mode 100644 index 0000000..c504250 --- /dev/null +++ b/.config/zsh/inputrc.zsh @@ -0,0 +1,313 @@ +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets + +# Make sure that the terminal is in application mode when zle is active, since +# only then values from $terminfo are valid +if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then + function zle-line-init() { + echoti smkx + } + function zle-line-finish() { + echoti rmkx + } + zle -N zle-line-init + zle -N zle-line-finish +fi + +# Use emacs key bindings +bindkey -e + +# [PageUp] - Up a line of history +if [[ -n "${terminfo[kpp]}" ]]; then + bindkey -M emacs "${terminfo[kpp]}" up-line-or-history + bindkey -M viins "${terminfo[kpp]}" up-line-or-history + bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history +fi +# [PageDown] - Down a line of history +if [[ -n "${terminfo[knp]}" ]]; then + bindkey -M emacs "${terminfo[knp]}" down-line-or-history + bindkey -M viins "${terminfo[knp]}" down-line-or-history + bindkey -M vicmd "${terminfo[knp]}" down-line-or-history +fi + +# Start typing + [Up-Arrow] - fuzzy find history forward +if [[ -n "${terminfo[kcuu1]}" ]]; then + autoload -U up-line-or-beginning-search + zle -N up-line-or-beginning-search + + bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search + bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search + bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search +fi +# Start typing + [Down-Arrow] - fuzzy find history backward +if [[ -n "${terminfo[kcud1]}" ]]; then + autoload -U down-line-or-beginning-search + zle -N down-line-or-beginning-search + + bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search + bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search + bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search +fi + +# [Home] - Go to beginning of line +if [[ -n "${terminfo[khome]}" ]]; then + bindkey -M emacs "${terminfo[khome]}" beginning-of-line + bindkey -M viins "${terminfo[khome]}" beginning-of-line + bindkey -M vicmd "${terminfo[khome]}" beginning-of-line +fi +# [End] - Go to end of line +if [[ -n "${terminfo[kend]}" ]]; then + bindkey -M emacs "${terminfo[kend]}" end-of-line + bindkey -M viins "${terminfo[kend]}" end-of-line + bindkey -M vicmd "${terminfo[kend]}" end-of-line +fi + +# [Shift-Tab] - move through the completion menu backwards +if [[ -n "${terminfo[kcbt]}" ]]; then + bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete + bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete + bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete +fi + +# [Backspace] - delete backward +bindkey -M emacs '^?' backward-delete-char +bindkey -M viins '^?' backward-delete-char +bindkey -M vicmd '^?' backward-delete-char +# [Delete] - delete forward +if [[ -n "${terminfo[kdch1]}" ]]; then + bindkey -M emacs "${terminfo[kdch1]}" delete-char + bindkey -M viins "${terminfo[kdch1]}" delete-char + bindkey -M vicmd "${terminfo[kdch1]}" delete-char +else + bindkey -M emacs "^[[3~" delete-char + bindkey -M viins "^[[3~" delete-char + bindkey -M vicmd "^[[3~" delete-char + + bindkey -M emacs "^[3;5~" delete-char + bindkey -M viins "^[3;5~" delete-char + bindkey -M vicmd "^[3;5~" delete-char +fi + +# [Ctrl-Delete] - delete whole forward-word +bindkey -M emacs '^[[3;5~' kill-word +bindkey -M viins '^[[3;5~' kill-word +bindkey -M vicmd '^[[3;5~' kill-word + +# [Ctrl-RightArrow] - move forward one word +bindkey -M emacs '^[[1;5C' forward-word +bindkey -M viins '^[[1;5C' forward-word +bindkey -M vicmd '^[[1;5C' forward-word +# [Ctrl-LeftArrow] - move backward one word +bindkey -M emacs '^[[1;5D' backward-word +bindkey -M viins '^[[1;5D' backward-word +bindkey -M vicmd '^[[1;5D' backward-word + + +bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark +bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls +bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. +bindkey ' ' magic-space # [Space] - don't do history expansion + + +# Edit the current command line in $EDITOR +autoload -U edit-command-line +zle -N edit-command-line +bindkey '\C-x\C-e' edit-command-line + +# file rename magick +bindkey "^[m" copy-prev-shell-word + +# consider emacs keybindings: + +#bindkey -e ## emacs key bindings +# +#bindkey '^[[A' up-line-or-search +#bindkey '^[[B' down-line-or-search +#bindkey '^[^[[C' emacs-forward-word +#bindkey '^[^[[D' emacs-backward-word +# +#bindkey -s '^X^Z' '%-^M' +#bindkey '^[e' expand-cmd-path +#bindkey '^[^I' reverse-menu-complete +#bindkey '^X^N' accept-and-infer-next-history +#bindkey '^W' kill-region +#bindkey '^I' complete-word +## Fix weird sequence that rxvt produces +#bindkey -s '^[[Z' '\t' +# + +# Control whether to force a redraw on each mode change. +# +# Resetting the prompt on every mode change can cause lag when switching modes. +# This is especially true if the prompt does things like checking git status. +# +# Set to "true" to force the prompt to reset on each mode change. +# Unset or set to any other value to do the opposite. +# +# The default is not to reset, unless we're showing the mode in RPS1. +typeset -g VI_MODE_RESET_PROMPT_ON_MODE_CHANGE +# Control whether to change the cursor style on mode change. +# +# Set to "true" to change the cursor on each mode change. +# Unset or set to any other value to do the opposite. +typeset -g VI_MODE_SET_CURSOR + +# Control how the cursor appears in the various vim modes. This only applies +# if $VI_MODE_SET_CURSOR=true. +# +# See https://vt100.net/docs/vt510-rm/DECSCUSR for cursor styles +typeset -g VI_MODE_CURSOR_NORMAL=2 +typeset -g VI_MODE_CURSOR_VISUAL=6 +typeset -g VI_MODE_CURSOR_INSERT=6 +typeset -g VI_MODE_CURSOR_OPPEND=0 + +typeset -g VI_KEYMAP=main + +function _vi-mode-set-cursor-shape-for-keymap() { + [[ "$VI_MODE_SET_CURSOR" = true ]] || return + + # https://vt100.net/docs/vt510-rm/DECSCUSR + local _shape=0 + case "${1:-${VI_KEYMAP:-main}}" in + main) _shape=$VI_MODE_CURSOR_INSERT ;; # vi insert: line + viins) _shape=$VI_MODE_CURSOR_INSERT ;; # vi insert: line + isearch) _shape=$VI_MODE_CURSOR_INSERT ;; # inc search: line + command) _shape=$VI_MODE_CURSOR_INSERT ;; # read a command name + vicmd) _shape=$VI_MODE_CURSOR_NORMAL ;; # vi cmd: block + visual) _shape=$VI_MODE_CURSOR_VISUAL ;; # vi visual mode: block + viopp) _shape=$VI_MODE_CURSOR_OPPEND ;; # vi operation pending: blinking block + *) _shape=0 ;; + esac + printf $'\e[%d q' "${_shape}" +} + +function _visual-mode { + typeset -g VI_KEYMAP=visual + _vi-mode-set-cursor-shape-for-keymap "$VI_KEYMAP" + zle .visual-mode +} +zle -N visual-mode _visual-mode + +function _vi-mode-should-reset-prompt() { + # If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE is unset (default), dynamically + # check whether we're using the prompt to display vi-mode info + if [[ -z "${VI_MODE_RESET_PROMPT_ON_MODE_CHANGE:-}" ]]; then + [[ "${PS1} ${RPS1}" = *'$(vi_mode_prompt_info)'* ]] + return $? + fi + + # If $VI_MODE_RESET_PROMPT_ON_MODE_CHANGE was manually set, let's check + # if it was specifically set to true or it was disabled with any other value + [[ "${VI_MODE_RESET_PROMPT_ON_MODE_CHANGE}" = true ]] +} + +# Updates editor information when the keymap changes. +function zle-keymap-select() { + # update keymap variable for the prompt + typeset -g VI_KEYMAP=$KEYMAP + + if _vi-mode-should-reset-prompt; then + zle reset-prompt + zle -R + fi + _vi-mode-set-cursor-shape-for-keymap "${VI_KEYMAP}" +} +zle -N zle-keymap-select + +# These "echoti" statements were originally set in lib/key-bindings.zsh +# Not sure the best way to extend without overriding. +function zle-line-init() { + local prev_vi_keymap="${VI_KEYMAP:-}" + typeset -g VI_KEYMAP=main + [[ "$prev_vi_keymap" != 'main' ]] && _vi-mode-should-reset-prompt && zle reset-prompt + (( ! ${+terminfo[smkx]} )) || echoti smkx + _vi-mode-set-cursor-shape-for-keymap "${VI_KEYMAP}" +} +zle -N zle-line-init + +function zle-line-finish() { + typeset -g VI_KEYMAP=main + (( ! ${+terminfo[rmkx]} )) || echoti rmkx + _vi-mode-set-cursor-shape-for-keymap default +} +zle -N zle-line-finish + +bindkey -v + +# allow vv to edit the command line (standard behaviour) +autoload -Uz edit-command-line +zle -N edit-command-line +bindkey -M vicmd 'vv' edit-command-line + +# allow ctrl-p, ctrl-n for navigate history (standard behaviour) +bindkey '^P' up-history +bindkey '^N' down-history + +# allow ctrl-h, ctrl-w, ctrl-? for char and word deletion (standard behaviour) +bindkey '^?' backward-delete-char +bindkey '^h' backward-delete-char +bindkey '^w' backward-kill-word + +# allow ctrl-r and ctrl-s to search the history +bindkey '^r' history-incremental-search-backward +bindkey '^s' history-incremental-search-forward + +# allow ctrl-a and ctrl-e to move to beginning/end of line +bindkey '^a' beginning-of-line +bindkey '^e' end-of-line + +function wrap_clipboard_widgets() { + # NB: Assume we are the first wrapper and that we only wrap native widgets + # See zsh-autosuggestions.zsh for a more generic and more robust wrapper + local verb="$1" + shift + + local widget + local wrapped_name + for widget in "$@"; do + wrapped_name="_zsh-vi-${verb}-${widget}" + if [ "${verb}" = copy ]; then + eval " + function ${wrapped_name}() { + zle .${widget} + printf %s \"\${CUTBUFFER}\" | clipcopy 2>/dev/null || true + } + " + else + eval " + function ${wrapped_name}() { + CUTBUFFER=\"\$(clippaste 2>/dev/null || echo \$CUTBUFFER)\" + zle .${widget} + } + " + fi + zle -N "${widget}" "${wrapped_name}" + done +} + +wrap_clipboard_widgets copy \ + vi-yank vi-yank-eol vi-yank-whole-line \ + vi-change vi-change-eol vi-change-whole-line \ + vi-kill-line vi-kill-eol vi-backward-kill-word \ + vi-delete vi-delete-char vi-backward-delete-char + +wrap_clipboard_widgets paste \ + vi-put-{before,after} \ + put-replace-selection + +unfunction wrap_clipboard_widgets + +# if mode indicator wasn't setup by theme, define default, we'll leave INSERT_MODE_INDICATOR empty by default +if [[ -z "$MODE_INDICATOR" ]]; then + MODE_INDICATOR='%B%F{red}<%b<<%f' +fi + +function vi_mode_prompt_info() { + echo "${${VI_KEYMAP/vicmd/$MODE_INDICATOR}/(main|viins)/$INSERT_MODE_INDICATOR}" +} + +# define right prompt, if it wasn't defined by a theme +if [[ -z "$RPS1" && -z "$RPROMPT" ]]; then + RPS1='$(vi_mode_prompt_info)' +fi diff --git a/.config/zsh/ohmyzsh b/.config/zsh/ohmyzsh deleted file mode 160000 index 048455c..0000000 --- a/.config/zsh/ohmyzsh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 048455ccefdc67c4f137b8f7886769c55c2e5417 diff --git a/.config/zsh/powerlevel10k b/.config/zsh/powerlevel10k new file mode 160000 index 0000000..017395a --- /dev/null +++ b/.config/zsh/powerlevel10k @@ -0,0 +1 @@ +Subproject commit 017395a266aa15011c09e64e44a1c98ed91c478c diff --git a/.gitmodules b/.gitmodules index 7b68b2a..7cafa47 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,9 +10,6 @@ [submodule ".config/nvim/pack/plugins/opt/telescope"] path = .config/nvim/pack/plugins/opt/telescope url = https://github.com/nvim-telescope/telescope.nvim.git -[submodule ".config/zsh/ohmyzsh"] - path = .config/zsh/ohmyzsh - url = https://github.com/ohmyzsh/ohmyzsh.git -[submodule ".config/zsh/custom/themes/powerlevel10k"] - path = .config/zsh/custom/themes/powerlevel10k - url = https://github.com/romkatv/powerlevel10k.git +[submodule ".config/zsh/powerlevel10k"] + path = .config/zsh/powerlevel10k + url = https://gitee.com/romkatv/powerlevel10k.git diff --git a/.xinitrc b/.xinitrc index c36ca74..b1a9d05 100644 --- a/.xinitrc +++ b/.xinitrc @@ -4,7 +4,6 @@ #(i3status | while read line; do xsetroot -name "$line"; done) & # startup -autorandr -c xss-lock -n screensaver -- lock & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 || # arch /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1 || # debian diff --git a/.zshenv b/.zshenv index 62d0e11..b2aed03 100644 --- a/.zshenv +++ b/.zshenv @@ -5,16 +5,16 @@ export XDG_STATE_HOME="$HOME/.local/state" export XDG_CONFIG_DIRS=/etc/xdg export XDG_DATA_DIRS="$XDG_DATA_HOME/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share" -export ZDOTDIR="$XDG_CONFIG_HOME/zsh" -export ZSH="$ZDOTDIR/ohmyzsh" -export ZSH_CUSTOM="$ZDOTDIR/custom" -export HISTFILE="$XDG_STATE_HOME/zsh_history" -export ZLE_RPROMPT_INDENT=0 -export ZSH_COMPDUMP="$XDG_CACHE_HOME/.zcompdump-$ZSH_VERSION" +export HISTSIZE=65536 +export SAVEHIST=8192 +export HISTFILE="$XDG_STATE_HOME/zsh_history" +export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +export ZSH_CUSTOM="$ZDOTDIR/custom" +export ZLE_RPROMPT_INDENT=0 export LESSHISTFILE='-' -path=("$HOME/bin" "$HOME/.local/bin" /var/lib/flatpak/exports/bin $path) +path=("$HOME/bin" "$HOME/.local/bin" "$XDG_DATA_HOME/flatpak/exports/bin" /var/lib/flatpak/exports/bin $path) export BROWSER=firefox export EDITOR=nvim