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
|
||||
eval build
|
||||
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`.
|
||||
@ -210,9 +214,6 @@ build-debug() {
|
||||
|
||||
# Fuzzy find CMake variables, select one to set the variable via a command.
|
||||
.build-var() {
|
||||
if [[ ! -n $build_dir ]]; then
|
||||
build-dir
|
||||
fi
|
||||
local var=$(
|
||||
cat $build_dir/CMakeCache.txt |
|
||||
grep --color=never -Ex '^\w+:\w+=.*$' |
|
||||
@ -220,10 +221,12 @@ build-debug() {
|
||||
--cycle --height=50%
|
||||
)
|
||||
if [[ -n "$var" ]]; then
|
||||
BUFFER="cmake -B\$build_dir -D$var"
|
||||
if [[ "$BUFFER" = "cmake"* ]]; then
|
||||
BUFFER="$BUFFER-D$var"
|
||||
else
|
||||
BUFFER="cmake -B\$build_dir -D$var"
|
||||
fi
|
||||
zle end-of-line
|
||||
fi
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N .build-var
|
||||
bindkey '^B' .build-var
|
||||
|
Loading…
x
Reference in New Issue
Block a user