Skip to content

Instantly share code, notes, and snippets.

@praveendhawan
Created August 28, 2018 05:56
Show Gist options
  • Save praveendhawan/9c3ddd7eb9be3227066980951afe7671 to your computer and use it in GitHub Desktop.
Save praveendhawan/9c3ddd7eb9be3227066980951afe7671 to your computer and use it in GitHub Desktop.
Ripper-Tags - wrapper to work with gutentags - taken from - https://github.com/tmm1/ripper-tags/issues/49#issuecomment-386535936
#!/bin/sh
#
# Wrapper script to make the "ripper-tags" gem (https://github.com/tmm1/ripper-tags)
# work with vim-gutentags (https://github.com/ludovicchabant/vim-gutentags)
#
# Put this script in your $PATH, make it executable and configure vim-gutentags like this:
#
# "let g:gutentags_ctags_executable_ruby = 'rtags'"
#
# Parts taken from https://stackoverflow.com/a/14203146/171364 and https://github.com/tmm1/ripper-tags/issues/49
#
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-f)
TAGS_FILE_NAME="$2"
shift # past argument
shift # past value
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
if [[ $* = *"--append"* ]]; then
cat ${TAGS_FILE_NAME} \
| (cat && ripper-tags --ignore-unsupported-options -f - ${*/--append}) \
| grep -v '^!_' \
| sort \
> tags~ && mv tags~ ${TAGS_FILE_NAME}
else
ripper-tags --ignore-unsupported-options $*
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment