Escape * in vimdebug before passing to debug
With `setopt nonomatch` unescaped `*` can be used in command arguments however when passing command arguments to `vimdebug` the `*` _should_ be escaped so that the debugger e.g. `gdb` will correctly invoke the program where `setopt nonomatch` does not apply.
This commit is contained in:
parent
6bd2b8f0cc
commit
a095e9383c
@ -8,7 +8,16 @@ alias build="build-dir --build"
|
|||||||
# command line arguments.
|
# command line arguments.
|
||||||
if [ `uname` = Linux ]; then
|
if [ `uname` = Linux ]; then
|
||||||
if [[ "`vim --version`" =~ "^VIM - Vi IMproved 8\.1.*$" ]]; then
|
if [[ "`vim --version`" =~ "^VIM - Vi IMproved 8\.1.*$" ]]; then
|
||||||
function vimdebug() { vim "+packadd termdebug" "+TermdebugCommand $*" }
|
autoload -U regexp-replace
|
||||||
|
function vimdebug() {
|
||||||
|
# For each item in $* replace * and \* and then replace \ with \\
|
||||||
|
local args=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
regexp-replace arg '\*' '\\*'
|
||||||
|
args+=($arg)
|
||||||
|
done
|
||||||
|
vim "+packadd termdebug" "+TermdebugCommand $args"
|
||||||
|
}
|
||||||
alias debug='vimdebug'
|
alias debug='vimdebug'
|
||||||
elif which cgdb &> /dev/null; then
|
elif which cgdb &> /dev/null; then
|
||||||
alias debug='cgdb --args'
|
alias debug='cgdb --args'
|
||||||
@ -165,11 +174,11 @@ EOF
|
|||||||
# Build then run a target residing in `~build/bin`.
|
# Build then run a target residing in `~build/bin`.
|
||||||
build-run() {
|
build-run() {
|
||||||
local target=$1; shift 1
|
local target=$1; shift 1
|
||||||
eval build $target && ~build/bin/$target $*
|
eval build $target && ~build/bin/$target "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Build then debug a target residing in `~build/bin`.
|
# Build then debug a target residing in `~build/bin`.
|
||||||
build-debug() {
|
build-debug() {
|
||||||
local target=$1; shift 1
|
local target=$1; shift 1
|
||||||
eval build $target && debug ~build/bin/$target $*
|
eval build $target && debug ~build/bin/$target "$@"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user