From e54f33f71ea6d96b1e2eafa445af4dd0fa9fe10a Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 2 Nov 2019 20:49:22 +1300 Subject: [PATCH 01/16] move systemd aliases to systemd repo --- .gitignore.d/zsh | 1 - .zsh/zshrc/85-systemd | 13 ------------- 2 files changed, 14 deletions(-) delete mode 100644 .zsh/zshrc/85-systemd diff --git a/.gitignore.d/zsh b/.gitignore.d/zsh index f346081..9df5f91 100644 --- a/.gitignore.d/zsh +++ b/.gitignore.d/zsh @@ -99,7 +99,6 @@ !/.zsh/zshrc/85-git !/.zsh/zshrc/85-git-annex !/.zsh/zshrc/85-mime-integration -!/.zsh/zshrc/85-systemd !/.zsh/zshrc/90-ls_on_chdir !/.zsh/zshrc/90-run-help !/.zsh/zshrc/95-watch-users diff --git a/.zsh/zshrc/85-systemd b/.zsh/zshrc/85-systemd deleted file mode 100644 index 34be874..0000000 --- a/.zsh/zshrc/85-systemd +++ /dev/null @@ -1,13 +0,0 @@ -# -# set up git aliases and functions -# -# Copyright © 2018 martin f. krafft -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: http://git.madduck.net/v/etc/zsh.git -# - -alias sc=systemctl -alias scu='sc --user' - -# vim:ft=zsh -- 2.39.5 From 5999f1756c68dc1af43185f01d41c123974e2a7d Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 2 Nov 2019 21:48:15 +1300 Subject: [PATCH 02/16] remove getpw override --- .gitignore.d/zsh | 1 - .zsh/zshrc/99-getpw-override | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 .zsh/zshrc/99-getpw-override diff --git a/.gitignore.d/zsh b/.gitignore.d/zsh index 9df5f91..17e6b6f 100644 --- a/.gitignore.d/zsh +++ b/.gitignore.d/zsh @@ -102,7 +102,6 @@ !/.zsh/zshrc/90-ls_on_chdir !/.zsh/zshrc/90-run-help !/.zsh/zshrc/95-watch-users -!/.zsh/zshrc/99-getpw-override !/.zsh/zshrc/99-prefill_prompt !/.zsh/zshrc/99-prompt_setup !/.zsh/zshrc/.gitignore diff --git a/.zsh/zshrc/99-getpw-override b/.zsh/zshrc/99-getpw-override deleted file mode 100644 index 4673014..0000000 --- a/.zsh/zshrc/99-getpw-override +++ /dev/null @@ -1,12 +0,0 @@ -unalias getpw 2>/dev/null -getpw() { - if ! pass -c "$@"; then - if old-getpw "$@"; then - echo >&2 "Please migrate the password for $@" - genpw "$@" - echo >&2 "Old password is now in X paste buffer, new one in clipboard" - fi - fi -} -autoload -zU compdef -compdef _pass getpw -- 2.39.5 From 308358cae2dd574c92560b7b20cc51394ddb9708 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Fri, 8 Nov 2019 11:29:37 +1300 Subject: [PATCH 03/16] add pts/tty to term title --- .zsh/zshrc/10-xterm_title | 1 + 1 file changed, 1 insertion(+) diff --git a/.zsh/zshrc/10-xterm_title b/.zsh/zshrc/10-xterm_title index b695811..c694eeb 100644 --- a/.zsh/zshrc/10-xterm_title +++ b/.zsh/zshrc/10-xterm_title @@ -36,6 +36,7 @@ __get_session_flags() { __get_standard_prompt() { emulate -L zsh + print -n "[${${(%):-%l}#pts/}]" [[ -z $SSH_CLIENT ]] || print -nP "%m" print -P "%#%25\<..\<%~ $(__get_session_flags)" } -- 2.39.5 From cff42941e40e7be77bf51e769dea7bb8dda74f89 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 26 Nov 2019 15:43:55 +1300 Subject: [PATCH 04/16] do not glob on mcd --- .zsh/aliases/mcd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zsh/aliases/mcd b/.zsh/aliases/mcd index f1b6807..0e55890 100644 --- a/.zsh/aliases/mcd +++ b/.zsh/aliases/mcd @@ -1 +1 @@ -() { mkdir -vp "$1" && cd "$1"; } +() { noglob mkdir -vp "$1" && noglob cd "$1"; } -- 2.39.5 From b6b8f018a4ab02d6b23abe65f65e78fbcb60ced6 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 10 Mar 2020 19:01:14 +0100 Subject: [PATCH 05/16] add run_on_load functionality --- .zsh/zshrc/99-prefill_prompt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.zsh/zshrc/99-prefill_prompt b/.zsh/zshrc/99-prefill_prompt index 0b2562e..21555be 100644 --- a/.zsh/zshrc/99-prefill_prompt +++ b/.zsh/zshrc/99-prefill_prompt @@ -12,4 +12,9 @@ if [[ -n "$ZSH_PREFILL_CMD" ]]; then unset ZSH_PREFILL_CMD fi +if [[ -n "$ZSH_RUN_ON_LOAD" ]]; then + eval $ZSH_RUN_ON_LOAD + unset ZSH_RUN_ON_LOAD +fi + # vim:ft=zsh -- 2.39.5 From f2551c20e16e66cde2c703f64eafefa9b5753129 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 28 Mar 2020 12:26:45 +1300 Subject: [PATCH 06/16] fix up xterm window title handling --- .zsh/zshrc/10-xterm_title | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.zsh/zshrc/10-xterm_title b/.zsh/zshrc/10-xterm_title index c694eeb..05da3de 100644 --- a/.zsh/zshrc/10-xterm_title +++ b/.zsh/zshrc/10-xterm_title @@ -13,14 +13,20 @@ autoload -U add-zsh-hook __set_xterm_title() { emulate -L zsh + local typ case $TERM in - screen) - print -nR $'\033k'$1$'\033'\\ + (tmux|tmux-*) typ=tmux;; + (screen|screen-*) if [ -n "$TMUX" ]; then typ=tmux else typ=screen fi;; + (*) typ=xterm + esac + + case "$typ" in + (xterm) print -nR $'\033]0;'$*$'\a';; + (screen) + print -nR $'\033k'$1$'\033'\\ print -nR $'\033]0;'$2$'\a' ;; - xterm|rxvt*) - print -nR $'\033]0;'$*$'\a' - ;; + (tmux) print -nR $'\033]2;'$*$'\a';; esac } -- 2.39.5 From fae90a2a15dde4a7472a5353857f1497c63e00db Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Sat, 28 Mar 2020 16:18:41 +1300 Subject: [PATCH 07/16] simplify tty in xterm title --- .zsh/zshrc/10-xterm_title | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.zsh/zshrc/10-xterm_title b/.zsh/zshrc/10-xterm_title index 05da3de..82f311a 100644 --- a/.zsh/zshrc/10-xterm_title +++ b/.zsh/zshrc/10-xterm_title @@ -42,9 +42,8 @@ __get_session_flags() { __get_standard_prompt() { emulate -L zsh - print -n "[${${(%):-%l}#pts/}]" [[ -z $SSH_CLIENT ]] || print -nP "%m" - print -P "%#%25\<..\<%~ $(__get_session_flags)" + print -P "@${${(%):-%l}#pts/}%#%25\<..\<%~ $(__get_session_flags)" } _set_plain_xterm_title() { -- 2.39.5 From 26ffc95f66633e04e63ddce54c6161c5ce80b6b7 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 7 May 2020 09:37:50 +1200 Subject: [PATCH 08/16] clean up functions no longer used --- .zsh/func/gitpub | 35 -------------------- .zsh/func/giturl | 79 --------------------------------------------- .zsh/func/idiotheke | 32 ------------------ .zsh/func/p | 25 -------------- .zsh/func/svngit | 51 ----------------------------- .zsh/func/urlencode | 16 --------- 6 files changed, 238 deletions(-) delete mode 100644 .zsh/func/gitpub delete mode 100644 .zsh/func/giturl delete mode 100755 .zsh/func/idiotheke delete mode 100644 .zsh/func/p delete mode 100644 .zsh/func/svngit delete mode 100644 .zsh/func/urlencode diff --git a/.zsh/func/gitpub b/.zsh/func/gitpub deleted file mode 100644 index d29230d..0000000 --- a/.zsh/func/gitpub +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# -# func/gitpub -# -# a convenient way to publicise a Git repository -# -# Copyright © 2008–2009 martin f. krafft -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: http://git.madduck.net/v/etc/zsh.git -# - -local oldpwd gitdir dest description tmpdir -oldpwd="$PWD" -gitdir="$(git rev-parse --git-dir)" -dest="$1"; shift -description="$@" -tmpdir="$(mktemp -d ${0##*/}.XXXXXX)" -trap "rm -rf $PWD/$tmpdir" EXIT - -cp -lr "$gitdir" "$tmpdir/gitdir" - -builtin cd "$tmpdir/gitdir" - -chmod -R a+rX . - -git config core.bare true -git config core.sharedrepository 2 -git config receive.denyNonFastforwards true - -echo "$description" >| description - -cd "$oldpwd" - -scp -r "$tmpdir/gitdir" "$dest" diff --git a/.zsh/func/giturl b/.zsh/func/giturl deleted file mode 100644 index 5f29ac0..0000000 --- a/.zsh/func/giturl +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# func/giturl -# -# A convenient way to display the gitweb URL of a commit-ish, as well as the -# base URL and tree. Also for each argument, the tree or blob URL is printed. -# -# Copyright © 2010 martin f. krafft -# Released under the terms of the Artistic Licence 2.0 -# Contributions from Yaroslav O. Halchenko -# -# Source repository: http://git.madduck.net/v/etc/zsh.git -# - -local branch remote remote_name -branch=$(git symbolic-ref -q HEAD); branch="${branch#refs/heads/}" -# Obtain remote which current branch tracks, origin if not known -remote_name=$(git config branch.$branch.remote || echo origin) -remote=$(git config --get remote.$remote_name.url) - -local part gitweb_base style commitkw -style=gitweb -commitkw=commitdiff # keyword for commit -- differ for github -argssep=: # separator for arguments of the query -case "$remote" in - madduck:pub/*|ssh://git.madduck.net/madduck/pub/*) - gitweb_base=http://git.madduck.net/v - part="${remote#madduck:pub/}" - part="${part#ssh://git.madduck.net/madduck/pub/}" - part="${part%.git}.git" - ;; - debian:*|*://git.debian.org/git/*|*://alioth.debian.org/git/*|*@git.debian.org/git/*) - gitweb_base=http://git.debian.org - part="${remote#debian:}" - part="${part#*://git.debian.org/git/}" - part="${part#*://alioth.debian.org/git/}" - part="${part#*@git.debian.org/git/}" - part="${part%.git}.git" - style=gitweb_old - ;; - github:*|*://github.com/*|*@github.com[/:]*) - gitweb_base=http://github.com - part="${remote#github:}" - part="${part#*://github.com/}" - part="${part#*@github.com[:/]}" - part="${part%.git}" - style=github - commitkw=commit - argssep= - ;; - *) - echo >&2 "E: I do not know how to translate $remote into a gitweb URL." - return 1 - ;; -esac - -local hash -hash=$(git rev-parse HEAD) - -case "$style" in - gitweb|github) - echo "$gitweb_base/$part" - echo "$gitweb_base/$part/$commitkw/$hash" - echo "$gitweb_base/$part/tree/HEAD" - for i in $@; do - [ -f "$i" ] && echo "$gitweb_base/$part/blob/HEAD${argssep}/$i" - [ -d "$i" ] && echo "$gitweb_base/$part/tree/HEAD${argssep}/$i" - done - ;; - gitweb_old) - echo "$gitweb_base/?p=$part" - echo "$gitweb_base/?p=$part;a=commitdiff;h=$hash" - echo "$gitweb_base/?p=$part;a=tree;h=HEAD" - for i in $@; do - [ -f "$i" ] && echo "$gitweb_base/?p=$part;a=blob;hb=HEAD;f=$i" - [ -d "$i" ] && echo "$gitweb_base/?p=$part;a=tree;hb=HEAD;f=$i" - done - ;; -esac diff --git a/.zsh/func/idiotheke b/.zsh/func/idiotheke deleted file mode 100755 index 5a0d5d6..0000000 --- a/.zsh/func/idiotheke +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -set -u - -if [ -n "${ZSH_VERSION:-}" ]; then - # don't execute trap on return from functions - setopt local_options posix_traps no_warn_create_global -fi - -RESOURCE=idiotheke.de -PASSWORD="$(pass $RESOURCE)" -LOGIN="$(echo "$PASSWORD" | sed -rne 's/login: //p')" -URL="$(echo "$PASSWORD" | sed -rne 's/url: //p')" -PASSWORD="${PASSWORD%% -*}" #first line only - -if [ -n "${1:-}" ]; then - ASKPASS="$(tempfile --prefix=askpass --mode=700)" - cleanup() { rm -f $ASKPASS; trap - 0; } - trap cleanup 0 - - echo '#!/bin/sh' >> $ASKPASS - echo "echo ${LOGIN}:${PASSWORD}" >> $ASKPASS - - wget --continue --use-askpass="$ASKPASS" "$@" - - cleanup - ! command -v unfunction >/dev/null || unfunction cleanup -else - LFTP_PASSWORD="$PASSWORD" lftp -e "open -u $LOGIN --env-password $URL" -fi - -unset RESOURCE LOGIN PASSWORD URL ASKPASS diff --git a/.zsh/func/p b/.zsh/func/p deleted file mode 100644 index 7a646df..0000000 --- a/.zsh/func/p +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/zsh -# -# func/p -# -# function to publish to a pastebin (using pastebinit) -# -# Copyright © 1994–2017 martin f. krafft -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: http://git.madduck.net/v/etc/zsh.git -# - -if [[ $# -gt 1 ]]; then - echo E: only one argument can be passed. >&2 - exit 1 -fi - -PERMATAG=$USER -PB=http://slexy.org -PBIT="pastebinit -b $PB -a $USER" - -FILE=- -[[ -n "$1" ]] && FILE="$1" - -eval $PBIT -i $FILE | sed -e s@/view/@/raw/@ diff --git a/.zsh/func/svngit b/.zsh/func/svngit deleted file mode 100644 index debbf53..0000000 --- a/.zsh/func/svngit +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# -# func/svngit -# -# one-time conversion of SVN repositories to Git repositories -# -# Copyright © 2006–2009 martin f. krafft -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: http://git.madduck.net/v/etc/zsh.git -# - -local svnrepo dest args -args=() - -for arg in "$@"; do - case "$arg" in - (svn+*|svn://|http://) - if [[ -z $svnrepo ]]; then - svnrepo="$arg" - else - echo "E: SVN repository multiply defined." >&2 - exit 1 - fi - ;; - (*) - if [[ -e $dest ]]; then - if [[ -d $dest ]] && [[ -z $svnrepo ]] && svn info $svnrepo >/dev/null 2>&1; then - svnrepo="$arg" - else - echo "E: destination $dest already exists." >&2 - exit 1 - fi - fi - if [[ -z $dest ]]; then - dest="$arg" - else - args+="$arg" - fi - ;; - esac -done - -git svn clone --no-metadata $args "$svnrepo" "$dest" - -cd "$dest/.git" - -test -d svn && rm -r svn -rm -rf **/git-svn* - -cd - diff --git a/.zsh/func/urlencode b/.zsh/func/urlencode deleted file mode 100644 index 5e4564f..0000000 --- a/.zsh/func/urlencode +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/zsh -# -# func/urlencode -# -# encode strings for use with URLs -# -# Copyright © 1994–2017 martin f. krafft -# Released under the terms of the Artistic Licence 2.0 -# -# Source repository: http://git.madduck.net/v/etc/zsh.git -# -# Based on http://www.michael-prokop.at/computer/config/.zshrc - -setopt localoptions extendedglob -input=( ${(s::)1} ) -print ${(j::)input/(#b)([^A-Za-z0-9_.!~*\'\(\)-])/%$(([##16]#match))} -- 2.39.5 From 3461c406d3de0fa8152660096c0514a39194c41c Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 6 Sep 2021 22:05:23 +1200 Subject: [PATCH 09/16] enable _do_debug handling --- .zsh/rcsstub | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.zsh/rcsstub b/.zsh/rcsstub index cf9a202..c9d8329 100644 --- a/.zsh/rcsstub +++ b/.zsh/rcsstub @@ -13,7 +13,7 @@ if [[ -o rcs ]]; then source $ZDOTDIR/util source $ZDOTDIR/sourcedir -# __do_debug && set -x || : + __do_debug && set -x || : _DIR=$ZDOTDIR/${${(%):-%1N}#.} sourcedir $_DIR @@ -24,7 +24,7 @@ if [[ -o rcs ]]; then unset _DIR -# __do_debug && set +x || : + __do_debug && set +x || : fi # vim:ft=zsh -- 2.39.5 From 2188fcdf52262cc8ed492d9ad439e6ca91f5e9ca Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 3 Feb 2022 07:15:40 +0100 Subject: [PATCH 10/16] Improved tmpdir functions --- .zsh/zshenv/00-tmpdir | 4 +++- .zsh/zshrc/20-tempfile+dir_functions | 34 +++++++++++++++++++--------- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/.zsh/zshenv/00-tmpdir b/.zsh/zshenv/00-tmpdir index 9bce287..1184b07 100644 --- a/.zsh/zshenv/00-tmpdir +++ b/.zsh/zshenv/00-tmpdir @@ -7,7 +7,7 @@ # Source repository: http://git.madduck.net/v/etc/zsh.git # -export TMPDIR="/tmp/${(%):-%n}" +TMPDIR="/tmp/${(%):-%n}" mkdir --mode=700 --parent "${TMPDIR}" typeset -l LTMPDIR="${HOME}/.tmp" @@ -19,4 +19,6 @@ fi TMPPREFIX="${TMPDIR}/zsh" +export TMPDIR + # vim:ft=zsh diff --git a/.zsh/zshrc/20-tempfile+dir_functions b/.zsh/zshrc/20-tempfile+dir_functions index 6781557..c45c3c3 100644 --- a/.zsh/zshrc/20-tempfile+dir_functions +++ b/.zsh/zshrc/20-tempfile+dir_functions @@ -9,10 +9,16 @@ cdt() { emulate -L zsh - REPLY=$(mktemp -td ${1:-cdt}.XXXXXX) - builtin cd "$REPLY" - rm -f ${TMPDIR:-/tmp}/cdt.latest - ln -s "$REPLY" ${TMPDIR:-/tmp}/cdt.latest + local dirname="$(date +'%F-%H%M%S')${1:+-$1}" + REPLY="${TMPDIR:-/tmp}/$dirname" + mkdir -m700 "$REPLY" + if [[ -n "$1" ]]; then + local link="${TMPDIR:-/tmp}/${1:-cdt}" + ln -Tnsf "$dirname" "$link" + builtin cd "$link" + else + builtin cd "$REPLY" + fi echo "$REPLY" } @@ -26,22 +32,23 @@ bindkey '\ed' _cdt vit() { emulate -L zsh - local prefix i + local i tag for i in "$@"; do case "$i" in -) local stdin=1; shift;; - *) if [ -z "${prefix:-}" ]; then - prefix="$i"; shift + *) if [ -z "${tag:-}" ]; then + tag="$i"; shift else - zwarn "prefix $prefix already specified, skipping: $i" + zwarn "tag $tag already specified, skipping: $i" fi ;; esac done - REPLY=$(mktemp -t ${prefix:-vit}-XXXXXX.txt) + local file="$(date +'%F-%H%M%S')${tag:+-$tag}" + REPLY="${TMPDIR:-/tmp}/$file" [ -n "$stdin" ] && cat >| "$REPLY" sensible-editor +start "$REPLY" /dev/tty - ln -sf "$REPLY" ${TMPDIR:-/tmp}/vit.latest + ln -Tsf $file ${TMPDIR:-/tmp}/${tag:-vit} echo "$REPLY" } _vit() { @@ -53,7 +60,12 @@ zle -N _vit bindkey '\ef' _vit pastebin() { - local target="${(%):-"%D{%F-%H%M%S}"}-${1##*/}" + local target basename; + basename="${1##*/}" + case "$basename" in + (????-??-??-*) target="$basename";; + (*) target="${(%):-"%D{%F-%H%M%S}"}-$basename";; + esac pub "${1}==${target}" 2>&1 } -- 2.39.5 From bb3673a748508fa608af0f5cdff13bcdbedd8e32 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 3 Feb 2022 07:15:52 +0100 Subject: [PATCH 11/16] git aliases --- .zsh/zshrc/85-git | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.zsh/zshrc/85-git b/.zsh/zshrc/85-git index d60ce99..d4023d8 100644 --- a/.zsh/zshrc/85-git +++ b/.zsh/zshrc/85-git @@ -18,6 +18,10 @@ alias gd='g diff' alias gg='g pull' alias gr='g rebase' alias gp='g push' +alias gap='g add -p' +alias gac='gap && gc' +alias gh='g stash' +alias ghp='g stash pop' function gtestfile() { local fname="${1:-$(tempfile -d ${PWD})}" -- 2.39.5 From db608883d834ac7e99469eb6332a1671bf450bf0 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 19 May 2022 10:33:59 +0200 Subject: [PATCH 12/16] declare LOGCHECK global --- .zsh/zshrc/95-watch-users | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zsh/zshrc/95-watch-users b/.zsh/zshrc/95-watch-users index 17f7a1a..0720974 100644 --- a/.zsh/zshrc/95-watch-users +++ b/.zsh/zshrc/95-watch-users @@ -9,6 +9,6 @@ typeset -U watch WATCH watch=(notme) -LOGCHECK=120 +declare -g LOGCHECK=120 # vim:ft=zsh -- 2.39.5 From c3da6fd36611ed2f8f251f07262830b21b2a562b Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 19 May 2022 10:34:37 +0200 Subject: [PATCH 13/16] extract filetype from filename in vit function --- .zsh/zshrc/20-tempfile+dir_functions | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.zsh/zshrc/20-tempfile+dir_functions b/.zsh/zshrc/20-tempfile+dir_functions index c45c3c3..e782fe0 100644 --- a/.zsh/zshrc/20-tempfile+dir_functions +++ b/.zsh/zshrc/20-tempfile+dir_functions @@ -36,6 +36,12 @@ vit() { for i in "$@"; do case "$i" in -) local stdin=1; shift;; + .*) if [ -z "${ft:-}" ]; then + ft="${i#.}"; shift + else + zwarn "filetype $ft already specified, skipping: ${i#.}" + fi + ;; *) if [ -z "${tag:-}" ]; then tag="$i"; shift else -- 2.39.5 From 7dce7e6f21351832f6e926d8a4f1edf767c2e47e Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Thu, 19 May 2022 10:34:53 +0200 Subject: [PATCH 14/16] Escape zsh run on load code --- .zsh/zshrc/99-prefill_prompt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.zsh/zshrc/99-prefill_prompt b/.zsh/zshrc/99-prefill_prompt index 21555be..8c18a1a 100644 --- a/.zsh/zshrc/99-prefill_prompt +++ b/.zsh/zshrc/99-prefill_prompt @@ -13,7 +13,7 @@ if [[ -n "$ZSH_PREFILL_CMD" ]]; then fi if [[ -n "$ZSH_RUN_ON_LOAD" ]]; then - eval $ZSH_RUN_ON_LOAD + eval "$ZSH_RUN_ON_LOAD" unset ZSH_RUN_ON_LOAD fi -- 2.39.5 From 51ac318a1294c0cc8a4eb2e5f8c647a2e2b7001f Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Tue, 23 Aug 2022 09:59:11 +0200 Subject: [PATCH 15/16] add inplace list --- .zsh/zshrc/80-zle_inplace_list | 37 ++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .zsh/zshrc/80-zle_inplace_list diff --git a/.zsh/zshrc/80-zle_inplace_list b/.zsh/zshrc/80-zle_inplace_list new file mode 100644 index 0000000..dc7753d --- /dev/null +++ b/.zsh/zshrc/80-zle_inplace_list @@ -0,0 +1,37 @@ +# +# Provide a way to list target directory contents while editing ZLE +# +# Copyright © 1994–2017 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +# Source repository: http://git.madduck.net/v/etc/zsh.git +# + +_list_inplace() { + emulate -L zsh + local lastarg + if ((REGION_ACTIVE==1)); then + local F=$MARK T=$CURSOR + if [[ $F -gt $T ]]; then + F=${CURSOR} + T=${MARK} + fi + # get marked area from buffer and eliminate whitespace + lastarg=${BUFFER[F+1,T]%%[[:space:]]##} + lastarg=${pathtoview##[[:space:]]##} + else + local bufwords iword + bufwords=(${(z)LBUFFER}) + iword=${#bufwords} + bufwords=(${(z)BUFFER}) + lastarg="${(Q)bufwords[iword]}" + fi + [[ -z "${lastarg}" ]] && return 1 + ls -l ${~lastarg:h} + zle end-of-line +} +zle -N _list_inplace +bindkey '\el' _list_inplace + +# vim:ft=zsh + -- 2.39.5 From bbc6ef11c56f5a72285ef5ac88b0d130d3d4bb21 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 21 Sep 2022 12:16:15 +0200 Subject: [PATCH 16/16] provide a new shortcut to list files in target dir by time --- .zsh/zshrc/80-zle_inplace_list | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.zsh/zshrc/80-zle_inplace_list b/.zsh/zshrc/80-zle_inplace_list index dc7753d..1f66759 100644 --- a/.zsh/zshrc/80-zle_inplace_list +++ b/.zsh/zshrc/80-zle_inplace_list @@ -27,11 +27,19 @@ _list_inplace() { lastarg="${(Q)bufwords[iword]}" fi [[ -z "${lastarg}" ]] && return 1 - ls -l ${~lastarg:h} - zle end-of-line + ls "$@" ${~lastarg} + zle redisplay + #zle end-of-line } zle -N _list_inplace bindkey '\el' _list_inplace +_list_inplace_time() { + emulate -L zsh + _list_inplace -rt +} +zle -N _list_inplace_time +bindkey '\eL' _list_inplace_time + # vim:ft=zsh -- 2.39.5