Mercurial > vim-gutentags
changeset 251:e61d20280c6c
Fix some more spaces-in-paths issues.
When using the tags cache directory, the project root is passed to ctags.
Escaping this path didn't work correctly when it has spaces:
- We remove the quotes around it on *nix because `job_start()` doesn't
like those, but then we need to escape the spaces with backslashes
otherwise the script doesn't understand those parameters.
- Once the escaping is gone in the script, we need to quote them but it
looks like sh doesn't like double quotes in the middle of an env var
or something, so we need to put the project root in a separate env
var.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 25 Oct 2019 23:52:12 -0700 |
parents | d264db0126c2 |
children | 56dc6f8e5472 |
files | autoload/gutentags.vim plat/unix/update_tags.sh |
diffstat | 2 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/autoload/gutentags.vim Fri Oct 25 23:48:08 2019 -0700 +++ b/autoload/gutentags.vim Fri Oct 25 23:52:12 2019 -0700 @@ -114,7 +114,9 @@ let l:arglen = strlen(cmdarg) if (cmdarg[0] == '"' && cmdarg[l:arglen - 1] == '"') || \(cmdarg[0] == "'" && cmdarg[l:arglen - 1] == "'") - call add(l:outcmd, cmdarg[1:-2]) + " This was quoted, so there are probably things to escape. + let l:escapedarg = cmdarg[1:-2] " substitute(cmdarg[1:-2], '\ ', '\\ ', 'g') + call add(l:outcmd, l:escapedarg) else call add(l:outcmd, cmdarg) endif
--- a/plat/unix/update_tags.sh Fri Oct 25 23:48:08 2019 -0700 +++ b/plat/unix/update_tags.sh Fri Oct 25 23:52:12 2019 -0700 @@ -5,6 +5,7 @@ PROG_NAME=$0 CTAGS_EXE=ctags CTAGS_ARGS= +CTAGS_ARG_QUOTED_LAST= TAGS_FILE=tags PROJECT_ROOT= LOG_FILE= @@ -120,14 +121,15 @@ echo "${PROJECT_ROOT%/}/${l}" done > "${TAGS_FILE}.files" fi - CTAGS_ARGS="${CTAGS_ARGS} -L "${TAGS_FILE}.files"" + CTAGS_ARGS="${CTAGS_ARGS} -L" + CTAGS_ARG_QUOTED_LAST="${TAGS_FILE}.files" else - CTAGS_ARGS="${CTAGS_ARGS} "${PROJECT_ROOT}"" + CTAGS_ARG_QUOTED_LAST="${PROJECT_ROOT}" fi echo "Running ctags on whole project" - echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS" - $CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS + echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS \"$CTAGS_ARG_QUOTED_LAST\"" + $CTAGS_EXE -f "$TAGS_FILE.temp" $CTAGS_ARGS "$CTAGS_ARG_QUOTED_LAST" else echo "Running ctags on \"$UPDATED_SOURCE\"" echo "$CTAGS_EXE -f \"$TAGS_FILE.temp\" $CTAGS_ARGS --append \"$UPDATED_SOURCE\""