diff options
| author | sph <sph@sphnet.in> | 2026-03-09 10:20:10 +0100 |
|---|---|---|
| committer | dana <dana@dana.is> | 2026-05-16 19:04:18 -0500 |
| commit | 6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9 (patch) | |
| tree | 5828a18f1814c529b667d18564deeeb296dc16af | |
| parent | github #170 (tweaked): Clarify the documentation about -d flag in compadd (diff) | |
| download | zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.tar zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.tar.gz zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.tar.bz2 zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.tar.lz zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.tar.xz zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.tar.zst zsh-6cd02b9e2a005e2a2fb3bd4af09878bf86e7b7c9.zip | |
github #161 (tweaked): zkbd: allow zkbd to generate config in a custom directory
+ check for empty arg
| -rw-r--r-- | ChangeLog | 4 | ||||
| -rw-r--r-- | Doc/Zsh/contrib.yo | 8 | ||||
| -rw-r--r-- | Functions/Misc/zkbd | 10 |
3 files changed, 17 insertions, 5 deletions
@@ -1,5 +1,9 @@ 2026-05-16 dana <dana@dana.is> + * sph: github #161 (tweaked): Doc/Zsh/contrib.yo, + Functions/Misc/zkbd: allow zkbd to generate config in a custom + directory + * Michael Baikov: github #170 (tweaked): Doc/Zsh/compwid.yo: Clarify the documentation about -d flag in compadd diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index 1e088907c..eb52c1fe7 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -190,9 +190,11 @@ ordinary, such as a Delete key that sends neither tt(^H) nor tt(^?). The keystrokes read by tt(zkbd) are recorded as a definition for an associative array named tt(key), written to a file in the subdirectory -tt(.zkbd) within either your tt(HOME) or tt(ZDOTDIR) directory. The name -of the file is composed from the tt(TERM), tt(VENDOR) and tt(OSTYPE) -parameters, joined by hyphens. +tt(.zkbd) within either your tt(HOME) or, if specified, tt(ZDOTDIR) directory. +Alternatively, you can tell tt(zkbd) the directory to write new files into +with the tt(-d) option, e.g. tt(zkbd -d $ZCACHEDIR/zkbd). In either case, the +directory is created if it did not exist. The name of the file is composed from +the tt(TERM), tt(VENDOR) and tt(OSTYPE) parameters, joined by hyphens. You may read this file into your tt(.zshrc) or another startup file with the `tt(source)' or `tt(.)' commands, then reference the tt(key) parameter diff --git a/Functions/Misc/zkbd b/Functions/Misc/zkbd index 1065a84f1..493cc65ea 100644 --- a/Functions/Misc/zkbd +++ b/Functions/Misc/zkbd @@ -9,9 +9,15 @@ } emulate -RL zsh -local zkbd term key seq +local zkbd override term key seq -zkbd=${ZDOTDIR:-$HOME}/.zkbd +zparseopts -D -F -- d:=override || return 1 + +if (( $#override )); then + zkbd=$override[2] +else + zkbd=${ZDOTDIR:-$HOME}/.zkbd +fi [[ -d $zkbd ]] || mkdir $zkbd || return 1 trap 'unfunction getmbkey getseq; command rm -f $zkbd/$TERM.tmp' 0 |
