From 3d340c689b39427f1b29b642baa108d7f5fc39ac Mon Sep 17 00:00:00 2001 From: Polesznyák Márk Date: Sat, 29 Nov 2025 00:21:56 +0100 Subject: feat: initial commit --- .Xresources | 1 + .bash_profile | 8 + .bashrc | 145 + .blerc | 35 + .cargo/config.toml | 35 + .config/aerc/accounts.conf | 12 + .config/aerc/aerc.conf | 891 + .config/aerc/binds.conf | 200 + .config/aerc/templates/quoted_thanks | 8 + .config/aerc/templates/thanks | 5 + .config/bat/themes/rose-pine.tmTheme | 316 + .config/darkman/config.yaml | 1 + .config/vimini/config.toml | 3 + .config/vis/colors/rose-pine | 6 + .config/vis/config | 3 + .git-completion.bash | 4020 ++ .gitattributes | 6 + .gitconfig | 38 + .newsboat/config | 14 + .newsboat/urls | 4 + .startdwm | 4 + .stow-local-ignore | 8 + .tmux.conf | 63 + .vim/colors/rosepine.vim | 392 + .vim/system.tags | 88321 +++++++++++++++++++++++++++++++++ .vimrc | 149 + .xinitrc | 16 + Makefile | 6 + README.md | 13 + 29 files changed, 94723 insertions(+) create mode 100644 .Xresources create mode 100644 .bash_profile create mode 100644 .bashrc create mode 100644 .blerc create mode 100644 .cargo/config.toml create mode 100644 .config/aerc/accounts.conf create mode 100644 .config/aerc/aerc.conf create mode 100644 .config/aerc/binds.conf create mode 100644 .config/aerc/templates/quoted_thanks create mode 100644 .config/aerc/templates/thanks create mode 100644 .config/bat/themes/rose-pine.tmTheme create mode 100644 .config/darkman/config.yaml create mode 100644 .config/vimini/config.toml create mode 100644 .config/vis/colors/rose-pine create mode 100644 .config/vis/config create mode 100644 .git-completion.bash create mode 100644 .gitattributes create mode 100644 .gitconfig create mode 100644 .newsboat/config create mode 100644 .newsboat/urls create mode 100755 .startdwm create mode 100644 .stow-local-ignore create mode 100644 .tmux.conf create mode 100644 .vim/colors/rosepine.vim create mode 100644 .vim/system.tags create mode 100644 .vimrc create mode 100755 .xinitrc create mode 100644 Makefile create mode 100644 README.md diff --git a/.Xresources b/.Xresources new file mode 100644 index 0000000..3f90eb3 --- /dev/null +++ b/.Xresources @@ -0,0 +1 @@ +Xft.dpi: 108 diff --git a/.bash_profile b/.bash_profile new file mode 100644 index 0000000..cb7c049 --- /dev/null +++ b/.bash_profile @@ -0,0 +1,8 @@ +# ~/.bash_profile +# + +[[ -f ~/.bashrc ]] && . ~/.bashrc + +if [[ -z "${DISPLAY}" ]] && [[ "${XDG_VTNR}" -eq 1 ]]; then + exec startx +fi diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..c753172 --- /dev/null +++ b/.bashrc @@ -0,0 +1,145 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +command_exists() { + command -v "$1" >/dev/null 2>&1 +} + +if [[ $- == *i* ]] && [[ -f "/usr/share/blesh/ble.sh" ]]; then + source /usr/share/blesh/ble.sh --noattach +fi + +export PATH="$PATH:/home/umberto/.cargo/bin:$ANDROID_HOME/emulator:/home/umberto/go/bin" +export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 +export DPREFIX=/mnt/drive_d/.dprefix +export EDITOR=nvim +export HISTSIZE=10000 +export HISTFILESIZE=10000 +export BAT_THEME=rose-pine + +# export TERM=xterm-256color + +YELLOW="\[$(tput setaf 3)\]" +GREEN="\[$(tput setaf 2)\]" +RED="\[$(tput setaf 1)\]" +BLUE="\[$(tput setaf 4)\]" +RESET="\[$(tput sgr0)\]" + +dockersize() { + docker manifest inspect -v "$1" | + jq -c 'if type == "array" then .[] else . end' | + jq -r '[ ( .Descriptor.platform | [ .os, .architecture, .variant, ."os.version" ] | del(..|nulls) | join("/") ), ( [ ( .OCIManifest // .SchemaV2Manifest ).layers[].size ] | add ) ] | join(" ")' | + numfmt --to iec --format '%.2f' --field 2 | + sort | column -t ; +} + +avg_time() { + # + # usage: avg_time n command ... + # + n=$1; shift + (($# > 0)) || return # bail if no command given + for ((i = 0; i < n; i++)); do + { time -p "$@" &>/dev/null; } 2>&1 # ignore the output of the command + # but collect time's output in stdout + done | awk ' + /real/ { real = real + $2; nr++ } + /user/ { user = user + $2; nu++ } + /sys/ { sys = sys + $2; ns++} + END { + if (nr>0) printf("real %f\n", real/nr); + if (nu>0) printf("user %f\n", user/nu); + if (ns>0) printf("sys %f\n", sys/ns) + }' +} + +key() +{ + pidof ssh-agent + if [[ $? -eq 1 ]] || [[ -z "${SSH_AGENT_PID}" ]]; then + killall ssh-agent ; eval $(ssh-agent -t 4h) && ssh-add ~/.ssh/id_ed25519 + elif [[ "$1" == "--force" ]] || [ "$1" == "-f" ]; then + killall ssh-agent ; eval $(ssh-agent -t 4h) && ssh-add ~/.ssh/id_ed25519 + fi +} + +starter() { + newsboat + sudo pacman -Syu + setxkbmap hu -option caps:escape + read -p "Update AUR packages? [Y/n]: " aur_pkgs + if [[ -z "$aur_pkgs" ]] || [[ "$aur_pkgs" == "Y" ]] || [[ "$aur_pkgs" == "y" ]]; then + tmux new-session 'aur ; bash' + fi +} + +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias btm='btm --enable_gpu' +alias ls='ls --color=auto' +alias grep='grep --color=auto' +alias eza='eza --icons' +alias tree='eza --tree' +alias ncdu='ncdu -t4' +alias fvim='nvim $(fzf)' +alias c='clear' +alias d='cd /mnt/drive_d/' +alias q='cd /mnt/drive_d/Quest/' +alias pac='sudo pacman' +alias pacs="pacman -Slq | fzf --preview 'pacman -Sii {}' --layout=reverse --bind 'enter:execute(pacman -Sii {} | less)'" +alias paci="pacman -Qq | fzf --preview 'pacman -Qi {}' --layout=reverse --bind 'enter:execute(pacman -Qi {} | less)'" +alias orphans='pacman -Qdtq && pacman -Qdtq | pac -Rns -' +alias cls='c && eza' +alias cla='c && eza -a' +alias lazygit='key && lazygit' +alias diff='diff --color -up' +alias emu='emulator -avd Pixel_3a_API_34_extension_level_7_x86_64 -accel on -gpu host -memory 3072' +alias proton='STEAM_COMPAT_DATA_PATH=$HOME/proton/compatdata/ STEAM_COMPAT_CLIENT_INSTALL_PATH=/ ~/proton/GE-Proton9-11/proton waitforexitandrun' + +source ~/.git-completion.bash + +parse_git_bg() { + if [[ $(git status -s 2> /dev/null) ]]; then + tput setaf 160 + else + tput setaf 34 + fi +} + +PS1="╭─${YELLOW}" +PS1+="\u${GREEN}" +PS1+="@${RED}" +PS1+="\h${BLUE} " +PS1+="\W${RESET}" +PS1+="\$(git branch 2> /dev/null | grep '^*' | colrm 1 2 | xargs -I BRANCH echo -n \"" +PS1+="\$(parse_git_bg) " +PS1+=" (BRANCH) " +PS1+="${RESET}\")\n" +PS1+="╰─" +PS1+="\\$ " +PS1+="${RESET}" +export PS1 + +# pnpm +export PNPM_HOME="/home/umberto/.local/share/pnpm" +case ":$PATH:" in + *":$PNPM_HOME:"*) ;; + *) export PATH="$PNPM_HOME:$PATH" ;; +esac +# pnpm end + +export FZF_DEFAULT_OPTS=" + --color=fg:#908caa,bg:#191724,hl:#ebbcba + --color=fg+:#e0def4,bg+:#26233a,hl+:#ebbcba + --color=border:#403d52,header:#31748f,gutter:#191724 + --color=spinner:#f6c177,info:#9ccfd8,separator:#403d52 + --color=pointer:#c4a7e7,marker:#eb6f92,prompt:#908caa" + +command_exists fetcha && fetcha + +[[ ${BLE_VERSION-} ]] && ble-attach diff --git a/.blerc b/.blerc new file mode 100644 index 0000000..5a35328 --- /dev/null +++ b/.blerc @@ -0,0 +1,35 @@ +ble-face -s region fg=white,bg=60 +ble-face -s region_insert fg=#6B6E6E +ble-face -s auto_complete fg=#6B6E6E + +ble-face -s vbell fg=green,bold,italic +ble-face -s vbell_erase fg=#000 +ble-face -s vbell_flash fg=red,reverse,bold,italic + +ble-face -s syntax_quoted fg=green,italic +ble-face -s syntax_expr fg=9 +ble-face -s syntax_error fg=red,bold,underline +ble-face -s argument_error fg=yellow,bold +ble-face -s syntax_varname fg=#ff9500,bold +ble-face -s syntax_delimiter fg=220 +ble-face -s syntax_history_expansion fg=#A017A2 +ble-face -s syntax_function_name fg=#9F6DE4,bold +ble-face -s syntax_comment fg=#7f7f7f,italic +ble-face -s syntax_document fg=4,italic +ble-face -s syntax_document_begin fg=#ff004c,bold +ble-face -s command_builtin fg=red +ble-face -s command_alias fg=51 +ble-face -s command_function fg=purple # fg=purple +ble-face -s command_file fg=4 +ble-face -s command_keyword fg=#F81E16,bold +ble-face -s command_directory fg=#438eff,underline +ble-face -s filename_directory fg=#438eff,underline +ble-face -s filename_link underline,fg=#00e5ff +ble-face -s filename_orphan fg=teal,bg=240,underline +ble-face -s filename_socket underline,fg=13 +ble-face -s filename_pipe underline,fg=orange +ble-face -s filename_character underline,fg=11 +ble-face -s filename_block underline,fg=11 +ble-face -s filename_url underline,italic,fg=#FF613D +ble-face -s varname_number fg=11 +ble-face -s varname_unset fg=#ff004c diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..385d1c4 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,35 @@ +[alias] +lint = "clippy --no-deps -- -D warnings" +lint-all = "clippy --no-deps -- -D clippy::pedantic" + +[unstable] +gc = true +# Cranelift backend +# +# codegen-backend = true +# +# [profile] +# incremental = true +# +# [profile.dev] +# codegen-backend = "cranelift" +# debug = "line-tables-only" +# +# [profile.dev.package.'*'] +# codegen-backend = "llvm" +# +# [profile.test.package."*"] +# codegen-backend = "llvm" +# +# [profile.release] +# codegen-backend = "llvm" + +[target.x86_64-unknown-linux-gnu] +linker = "clang" +rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"] + +[build] +rustflags = [ + "-Z", "threads=0", + "-Z", "share-generics=y" +] diff --git a/.config/aerc/accounts.conf b/.config/aerc/accounts.conf new file mode 100644 index 0000000..02655de --- /dev/null +++ b/.config/aerc/accounts.conf @@ -0,0 +1,12 @@ +[Work] +source = imaps://contact%40pml68.dev@mail.mailo.com:993 +source-cred-cmd = pass mailo +outgoing = smtps+login://contact%40pml68.dev@mail.mailo.com:465 +outgoing-cred-cmd = pass mailo +default = INBOX +folders-sort = INBOX +postpone = draftbox +from = Polesznyák Márk +cache-headers = true +pgp-auto-sign = true +pgp-key-id = B57D24D24689941074DB550ADA2322CFD52418EE diff --git a/.config/aerc/aerc.conf b/.config/aerc/aerc.conf new file mode 100644 index 0000000..301286f --- /dev/null +++ b/.config/aerc/aerc.conf @@ -0,0 +1,891 @@ +# +# aerc main configuration + +[general] +# +# Used as a default path for save operations if no other path is specified. +# ~ is expanded to the current user home dir. +# +#default-save-path= + +# If set to "gpg", aerc will use system gpg binary and keystore for all crypto +# operations. If set to "internal", the internal openpgp keyring will be used. +# If set to "auto", the system gpg will be preferred unless the internal +# keyring already exists, in which case the latter will be used. +# +# Default: auto +pgp-provider=gpg + +# By default, the file permissions of accounts.conf must be restrictive and +# only allow reading by the file owner (0600). Set this option to true to +# ignore this permission check. Use this with care as it may expose your +# credentials. +# +# Default: false +#unsafe-accounts-conf=false + +# Output log messages to specified file. A path starting with ~/ is expanded to +# the user home dir. When redirecting aerc's output to a file using > shell +# redirection, this setting is ignored and log messages are printed to stdout. +# +#log-file= + +# Only log messages above the specified level to log-file. Supported levels +# are: trace, debug, info, warn and error. When redirecting aerc's output to +# a file using > shell redirection, this setting is ignored and the log level +# is forced to trace. +# +# Default: info +#log-level=info + +# Disable IPC entirely. Don't run commands (including mailto:... and mbox:...) +# in an existing aerc instance, and don't start an IPC server to allow +# subsequent aerc instances to run commands in the current one. +# +# Default: false +#disable-ipc=false + +# Don't run mailto:... commands over IPC; start a new aerc instance with the +# composer instead. +# +# Default: false +#disable-ipc-mailto=false +# +# Don't run mbox:... commands over IPC; start a new aerc instance with the mbox +# file instead. +# +# Default: false +#disable-ipc-mbox=false + +# Set the $TERM environment variable used for the embedded terminal. +# +# Default: xterm-256color +#term=xterm-256color + +# Display OSC8 strings in the embedded terminal +# +# Default: false +#enable-osc8=false + +# Default shell command to use for :menu. This will be executed with sh -c and +# will run in an popover dialog. +# +# Any occurrence of %f will be replaced by a temporary file path where the +# command is expected to write output lines to be consumed by :menu. Otherwise, +# the lines will be read from the command's standard output. +# +# Examples: +# default-menu-cmd=fzf +# default-menu-cmd=fzf --multi +# default-menu-cmd=dmenu -l 20 +# default-menu-cmd=ranger --choosefiles=%f +# +#default-menu-cmd= + +[ui] +# +# Describes the format for each row in a mailbox view. This is a comma +# separated list of column names with an optional align and width suffix. After +# the column name, one of the '<' (left), ':' (center) or '>' (right) alignment +# characters can be added (by default, left) followed by an optional width +# specifier. The width is either an integer representing a fixed number of +# characters, or a percentage between 1% and 99% representing a fraction of the +# terminal width. It can also be one of the '*' (auto) or '=' (fit) special +# width specifiers. Auto width columns will be equally attributed the remaining +# terminal width. Fit width columns take the width of their contents. If no +# width specifier is set, '*' is used by default. +# +# Default: flags:4,name<20%,subject,date>= +#index-columns=flags:4,name<20%,subject,date>= + +# +# Each name in index-columns must have a corresponding column-$name setting. +# All column-$name settings accept golang text/template syntax. See +# aerc-templates(7) for available template attributes and functions. +# +# Here are some examples to show the To field instead of the From field for +# an email (modifying column-name): +# +# 1. a generic one +# column-name={{ .Peer | names | join ", " }} +# 2. based upon the selected folder +# column-name={{if match .Folder "^(Gesendet|Sent)$"}}{{index (.To | names) 0}}{{else}}{{index (.From | names) 0}}{{end}} +# +# Default settings +#column-flags={{.Flags | join ""}} +#column-name={{index (.From | names) 0}} +#column-subject={{.ThreadPrefix}}{{.Subject}} +#column-date={{.DateAutoFormat .Date.Local}} + +# +# String separator inserted between columns. When the column width specifier is +# an exact number of characters, the separator is added to it (i.e. the exact +# width will be fully available for the column contents). +# +# Default: " " +#column-separator=" " + +# +# See time.Time#Format at https://godoc.org/time#Time.Format +# +# Default: 2006 Jan 02 +#timestamp-format=2006 Jan 02 + +# +# Index-only time format for messages that were received/sent today. +# If this is empty, timestamp-format is used instead. +# +# Default: 15:04 +#this-day-time-format=15:04 + +# +# Index-only time format for messages that were received/sent within the last +# 7 days. If this is empty, timestamp-format is used instead. +# +# Default: Jan 02 +#this-week-time-format=Jan 02 + +# +# Index-only time format for messages that were received/sent this year. +# If this is empty, timestamp-format is used instead. +# +#Default: Jan 02 +#this-year-time-format=Jan 02 + +# +# Overrides timestamp-format for the message view. +# +# Default: 2006 Jan 02, 15:04 GMT-0700 +#message-view-timestamp-format=2006 Jan 02, 15:04 GMT-0700 + +# +# If set, overrides timestamp-format in the message view for messages +# that were received/sent today. +# +#message-view-this-day-time-format= + +# If set, overrides timestamp-format in the message view for messages +# that were received/sent within the last 7 days. +# +#message-view-this-week-time-format= + +# +# If set, overrides *timestamp-format* in the message view for messages +# that were received/sent this year. +# +#message-view-this-year-time-format= + +# +# Width of the sidebar, including the border. +# +# Default: 22 +#sidebar-width=22 + +# +# Default split layout for message list tabs. The syntax is: +# +# [] +# +# is optional and defaults to horizontal. It can take one +# of the following values: h, horiz, horizontal, v, vert, vertical. +# +# is a positive integer representing the size (in terminal cells) +# of the message list window. +# +#message-list-split= + +# +# Message to display when viewing an empty folder. +# +# Default: (no messages) +#empty-message=(no messages) + +# Message to display when no folders exists or are all filtered +# +# Default: (no folders) +#empty-dirlist=(no folders) +# +# Value to set {{.Subject}} template to when subject is empty. +# +# Default: (no subject) +#empty-subject=(no subject) + +# Enable mouse events in the ui, e.g. clicking and scrolling with the mousewheel +# +# Default: false +#mouse-enabled=false + +# +# Ring the bell when new messages are received +# +# Default: true +#new-message-bell=true + +# +# Template to use for Account tab titles +# +# Default: {{.Account}} +#tab-title-account={{.Account}} + +# +# Template to use for Composer tab titles +# +# Default: {{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}} +#tab-title-composer={{if .To}}to:{{index (.To | shortmboxes) 0}} {{end}}{{.SubjectBase}} + +# +# Template to use for Terminal tab titles. Only valid in the global [ui] +# section. +# +# Default: {{.Title}} +#tab-title-terminal={{.Title}} + +# +# Template to use for Message Viewer tab titles +# +# Default: {{.Subject}} +#tab-title-viewer={{.Subject}} + + +# Marker to show before a pinned tab's name. +# +# Default: ` +#pinned-tab-marker='`' + +# Template for the left side of the directory list. +# See aerc-templates(7) for all available fields and functions. +# +# Default: {{.Folder}} +#dirlist-left={{.Folder}} + +# Template for the right side of the directory list. +# See aerc-templates(7) for all available fields and functions. +# +# Default: {{if .Unread}}{{humanReadable .Unread}}{{end}} +#dirlist-right={{if .Unread}}{{humanReadable .Unread}}{{end}} + +# Delay after which the messages are actually listed when entering a directory. +# This avoids loading messages when skipping over folders and makes the UI more +# responsive. If you do not want that, set it to 0s. +# +# Default: 200ms +#dirlist-delay=200ms + +# Display the directory list as a foldable tree that allows to collapse and +# expand the folders. +# +# Default: false +#dirlist-tree=false + +# If dirlist-tree is enabled, set level at which folders are collapsed by +# default. Set to 0 to disable. +# +# Default: 0 +#dirlist-collapse=0 + +# List of space-separated criteria to sort the messages by, see *sort* +# command in *aerc*(1) for reference. Prefixing a criterion with "-r " +# reverses that criterion. +# +# Example: "from -r date" +# +#sort= + +# Moves to next message when the current message is deleted +# +# Default: true +#next-message-on-delete=true + +# Automatically set the "seen" flag when a message is opened in the message +# viewer. +# +# Default: true +#auto-mark-read=true + +# Specifies whether the _seen_ flag of messages being previewed in the message +# list split should be automatically set to _true_ after a delay, controlled by +# _auto-mark-read-split-delay_. +# +# Default: false +#auto-mark-read-split=false + +# If _auto-mark-read-split_ is true, specifies the number of seconds after +# which a message previewed in the message list split must considered _seen_. +# +# Default: 3s +#auto-mark-read-split-delay=3s + +# The directories where the stylesets are stored. It takes a colon-separated +# list of directories. If this is unset or if a styleset cannot be found, the +# following paths will be used as a fallback in that order: +# +# ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets +# ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets +# /usr/local/share/aerc/stylesets +# /usr/share/aerc/stylesets +# +#stylesets-dirs= + +# Uncomment to use box-drawing characters for vertical and horizontal borders. +# +# Default: "│" and "─" +#border-char-vertical="│" +#border-char-horizontal="─" + +# Sets the styleset to use for the aerc ui elements. +# +# Default: default +#styleset-name=default + +# Activates fuzzy search in commands and their arguments: the typed string is +# searched in the command or option in any position, and need not be +# consecutive characters in the command or option. +# +# Default: false +#fuzzy-complete=false + +# How long to wait after the last input before auto-completion is triggered. +# +# Default: 250ms +#completion-delay=250ms + +# The minimum required characters to allow auto-completion to be triggered after +# completion-delay. +# +# Setting this to "manual" disables automatic completion, leaving only the +# manually triggered completion with the $complete key (see aerc-binds(5) for +# more details). +# +# Default: 1 +#completion-min-chars=1 + +# +# Global switch for completion popovers +# +# Default: true +#completion-popovers=true + +# Uncomment to use UTF-8 symbols to indicate PGP status of messages +# +# Default: ASCII +#icon-unencrypted= +#icon-encrypted=✔ +#icon-signed=✔ +#icon-signed-encrypted=✔ +#icon-unknown=✘ +#icon-invalid=⚠ + +# Reverses the order of the message list. By default, the message list is +# ordered with the newest (highest UID) message on top. Reversing the order +# will put the oldest (lowest UID) message on top. This can be useful in cases +# where the backend does not support sorting. +# +# Default: false +#reverse-msglist-order = false + +# Reverse display of the message threads. Default order is the initial +# message is on the top with all the replies being displayed below. The +# reverse option will put the initial message at the bottom with the +# replies on top. +# +# Default: false +#reverse-thread-order=false + +# Positions the cursor on the last message in the message list (at the +# bottom of the view) when opening a new folder. +# +# Default: false +#select-last-message=false + +# Sort the thread siblings according to the sort criteria for the messages. If +# sort-thread-siblings is false, the thread siblings will be sorted based on +# the message UID in ascending order. If this option is set to false and +# threading-by-subject is set to true, then siblings will be ordered by subject +# headers using UTF-8 sorting. +# +# This option is only applicable for client-side threading with a backend that +# enables sorting. Note that there's a performance impact when sorting is +# activated. +# +# Default: false +#sort-thread-siblings=false + +# Set the scroll offset in number of lines from the top and bottom of the +# message list. +# +# Default: 0 +#msglist-scroll-offset = 0 + +# +# Enable a threaded view of messages. If this is not supported by the backend +# (IMAP server or notmuch), threads will be built by the client. +# +# Default: false +#threading-enabled=false + +# Force client-side thread building +# +# Default: false +#force-client-threads=false + +# If no References nor In-Reply-To headers can be matched to build client side +# threads, fallback to similar subjects. This setting also affects how thread +# siblings are ordered when sort-thread-siblings is left to false. +# +# Default: false +#threading-by-subject=false + +# Show thread context enables messages which do not match the current query (or +# belong to the current mailbox) to be shown for context. These messages can be +# styled separately using "msglist_thread_context" in a styleset. This feature +# is not supported by all backends +# +# Default: false +#show-thread-context=false + +# Debounce client-side thread building +# +# Default: 50ms +#client-threads-delay=50ms + +# +# Thread prefix customization: + +# +# Customize the thread prefix appearance by selecting the arrow head. +# +# Default: ">" +#thread-prefix-tip = ">" + +# +# Customize the thread prefix appearance by selecting the arrow indentation. +# +# Default: " " +#thread-prefix-indent = " " + +# +# Customize the thread prefix appearance by selecting the vertical extension of +# the arrow. +# +# Default: "│" +#thread-prefix-stem = "│" + +# +# Customize the thread prefix appearance by selecting the horizontal extension +# of the arrow. +# +# Default: "" +#thread-prefix-limb = "" + +# +# Customize the thread prefix appearance by selecting the folded thread +# indicator. +# +# Default: "+" +#thread-prefix-folded = "+" + +# +# Customize the thread prefix appearance by selecting the unfolded thread +# indicator. +# +# Default: "" +#thread-prefix-unfolded = "" + +# +# Customize the thread prefix appearance by selecting the first child connector. +# +# Default: "" +#thread-prefix-first-child = "" + +# +# Customize the thread prefix appearance by selecting the connector used if +# the message has siblings. +# +# Default: "├─" +#thread-prefix-has-siblings = "├─" + +# +# Customize the thread prefix appearance by selecting the connector used if the +# message has no parents and no children. +# +# Default: "" +#thread-prefix-lone = "" + +# +# Customize the thread prefix appearance by selecting the connector used if the +# message has no parents and has children. +# +# Default: "" +#thread-prefix-orphan = "" + +# +# Customize the thread prefix appearance by selecting the connector for the last +# sibling. +# +# Default: "└─" +#thread-prefix-last-sibling = "└─" + +# +# Customize the reversed thread prefix appearance by selecting the connector for +# the last sibling. +# +# Default: "┌─" +#thread-prefix-last-sibling-reverse = "┌─" + +# +# Customize the thread prefix appearance by selecting the connector for dummy +# thread. +# +# Default: "┬─" +#thread-prefix-dummy = "┬─" + +# +# Customize the reversed thread prefix appearance by selecting the connector for +# dummy thread. +# +# Default: "┴─" +#thread-prefix-dummy-reverse = "┴─" + +# +# Customize the reversed thread prefix appearance by selecting the first child +# connector. +# +# Default: "" +#thread-prefix-first-child-reverse = "" + +# +# Customize the reversed thread prefix appearance by selecting the connector +# used if the message has no parents and has children. +# +# Default: "" +#thread-prefix-orphan-reverse = "" + +[statusline] +# +# Describes the format for the status line. This is a comma separated list of +# column names with an optional align and width suffix. See [ui].index-columns +# for more details. To completely mute the status line except for push +# notifications, explicitly set status-columns to an empty string. +# +# Default: left<*,center:=,right>* +#status-columns=left<*,center:=,right>* + +# +# Each name in status-columns must have a corresponding column-$name setting. +# All column-$name settings accept golang text/template syntax. See +# aerc-templates(7) for available template attributes and functions. +# +# Default settings +#column-left=[{{.Account}}] {{.StatusInfo}} +#column-center={{.PendingKeys}} +#column-right={{.TrayInfo}} | {{cwd}} + +# +# String separator inserted between columns. +# See [ui].column-separator for more details. +# +#column-separator=" " + +# Specifies the separator between grouped statusline elements. +# +# Default: " | " +#separator=" | " + +# Defines the mode for displaying the status elements. +# Options: text, icon +# +# Default: text +#display-mode=text + +[viewer] +# +# Specifies the pager to use when displaying emails. Note that some filters +# may add ANSI codes to add color to rendered emails, so you may want to use a +# pager which supports ANSI codes. +# +# Default: less -Rc +#pager=less -Rc + +# +# If an email offers several versions (multipart), you can configure which +# mimetype to prefer. For example, this can be used to prefer plaintext over +# html emails. +# +# Default: text/plain,text/html +#alternatives=text/plain,text/html + +# +# Default setting to determine whether to show full headers or only parsed +# ones in message viewer. +# +# Default: false +#show-headers=false + +# +# Layout of headers when viewing a message. To display multiple headers in the +# same row, separate them with a pipe, e.g. "From|To". Rows will be hidden if +# none of their specified headers are present in the message. +# +# Default: From|To,Cc|Bcc,Date,Subject +#header-layout=From|To,Cc|Bcc,Date,Subject + +# Whether to always show the mimetype of an email, even when it is just a single part +# +# Default: false +#always-show-mime=false + +# Define the maximum height of the mimetype switcher before a scrollbar is used. +# The height of the mimetype switcher is restricted to half of the display +# height. If the provided value for the height is zero, the number of parts will +# be used as the height of the type switcher. +# +# Default: 0 +#max-mime-height = 0 + +# Parses and extracts http links when viewing a message. Links can then be +# accessed with the open-link command. +# +# Default: true +#parse-http-links=true + +[compose] +# +# Specifies the command to run the editor with. It will be shown in an embedded +# terminal, though it may also launch a graphical window if the environment +# supports it. Defaults to $EDITOR, or vi. +#editor= + +# +# When set, aerc will create and read .eml files for composing that have +# non-standard \n linebreaks. This is only relevant if the used editor does not +# support CRLF linebreaks. +# +#lf-editor=false + +# +# Default header fields to display when composing a message. To display +# multiple headers in the same row, separate them with a pipe, e.g. "To|From". +# +# Default: To|From,Subject +#header-layout=To|From,Subject + +# +# Edit headers into the text editor instead than separate fields. +# +# When this is true, address-book-cmd is not supported and address completion +# is left to the editor itself. Also, displaying multiple headers on the same +# line is not possible. +# +# Default: false +#edit-headers=true + +# +# Sets focus to the email body when the composer window opens. +# +# Default: false +#focus-body=false + +# +# Specifies the command to be used to tab-complete email addresses. Any +# occurrence of "%s" in the address-book-cmd will be replaced with what the +# user has typed so far. +# +# The command must output the completions to standard output, one completion +# per line. Each line must be tab-delimited, with an email address occurring as +# the first field. Only the email address field is required. The second field, +# if present, will be treated as the contact name. Additional fields are +# ignored. +# +# This parameter can also be set per account in accounts.conf. +#address-book-cmd= + +# Specifies the command to be used to select attachments. Any occurrence of +# '%s' in the file-picker-cmd will be replaced with the argument +# to :attach -m . Any occurrence of '%f' will be replaced by the +# location of a temporary file, from which aerc will read the selected files. +# +# If '%f' is not present, the command must output the selected files to +# standard output, one file per line. If it is present, then aerc does not +# capture the standard output and instead reads the files from the temporary +# file which should have the same format. +#file-picker-cmd= + +# +# Allow to address yourself when replying +# +# Default: true +#reply-to-self=true + +# Warn before sending an email with an empty subject. +# +# Default: false +#empty-subject-warning=false + +# +# Warn before sending an email that matches the specified regexp but does not +# have any attachments. Leave empty to disable this feature. +# +# Uses Go's regexp syntax, documented at https://golang.org/s/re2syntax. The +# "(?im)" flags are set by default (case-insensitive and multi-line). +# +# Example: +# no-attachment-warning=^[^>]*attach(ed|ment) +# +#no-attachment-warning= + +# +# When set, aerc will generate "format=flowed" bodies with a content type of +# "text/plain; format=flowed" as described in RFC3676. This format is easier to +# handle for some mailing software, and generally just looks like ordinary +# text. To actually make use of this format's features, you'll need support in +# your editor. +# +#format-flowed=false + +[multipart-converters] +# +# Converters allow to generate multipart/alternative messages by converting the +# main text/plain part into any other MIME type. Only exact MIME types are +# accepted. The commands are invoked with sh -c and are expected to output +# valid UTF-8 text. +# +# Example (obviously, this requires that you write your main text/plain body +# using the markdown syntax): +#text/html=pandoc -f markdown -t html --standalone + +[filters] +# +# Filters allow you to pipe an email body through a shell command to render +# certain emails differently, e.g. highlighting them with ANSI escape codes. +# +# The commands are invoked with sh -c. The following folders are prepended to +# the system $PATH to allow referencing filters from their name only: +# +# ${XDG_CONFIG_HOME:-~/.config}/aerc/filters +# ~/.local/libexec/aerc/filters +# ${XDG_DATA_HOME:-~/.local/share}/aerc/filters +# $PREFIX/libexec/aerc/filters +# $PREFIX/share/aerc/filters +# /usr/libexec/aerc/filters +# /usr/share/aerc/filters +# +# If you want to run a program in your default $PATH which has the same name +# as a builtin filter (e.g. /usr/bin/colorize), use its absolute path. +# +# The following variables are defined in the filter command environment: +# +# AERC_MIME_TYPE the part MIME type/subtype +# AERC_FORMAT the part content type format= parameter +# AERC_FILENAME the attachment filename (if any) +# AERC_SUBJECT the message Subject header value +# AERC_FROM the message From header value +# +# The first filter which matches the email's mimetype will be used, so order +# them from most to least specific. +# +# You can also match on non-mimetypes, by prefixing with the header to match +# against (non-case-sensitive) and a comma, e.g. subject,text will match a +# subject which contains "text". Use header,~regex to match against a regex. +# +text/plain=colorize +text/calendar=calendar +message/delivery-status=colorize +message/rfc822=colorize +#text/html=pandoc -f html -t plain | colorize +text/html=! html +#text/html=! w3m -T text/html -I UTF-8 +#text/*=bat -fP --file-name="$AERC_FILENAME" +#application/x-sh=bat -fP -l sh +#image/*=catimg -w $(tput cols) - +#subject,~Git(hub|lab)=lolcat -f +#from,thatguywhodoesnothardwraphismessages=wrap -w 100 | colorize + +# This special filter is only used to post-process email headers when +# [viewer].show-headers=true +# By default, headers are piped directly into the pager. +# +.headers=colorize + +[openers] +# +# Openers allow you to specify the command to use for the :open and :open-link +# actions on a per-MIME-type basis. The :open-link URL scheme is used to +# determine the MIME type as follows: x-scheme-handler/. +# +# {} is expanded as the temporary filename or URL to be opened with proper +# shell quoting. If it is not encountered in the command, the filename/URL will +# be appended to the end of the command. The command will then be executed with +# `sh -c`. +# +# Like [filters], openers support basic shell globbing. The first opener which +# matches the part's MIME type (or URL scheme handler MIME type) will be used, +# so order them from most to least specific. +# +# Examples: +# x-scheme-handler/irc=hexchat +# x-scheme-handler/http*=printf '%s' {} | wl-copy +# text/html=surf -dfgms +# text/plain=gvim {} +125 +# message/rfc822=thunderbird + +[hooks] +# +# Hooks are triggered whenever the associated event occurs. + +# +# Executed when a new email arrives in the selected folder +#mail-received=notify-send "[$AERC_ACCOUNT/$AERC_FOLDER] New mail from $AERC_FROM_NAME" "$AERC_SUBJECT" + +# +# Executed when mail is deleted from a folder +#mail-deleted=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" & + +# +# Executed when aerc adds mail to a folder +#mail-added=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" & + +# +# Executed when aerc starts +#aerc-startup=aerc :terminal calcurse && aerc :next-tab + +# +# Executed when aerc shuts down. +#aerc-shutdown= + +# +# Executed when notmuch tags are modified. +#tag-modified= + +# +# Executed when flags are changed on a message. +#flag-changed=mbsync "$AERC_ACCOUNT:$AERC_FOLDER" & + +[templates] +# Templates are used to populate email bodies automatically. +# + +# The directories where the templates are stored. It takes a colon-separated +# list of directories. If this is unset or if a template cannot be found, the +# following paths will be used as a fallback in that order: +# +# ${XDG_CONFIG_HOME:-~/.config}/aerc/templates +# ${XDG_DATA_HOME:-~/.local/share}/aerc/templates +# /usr/local/share/aerc/templates +# /usr/share/aerc/templates +# +#template-dirs= + +# The default template to be used for new messages. +# +# default: new_message +#new-message=new_message + +# The default template to be used for quoted replies. +# +# default: quoted_reply +#quoted-reply=quoted_reply + +# The default template to be used for forward as body. +# +# default: forward_as_body +#forwards=forward_as_body diff --git a/.config/aerc/binds.conf b/.config/aerc/binds.conf new file mode 100644 index 0000000..9d033f0 --- /dev/null +++ b/.config/aerc/binds.conf @@ -0,0 +1,200 @@ +# Binds are of the form = +# To use '=' in a key sequence, substitute it with "Eq": "" +# If you wish to bind #, you can wrap the key sequence in quotes: "#" = quit + = :prev-tab + = :prev-tab + = :next-tab + = :next-tab +\[t = :prev-tab +\]t = :next-tab + = :term +? = :help keys + = :prompt 'Quit?' quit + = :prompt 'Quit?' quit + = :suspend + +[messages] +q = :prompt 'Quit?' quit +ga = :flag:pipe -mb git am -3 +gp = :term git push +gl = :term git log + +rt = :reply -a -Tthanks +Rt = :reply -qa -Tquoted_thanks + +j = :next + = :next + = :next 50% + = :next 100% + = :next 100% + +k = :prev + = :prev + = :prev 50% + = :prev 100% + = :prev 100% +g = :select 0 +G = :select -1 + +J = :next-folder + = :next-folder +K = :prev-folder + = :prev-folder +H = :collapse-folder + = :collapse-folder +L = :expand-folder + = :expand-folder + +v = :mark -t + = :mark -t:next +V = :mark -v + +T = :toggle-threads +zc = :fold +zo = :unfold +za = :fold -t +zM = :fold -a +zR = :unfold -a + = :fold -t + +zz = :align center +zt = :align top +zb = :align bottom + + = :view +d = :choose -o y 'Really delete this message' delete-message +D = :delete +a = :archive flat +A = :unmark -a:mark -T:archive flat + +C = :compose +m = :compose + +b = :bounce + +rr = :reply -a +rq = :reply -aq +Rr = :reply +Rq = :reply -q + +c = :cf +$ = :term +! = :term +| = :pipe + +/ = :search +\ = :filter +n = :next-result +N = :prev-result + = :clear + +s = :split +S = :vsplit + +pl = :patch list +pa = :patch apply +pd = :patch drop +pb = :patch rebase +pt = :patch term +ps = :patch switch + +[messages:folder=Drafts] + = :recall + +[view] +/ = :toggle-key-passthrough/ +q = :close +O = :open +o = :open +S = :save +| = :pipe +D = :delete +A = :archive flat + + = :copy-link + = :open-link + +f = :forward +rr = :reply -a +rq = :reply -aq +Rr = :reply +Rq = :reply -q + +H = :toggle-headers + = :prev-part + = :prev-part + = :next-part + = :next-part +J = :next + = :next +K = :prev + = :prev + +[view::passthrough] +$noinherit = true +$ex = + = :toggle-key-passthrough + +[compose] +# Keybindings used when the embedded terminal is not selected in the compose +# view +$noinherit = true +$ex = +$complete = + = :prev-field + = :prev-field + = :next-field + = :next-field + = :switch-account -p + = :switch-account -p + = :switch-account -n + = :switch-account -n + = :next-field + = :prev-field + = :prev-tab + = :prev-tab + = :next-tab + = :next-tab + +[compose::editor] +# Keybindings used when the embedded terminal is selected in the compose view +$noinherit = true +$ex = + = :prev-field + = :prev-field + = :next-field + = :next-field + = :prev-tab + = :prev-tab + = :next-tab + = :next-tab + +[compose::review] +# Keybindings used when reviewing a message to be sent +# Inline comments are used as descriptions on the review screen +y = :send # Send +n = :abort # Abort (discard message, no confirmation) +s = :sign # Toggle signing +x = :encrypt # Toggle encryption to all recipients +v = :preview # Preview message +p = :postpone # Postpone +q = :choose -o d discard abort -o p postpone postpone # Abort or postpone +e = :edit # Edit (body and headers) +a = :attach # Add attachment +d = :detach # Remove attachment + = :choose \ + -o a approved "header X-Sourcehut-Patchset-Update APPROVED" \ + -o R Rejected "header X-Sourcehut-Patchset-Update REJECTED" \ + -o r needs-revision "header X-Sourcehut-Patchset-Update NEEDS_REVISION" \ + -o s superseded "header X-Sourcehut-Patchset-Update SUPERSEDED" \ + -o A Applied "header X-Sourcehut-Patchset-Update APPLIED" \ + # Set patch status after review + +[terminal] +$noinherit = true +$ex = + + = :prev-tab + = :next-tab + = :prev-tab + = :next-tab diff --git a/.config/aerc/templates/quoted_thanks b/.config/aerc/templates/quoted_thanks new file mode 100644 index 0000000..5e22fd5 --- /dev/null +++ b/.config/aerc/templates/quoted_thanks @@ -0,0 +1,8 @@ +X-Sourcehut-Patchset-Update: APPLIED + +Thanks! + +{{exec `branch="$(git branch --show-current)"; { git remote get-url --push origin; git reflog -2 "origin/$branch" --pretty=format:%h | xargs printf '%s\n' | tac; } | xargs printf "To %s\n %s..%s $branch -> $branch"` ""}} + +On {{dateFormat (.OriginalDate | toLocal) "Mon Jan 2, 2006 at 3:40 PM MST"}}, {{(index .OriginalFrom 0).Name}} wrote: +{{wrapText .OriginalText 72 | quote}} diff --git a/.config/aerc/templates/thanks b/.config/aerc/templates/thanks new file mode 100644 index 0000000..ae7a9fd --- /dev/null +++ b/.config/aerc/templates/thanks @@ -0,0 +1,5 @@ +X-Sourcehut-Patchset-Update: APPLIED + +Thanks! + +{{exec `branch="$(git branch --show-current)"; { git remote get-url --push origin; git reflog -2 "origin/$branch" --pretty=format:%h | xargs printf '%s\n' | tac; } | xargs printf "To %s\n %s..%s $branch -> $branch"` ""}} diff --git a/.config/bat/themes/rose-pine.tmTheme b/.config/bat/themes/rose-pine.tmTheme new file mode 100644 index 0000000..79cceb5 --- /dev/null +++ b/.config/bat/themes/rose-pine.tmTheme @@ -0,0 +1,316 @@ + + + + + name + Rosé Pine + settings + + + settings + + background + #191724 + caret + #524f67 + foreground + #e0def4 + invisibles + #1f1d2e + lineHighlight + #21202e + selection + #403d52 + + + + name + Comment + scope + comment + settings + + fontStyle + italic + foreground + #908caa + + + + name + String + scope + string, punctuation.definition.string + settings + + foreground + #f6c177 + + + + name + Number + scope + constant.numeric + settings + + foreground + #f6c177 + + + + name + Built-in constant + scope + constant.language + settings + + fontStyle + bold + foreground + #f6c177 + + + + name + User-defined constant + scope + constant.character, constant.other + settings + + foreground + #f6c177 + + + + name + Variable + scope + variable + settings + + fontStyle + italic + foreground + #e0def4 + + + + name + Keyword + scope + keyword + settings + + foreground + #31748f + + + + name + Storage + scope + storage + settings + + fontStyle + + foreground + #9ccfd8 + + + + name + Storage type + scope + storage.type + settings + + fontStyle + + foreground + #9ccfd8 + + + + name + Class name + scope + entity.name.class + settings + + fontStyle + bold + foreground + #31748f + + + + name + Inherited class + scope + entity.other.inherited-class + settings + + fontStyle + italic + foreground + #31748f + + + + name + Function name + scope + entity.name.function + settings + + fontStyle + italic + foreground + #ebbcba + + + + name + Function argument + scope + variable.parameter + settings + + fontStyle + + foreground + #c4a7e7 + + + + name + Tag name + scope + entity.name.tag + settings + + fontStyle + bold + foreground + #31748f + + + + name + Tag attribute + scope + entity.other.attribute-name + settings + + fontStyle + + foreground + #c4a7e7 + + + + name + Library function + scope + support.function + settings + + fontStyle + bold + foreground + #ebbcba + + + + name + Library constant + scope + support.constant + settings + + fontStyle + bold + foreground + #f6c177 + + + + name + Library class/type + scope + support.type, support.class + settings + + fontStyle + bold + foreground + #9ccfd8 + + + + name + Library variable + scope + support.other.variable + settings + + fontStyle + bold + foreground + #eb6f92 + + + + name + Invalid + scope + invalid + settings + + background + #eb6f92 + fontStyle + + foreground + #e0def4 + + + + name + Invalid deprecated + scope + invalid.deprecated + settings + + background + #c4a7e7 + foreground + #e0def4 + + + + name + Punctuation, Operators + scope + punctuation, keyword.operator + settings + + foreground + #908caa + + + + colorSpaceName + sRGB + semanticClass + theme.dark.rose-pine + author + arrrgi + comment + All natural pine, faux fur and a bit of soho vibes for the classy minimalist + uuid + 14991673-80EB-41A2-BEFF-03216A233730 + + diff --git a/.config/darkman/config.yaml b/.config/darkman/config.yaml new file mode 100644 index 0000000..04d3fe6 --- /dev/null +++ b/.config/darkman/config.yaml @@ -0,0 +1 @@ +dbusserver: true diff --git a/.config/vimini/config.toml b/.config/vimini/config.toml new file mode 100644 index 0000000..c743fb6 --- /dev/null +++ b/.config/vimini/config.toml @@ -0,0 +1,3 @@ +[[key_bindings.normal_bindings]] +command = "mode-enter command" +sequence = "«Shift+.»" diff --git a/.config/vis/colors/rose-pine b/.config/vis/colors/rose-pine new file mode 100644 index 0000000..1195d37 --- /dev/null +++ b/.config/vis/colors/rose-pine @@ -0,0 +1,6 @@ +#31748f +#9ccfd8 +#c4a7e7 +#ebbcba +#f6c177 +#eb6f92 diff --git a/.config/vis/config b/.config/vis/config new file mode 100644 index 0000000..e0fcb3f --- /dev/null +++ b/.config/vis/config @@ -0,0 +1,3 @@ +visualizer.spectrum.bar.width=1 +audio.stereo.enabled=false +colors.scheme=rose-pine diff --git a/.git-completion.bash b/.git-completion.bash new file mode 100644 index 0000000..73abea3 --- /dev/null +++ b/.git-completion.bash @@ -0,0 +1,4020 @@ +# bash/zsh completion support for core Git. +# +# Copyright (C) 2006,2007 Shawn O. Pearce +# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). +# Distributed under the GNU General Public License, version 2.0. +# +# The contained completion routines provide support for completing: +# +# *) local and remote branch names +# *) local and remote tag names +# *) .git/remotes file names +# *) git 'subcommands' +# *) git email aliases for git-send-email +# *) tree paths within 'ref:path/to/file' expressions +# *) file paths within current working directory and index +# *) common --long-options +# +# To use these routines: +# +# 1) Copy this file to somewhere (e.g. ~/.git-completion.bash). +# 2) Add the following line to your .bashrc/.zshrc: +# source ~/.git-completion.bash +# 3) Consider changing your PS1 to also show the current branch, +# see git-prompt.sh for details. +# +# If you use complex aliases of form '!f() { ... }; f', you can use the null +# command ':' as the first command in the function body to declare the desired +# completion style. For example '!f() { : git commit ; ... }; f' will +# tell the completion to use commit completion. This also works with aliases +# of form "!sh -c '...'". For example, "!sh -c ': git commit ; ... '". +# Note that "git" is optional --- '!f() { : commit; ...}; f' would complete +# just like the 'git commit' command. +# +# To add completion for git subcommands that are implemented in external +# scripts, define a function of the form '_git_${subcommand}' while replacing +# all dashes with underscores, and the main git completion will make use of it. +# For example, to add completion for 'git do-stuff' (which could e.g. live +# in /usr/bin/git-do-stuff), name the completion function '_git_do_stuff'. +# See _git_show, _git_bisect etc. below for more examples. +# +# If you have a shell command that is not part of git (and is not called as a +# git subcommand), but you would still like git-style completion for it, use +# __git_complete. For example, to use the same completion as for 'git log' also +# for the 'gl' command: +# +# __git_complete gl git_log +# +# Or if the 'gk' command should be completed the same as 'gitk': +# +# __git_complete gk gitk +# +# The second parameter of __git_complete gives the completion function; it is +# resolved as a function named "$2", or "__$2_main", or "_$2" in that order. +# In the examples above, the actual functions used for completion will be +# _git_log and __gitk_main. +# +# Compatible with bash 3.2.57. +# +# You can set the following environment variables to influence the behavior of +# the completion routines: +# +# GIT_COMPLETION_CHECKOUT_NO_GUESS +# +# When set to "1", do not include "DWIM" suggestions in git-checkout +# and git-switch completion (e.g., completing "foo" when "origin/foo" +# exists). +# +# GIT_COMPLETION_SHOW_ALL_COMMANDS +# +# When set to "1" suggest all commands, including plumbing commands +# which are hidden by default (e.g. "cat-file" on "git ca"). +# +# GIT_COMPLETION_SHOW_ALL +# +# When set to "1" suggest all options, including options which are +# typically hidden (e.g. '--allow-empty' for 'git commit'). +# +# GIT_COMPLETION_IGNORE_CASE +# +# When set, uses for-each-ref '--ignore-case' to find refs that match +# case insensitively, even on systems with case sensitive file systems +# (e.g., completing tag name "FOO" on "git checkout f"). + +case "$COMP_WORDBREAKS" in +*:*) : great ;; +*) COMP_WORDBREAKS="$COMP_WORDBREAKS:" +esac + +# Discovers the path to the git repository taking any '--git-dir=' and +# '-C ' options into account and stores it in the $__git_repo_path +# variable. +__git_find_repo_path () +{ + if [ -n "${__git_repo_path-}" ]; then + # we already know where it is + return + fi + + if [ -n "${__git_C_args-}" ]; then + __git_repo_path="$(git "${__git_C_args[@]}" \ + ${__git_dir:+--git-dir="$__git_dir"} \ + rev-parse --absolute-git-dir 2>/dev/null)" + elif [ -n "${__git_dir-}" ]; then + test -d "$__git_dir" && + __git_repo_path="$__git_dir" + elif [ -n "${GIT_DIR-}" ]; then + test -d "$GIT_DIR" && + __git_repo_path="$GIT_DIR" + elif [ -d .git ]; then + __git_repo_path=.git + else + __git_repo_path="$(git rev-parse --git-dir 2>/dev/null)" + fi +} + +# Deprecated: use __git_find_repo_path() and $__git_repo_path instead +# __gitdir accepts 0 or 1 arguments (i.e., location) +# returns location of .git repo +__gitdir () +{ + if [ -z "${1-}" ]; then + __git_find_repo_path || return 1 + echo "$__git_repo_path" + elif [ -d "$1/.git" ]; then + echo "$1/.git" + else + echo "$1" + fi +} + +# Runs git with all the options given as argument, respecting any +# '--git-dir=' and '-C ' options present on the command line +__git () +{ + git ${__git_C_args:+"${__git_C_args[@]}"} \ + ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null +} + +# Helper function to read the first line of a file into a variable. +# __git_eread requires 2 arguments, the file path and the name of the +# variable, in that order. +# +# This is taken from git-prompt.sh. +__git_eread () +{ + test -r "$1" && IFS=$'\r\n' read -r "$2" <"$1" +} + +# Runs git in $__git_repo_path to determine whether a pseudoref exists. +# 1: The pseudo-ref to search +__git_pseudoref_exists () +{ + local ref=$1 + local head + + __git_find_repo_path + + # If the reftable is in use, we have to shell out to 'git rev-parse' + # to determine whether the ref exists instead of looking directly in + # the filesystem to determine whether the ref exists. Otherwise, use + # Bash builtins since executing Git commands are expensive on some + # platforms. + if __git_eread "$__git_repo_path/HEAD" head; then + if [ "$head" == "ref: refs/heads/.invalid" ]; then + __git show-ref --exists "$ref" + return $? + fi + fi + + [ -f "$__git_repo_path/$ref" ] +} + +# Removes backslash escaping, single quotes and double quotes from a word, +# stores the result in the variable $dequoted_word. +# 1: The word to dequote. +__git_dequote () +{ + local rest="$1" len ch + + dequoted_word="" + + while test -n "$rest"; do + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%[\\\'\"]*}" + rest="${rest:$((${#dequoted_word}-$len))}" + + case "${rest:0:1}" in + \\) + ch="${rest:1:1}" + case "$ch" in + $'\n') + ;; + *) + dequoted_word="$dequoted_word$ch" + ;; + esac + rest="${rest:2}" + ;; + \') + rest="${rest:1}" + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%\'*}" + rest="${rest:$((${#dequoted_word}-$len+1))}" + ;; + \") + rest="${rest:1}" + while test -n "$rest" ; do + len=${#dequoted_word} + dequoted_word="$dequoted_word${rest%%[\\\"]*}" + rest="${rest:$((${#dequoted_word}-$len))}" + case "${rest:0:1}" in + \\) + ch="${rest:1:1}" + case "$ch" in + \"|\\|\$|\`) + dequoted_word="$dequoted_word$ch" + ;; + $'\n') + ;; + *) + dequoted_word="$dequoted_word\\$ch" + ;; + esac + rest="${rest:2}" + ;; + \") + rest="${rest:1}" + break + ;; + esac + done + ;; + esac + done +} + +# Prints the number of slash-separated components in a path. +# 1: Path to count components of. +__git_count_path_components () +{ + local path="$1" + local relative="${path#/}" + relative="${relative%/}" + local slashes="/${relative//[^\/]}" + echo "${#slashes}" +} + +# The following function is based on code from: +# +# bash_completion - programmable completion functions for bash 3.2+ +# +# Copyright © 2006-2008, Ian Macdonald +# © 2009-2010, Bash Completion Maintainers +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see . +# +# The latest version of this software can be obtained here: +# +# http://bash-completion.alioth.debian.org/ +# +# RELEASE: 2.x + +# This function can be used to access a tokenized list of words +# on the command line: +# +# __git_reassemble_comp_words_by_ref '=:' +# if test "${words_[cword_-1]}" = -w +# then +# ... +# fi +# +# The argument should be a collection of characters from the list of +# word completion separators (COMP_WORDBREAKS) to treat as ordinary +# characters. +# +# This is roughly equivalent to going back in time and setting +# COMP_WORDBREAKS to exclude those characters. The intent is to +# make option types like --date= and : easy to +# recognize by treating each shell word as a single token. +# +# It is best not to set COMP_WORDBREAKS directly because the value is +# shared with other completion scripts. By the time the completion +# function gets called, COMP_WORDS has already been populated so local +# changes to COMP_WORDBREAKS have no effect. +# +# Output: words_, cword_, cur_. + +__git_reassemble_comp_words_by_ref() +{ + local exclude i j first + # Which word separators to exclude? + exclude="${1//[^$COMP_WORDBREAKS]}" + cword_=$COMP_CWORD + if [ -z "$exclude" ]; then + words_=("${COMP_WORDS[@]}") + return + fi + # List of word completion separators has shrunk; + # re-assemble words to complete. + for ((i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do + # Append each nonempty word consisting of just + # word separator characters to the current word. + first=t + while + [ $i -gt 0 ] && + [ -n "${COMP_WORDS[$i]}" ] && + # word consists of excluded word separators + [ "${COMP_WORDS[$i]//[^$exclude]}" = "${COMP_WORDS[$i]}" ] + do + # Attach to the previous token, + # unless the previous token is the command name. + if [ $j -ge 2 ] && [ -n "$first" ]; then + ((j--)) + fi + first= + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + if (($i < ${#COMP_WORDS[@]} - 1)); then + ((i++)) + else + # Done. + return + fi + done + words_[$j]=${words_[j]}${COMP_WORDS[i]} + if [ $i = $COMP_CWORD ]; then + cword_=$j + fi + done +} + +if ! type _get_comp_words_by_ref >/dev/null 2>&1; then +_get_comp_words_by_ref () +{ + local exclude cur_ words_ cword_ + if [ "$1" = "-n" ]; then + exclude=$2 + shift 2 + fi + __git_reassemble_comp_words_by_ref "$exclude" + cur_=${words_[cword_]} + while [ $# -gt 0 ]; do + case "$1" in + cur) + cur=$cur_ + ;; + prev) + prev=${words_[$cword_-1]} + ;; + words) + words=("${words_[@]}") + ;; + cword) + cword=$cword_ + ;; + esac + shift + done +} +fi + +# Fills the COMPREPLY array with prefiltered words without any additional +# processing. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) +} + +# Similar to __gitcomp_direct, but appends to COMPREPLY instead. +# Callers must take care of providing only words that match the current word +# to be completed and adding any prefix and/or suffix (trailing space!), if +# necessary. +# 1: List of newline-separated matching completion words, complete with +# prefix and suffix. +__gitcomp_direct_append () +{ + local IFS=$'\n' + + COMPREPLY+=($1) +} + +__gitcompappend () +{ + local x i=${#COMPREPLY[@]} + for x in $1; do + if [[ "$x" == "$3"* ]]; then + COMPREPLY[i++]="$2$x$4" + fi + done +} + +__gitcompadd () +{ + COMPREPLY=() + __gitcompappend "$@" +} + +# Generates completion reply, appending a space to possible completion words, +# if necessary. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word (optional). +__gitcomp () +{ + local cur_="${3-$cur}" + + case "$cur_" in + *=) + ;; + --no-*) + local c i=0 IFS=$' \t\n' + for c in $1; do + if [[ $c == "--" ]]; then + continue + fi + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + --*=|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; + *) + local c i=0 IFS=$' \t\n' + for c in $1; do + if [[ $c == "--" ]]; then + c="--no-...${4-}" + if [[ $c == "$cur_"* ]]; then + COMPREPLY[i++]="${2-}$c " + fi + break + fi + c="$c${4-}" + if [[ $c == "$cur_"* ]]; then + case $c in + *=|*.) ;; + *) c="$c " ;; + esac + COMPREPLY[i++]="${2-}$c" + fi + done + ;; + esac +} + +# Clear the variables caching builtins' options when (re-)sourcing +# the completion script. +if [[ -n ${ZSH_VERSION-} ]]; then + unset ${(M)${(k)parameters[@]}:#__gitcomp_builtin_*} 2>/dev/null +else + unset $(compgen -v __gitcomp_builtin_) +fi + +# This function is equivalent to +# +# ___git_resolved_builtins=$(git xxx --git-completion-helper) +# +# except that the result of the execution is cached. +# +# Accept 1-3 arguments: +# 1: the git command to execute, this is also the cache key +# (use "_" when the command contains spaces, e.g. "remote add" +# becomes "remote_add") +# 2: extra options to be added on top (e.g. negative forms) +# 3: options to be excluded +__git_resolve_builtins () +{ + local cmd="$1" + local incl="${2-}" + local excl="${3-}" + + local var=__gitcomp_builtin_"${cmd//-/_}" + local options + eval "options=\${$var-}" + + if [ -z "$options" ]; then + local completion_helper + if [ "${GIT_COMPLETION_SHOW_ALL-}" = "1" ]; then + completion_helper="--git-completion-helper-all" + else + completion_helper="--git-completion-helper" + fi + # leading and trailing spaces are significant to make + # option removal work correctly. + options=" $incl $(__git ${cmd/_/ } $completion_helper) " || return + + for i in $excl; do + options="${options/ $i / }" + done + eval "$var=\"$options\"" + fi + + ___git_resolved_builtins="$options" +} + +# This function is equivalent to +# +# __gitcomp "$(git xxx --git-completion-helper) ..." +# +# except that the output is cached. Accept 1-3 arguments: +# 1: the git command to execute, this is also the cache key +# (use "_" when the command contains spaces, e.g. "remote add" +# becomes "remote_add") +# 2: extra options to be added on top (e.g. negative forms) +# 3: options to be excluded +__gitcomp_builtin () +{ + __git_resolve_builtins "$1" "$2" "$3" + + __gitcomp "$___git_resolved_builtins" +} + +# Variation of __gitcomp_nl () that appends to the existing list of +# completion candidates, COMPREPLY. +__gitcomp_nl_append () +{ + local IFS=$'\n' + __gitcompappend "$1" "${2-}" "${3-$cur}" "${4- }" +} + +# Generates completion reply from newline-separated possible completion words +# by appending a space to all of them. +# It accepts 1 to 4 arguments: +# 1: List of possible completion words, separated by a single newline. +# 2: A prefix to be added to each possible completion word (optional). +# 3: Generate possible completion matches for this word (optional). +# 4: A suffix to be appended to each possible completion word instead of +# the default space (optional). If specified but empty, nothing is +# appended. +__gitcomp_nl () +{ + COMPREPLY=() + __gitcomp_nl_append "$@" +} + +# Fills the COMPREPLY array with prefiltered paths without any additional +# processing. +# Callers must take care of providing only paths that match the current path +# to be completed and adding any prefix path components, if necessary. +# 1: List of newline-separated matching paths, complete with all prefix +# path components. +__gitcomp_file_direct () +{ + local IFS=$'\n' + + COMPREPLY=($1) + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ >/dev/null || + true +} + +# Generates completion reply with compgen from newline-separated possible +# completion filenames. +# It accepts 1 to 3 arguments: +# 1: List of possible completion filenames, separated by a single newline. +# 2: A directory prefix to be added to each possible completion filename +# (optional). +# 3: Generate possible completion matches for this word (optional). +__gitcomp_file () +{ + local IFS=$'\n' + + # XXX does not work when the directory prefix contains a tilde, + # since tilde expansion is not applied. + # This means that COMPREPLY will be empty and Bash default + # completion will be used. + __gitcompadd "$1" "${2-}" "${3-$cur}" "" + + # use a hack to enable file mode in bash < 4 + compopt -o filenames +o nospace 2>/dev/null || + compgen -f /non-existing-dir/ >/dev/null || + true +} + +# Find the current subcommand for commands that follow the syntax: +# +# git +# +# 1: List of possible subcommands. +# 2: Optional subcommand to return when none is found. +__git_find_subcommand () +{ + local subcommand subcommands="$1" default_subcommand="$2" + + for subcommand in $subcommands; do + if [ "$subcommand" = "${words[__git_cmd_idx+1]}" ]; then + echo $subcommand + return + fi + done + + echo $default_subcommand +} + +# Execute 'git ls-files', unless the --committable option is specified, in +# which case it runs 'git diff-index' to find out the files that can be +# committed. It return paths relative to the directory specified in the first +# argument, and using the options specified in the second argument. +__git_ls_files_helper () +{ + if [ "$2" = "--committable" ]; then + __git -C "$1" -c core.quotePath=false diff-index \ + --name-only --relative HEAD -- "${3//\\/\\\\}*" + else + # NOTE: $2 is not quoted in order to support multiple options + __git -C "$1" -c core.quotePath=false ls-files \ + --exclude-standard $2 -- "${3//\\/\\\\}*" + fi +} + + +# __git_index_files accepts 1 or 2 arguments: +# 1: Options to pass to ls-files (required). +# 2: A directory path (optional). +# If provided, only files within the specified directory are listed. +# Sub directories are never recursed. Path must have a trailing +# slash. +# 3: List only paths matching this path component (optional). +__git_index_files () +{ + local root="$2" match="$3" + + __git_ls_files_helper "$root" "$1" "${match:-?}" | + awk -F / -v pfx="${2//\\/\\\\}" '{ + paths[$1] = 1 + } + END { + for (p in paths) { + if (substr(p, 1, 1) != "\"") { + # No special characters, easy! + print pfx p + continue + } + + # The path is quoted. + p = dequote(p) + if (p == "") + continue + + # Even when a directory name itself does not contain + # any special characters, it will still be quoted if + # any of its (stripped) trailing path components do. + # Because of this we may have seen the same directory + # both quoted and unquoted. + if (p in paths) + # We have seen the same directory unquoted, + # skip it. + continue + else + print pfx p + } + } + function dequote(p, bs_idx, out, esc, esc_idx, dec) { + # Skip opening double quote. + p = substr(p, 2) + + # Interpret backslash escape sequences. + while ((bs_idx = index(p, "\\")) != 0) { + out = out substr(p, 1, bs_idx - 1) + esc = substr(p, bs_idx + 1, 1) + p = substr(p, bs_idx + 2) + + if ((esc_idx = index("abtvfr\"\\", esc)) != 0) { + # C-style one-character escape sequence. + out = out substr("\a\b\t\v\f\r\"\\", + esc_idx, 1) + } else if (esc == "n") { + # Uh-oh, a newline character. + # We cannot reliably put a pathname + # containing a newline into COMPREPLY, + # and the newline would create a mess. + # Skip this path. + return "" + } else { + # Must be a \nnn octal value, then. + dec = esc * 64 + \ + substr(p, 1, 1) * 8 + \ + substr(p, 2, 1) + out = out sprintf("%c", dec) + p = substr(p, 3) + } + } + # Drop closing double quote, if there is one. + # (There is not any if this is a directory, as it was + # already stripped with the trailing path components.) + if (substr(p, length(p), 1) == "\"") + out = out substr(p, 1, length(p) - 1) + else + out = out p + + return out + }' +} + +# __git_complete_index_file requires 1 argument: +# 1: the options to pass to ls-file +# +# The exception is --committable, which finds the files appropriate commit. +__git_complete_index_file () +{ + local dequoted_word pfx="" cur_ + + __git_dequote "$cur" + + case "$dequoted_word" in + ?*/*) + pfx="${dequoted_word%/*}/" + cur_="${dequoted_word##*/}" + ;; + *) + cur_="$dequoted_word" + esac + + __gitcomp_file_direct "$(__git_index_files "$1" "$pfx" "$cur_")" +} + +# Lists branches from the local repository. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \ + "refs/heads/$cur_*" "refs/heads/$cur_*/**" +} + +# Lists branches from remote repositories. +# 1: A prefix to be added to each listed branch (optional). +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_remote_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \ + "refs/remotes/$cur_*" "refs/remotes/$cur_*/**" +} + +# Lists tags from the local repository. +# Accepts the same positional parameters as __git_heads() above. +__git_tags () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + __git for-each-ref --format="${pfx//\%/%%}%(refname:strip=2)$sfx" \ + ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \ + "refs/tags/$cur_*" "refs/tags/$cur_*/**" +} + +# List unique branches from refs/remotes used for 'git checkout' and 'git +# switch' tracking DWIMery. +# 1: A prefix to be added to each listed branch (optional) +# 2: List only branches matching this word (optional; list all branches if +# unset or empty). +# 3: A suffix to be appended to each listed branch (optional). +__git_dwim_remote_heads () +{ + local pfx="${1-}" cur_="${2-}" sfx="${3-}" + + # employ the heuristic used by git checkout and git switch + # Try to find a remote branch that cur_es the completion word + # but only output if the branch name is unique + local awk_script=' + function casemap(s) { + if (ENVIRON["IGNORE_CASE"]) + return tolower(s) + else + return s + } + BEGIN { + split(ENVIRON["REMOTES"], remotes, /\n/) + for (i in remotes) + remotes[i] = "refs/remotes/" casemap(remotes[i]) + cur_ = casemap(ENVIRON["CUR_"]) + } + { + ref_case = casemap($0) + for (i in remotes) { + if (index(ref_case, remotes[i] "/" cur_) == 1) { + branch = substr($0, length(remotes[i] "/") + 1) + print ENVIRON["PFX"] branch ENVIRON["SFX"] + break + } + } + } + ' + __git for-each-ref --format='%(refname)' refs/remotes/ | + PFX="$pfx" SFX="$sfx" CUR_="$cur_" \ + IGNORE_CASE=${GIT_COMPLETION_IGNORE_CASE+1} \ + REMOTES="$(__git_remotes | sort -r)" awk "$awk_script" | + sort | uniq -u +} + +# Lists refs from the local (by default) or from a remote repository. +# It accepts 0, 1 or 2 arguments: +# 1: The remote to list refs from (optional; ignored, if set but empty). +# Can be the name of a configured remote, a path, or a URL. +# 2: In addition to local refs, list unique branches from refs/remotes/ for +# 'git checkout's tracking DWIMery (optional; ignored, if set but empty). +# 3: A prefix to be added to each listed ref (optional). +# 4: List only refs matching this word (optional; list all refs if unset or +# empty). +# 5: A suffix to be appended to each listed ref (optional; ignored, if set +# but empty). +# +# Use __git_complete_refs() instead. +__git_refs () +{ + local i hash dir track="${2-}" + local list_refs_from=path remote="${1-}" + local format refs + local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}" + local match="${4-}" + local umatch="${4-}" + local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers + + __git_find_repo_path + dir="$__git_repo_path" + + if [ -z "$remote" ]; then + if [ -z "$dir" ]; then + return + fi + else + if __git_is_configured_remote "$remote"; then + # configured remote takes precedence over a + # local directory with the same name + list_refs_from=remote + elif [ -d "$remote/.git" ]; then + dir="$remote/.git" + elif [ -d "$remote" ]; then + dir="$remote" + else + list_refs_from=url + fi + fi + + if test "${GIT_COMPLETION_IGNORE_CASE:+1}" = "1" + then + # uppercase with tr instead of ${match,^^} for bash 3.2 compatibility + umatch=$(echo "$match" | tr a-z A-Z 2>/dev/null || echo "$match") + fi + + if [ "$list_refs_from" = path ]; then + if [[ "$cur_" == ^* ]]; then + pfx="$pfx^" + fer_pfx="$fer_pfx^" + cur_=${cur_#^} + match=${match#^} + umatch=${umatch#^} + fi + case "$cur_" in + refs|refs/*) + format="refname" + refs=("$match*" "$match*/**") + track="" + ;; + *) + for i in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD REBASE_HEAD CHERRY_PICK_HEAD REVERT_HEAD BISECT_HEAD AUTO_MERGE; do + case "$i" in + $match*|$umatch*) + if [ -e "$dir/$i" ]; then + echo "$pfx$i$sfx" + fi + ;; + esac + done + format="refname:strip=2" + refs=("refs/tags/$match*" "refs/tags/$match*/**" + "refs/heads/$match*" "refs/heads/$match*/**" + "refs/remotes/$match*" "refs/remotes/$match*/**") + ;; + esac + __git_dir="$dir" __git for-each-ref --format="$fer_pfx%($format)$sfx" \ + ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \ + "${refs[@]}" + if [ -n "$track" ]; then + __git_dwim_remote_heads "$pfx" "$match" "$sfx" + fi + return + fi + case "$cur_" in + refs|refs/*) + __git ls-remote "$remote" "$match*" | \ + while read -r hash i; do + case "$i" in + *^{}) ;; + *) echo "$pfx$i$sfx" ;; + esac + done + ;; + *) + if [ "$list_refs_from" = remote ]; then + case "HEAD" in + $match*|$umatch*) echo "${pfx}HEAD$sfx" ;; + esac + local strip="$(__git_count_path_components "refs/remotes/$remote")" + __git for-each-ref --format="$fer_pfx%(refname:strip=$strip)$sfx" \ + ${GIT_COMPLETION_IGNORE_CASE+--ignore-case} \ + "refs/remotes/$remote/$match*" \ + "refs/remotes/$remote/$match*/**" + else + local query_symref + case "HEAD" in + $match*|$umatch*) query_symref="HEAD" ;; + esac + __git ls-remote "$remote" $query_symref \ + "refs/tags/$match*" "refs/heads/$match*" \ + "refs/remotes/$match*" | + while read -r hash i; do + case "$i" in + *^{}) ;; + refs/*) echo "$pfx${i#refs/*/}$sfx" ;; + *) echo "$pfx$i$sfx" ;; # symbolic refs + esac + done + fi + ;; + esac +} + +# Completes refs, short and long, local and remote, symbolic and pseudo. +# +# Usage: __git_complete_refs [