Tweak .build-dir widget and only enable during build-dir
This commit is contained in:
parent
dcacb1de42
commit
f7bca0102a
@ -194,6 +194,10 @@ EOF
|
|||||||
if [[ -n $do_build ]]; then
|
if [[ -n $do_build ]]; then
|
||||||
eval build
|
eval build
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Bind C-B to fuzzy find & complete cmake variables.
|
||||||
|
zle -N .build-var
|
||||||
|
bindkey '^B' .build-var
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build then run a target residing in `~build/bin`.
|
# Build then run a target residing in `~build/bin`.
|
||||||
@ -210,9 +214,6 @@ build-debug() {
|
|||||||
|
|
||||||
# Fuzzy find CMake variables, select one to set the variable via a command.
|
# Fuzzy find CMake variables, select one to set the variable via a command.
|
||||||
.build-var() {
|
.build-var() {
|
||||||
if [[ ! -n $build_dir ]]; then
|
|
||||||
build-dir
|
|
||||||
fi
|
|
||||||
local var=$(
|
local var=$(
|
||||||
cat $build_dir/CMakeCache.txt |
|
cat $build_dir/CMakeCache.txt |
|
||||||
grep --color=never -Ex '^\w+:\w+=.*$' |
|
grep --color=never -Ex '^\w+:\w+=.*$' |
|
||||||
@ -220,10 +221,12 @@ build-debug() {
|
|||||||
--cycle --height=50%
|
--cycle --height=50%
|
||||||
)
|
)
|
||||||
if [[ -n "$var" ]]; then
|
if [[ -n "$var" ]]; then
|
||||||
|
if [[ "$BUFFER" = "cmake"* ]]; then
|
||||||
|
BUFFER="$BUFFER-D$var"
|
||||||
|
else
|
||||||
BUFFER="cmake -B\$build_dir -D$var"
|
BUFFER="cmake -B\$build_dir -D$var"
|
||||||
|
fi
|
||||||
zle end-of-line
|
zle end-of-line
|
||||||
fi
|
fi
|
||||||
zle reset-prompt
|
zle reset-prompt
|
||||||
}
|
}
|
||||||
zle -N .build-var
|
|
||||||
bindkey '^B' .build-var
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user