diff --git a/Commands/Lookup word in PHP manual.plist b/Commands/Documentation for Word.tmCommand similarity index 93% rename from Commands/Lookup word in PHP manual.plist rename to Commands/Documentation for Word.tmCommand index 5d435a1..0f832f1 100644 --- a/Commands/Lookup word in PHP manual.plist +++ b/Commands/Documentation for Word.tmCommand @@ -10,13 +10,15 @@ #!/usr/bin/env bash [[ -f "${TM_SUPPORT_PATH}/lib/bash_init.sh" ]] && . "${TM_SUPPORT_PATH}/lib/bash_init.sh" -if grep <<<${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$' +term=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD} + +if grep <<<${term} -Esq '^[a-zA-Z0-9_]+$' then if URL=`grep -i "^$TM_CURRENT_WORD=" "$TM_BUNDLE_SUPPORT/documentation.txt"` then - URL=${URL:${#TM_CURRENT_WORD}+1} + URL=${URL:${#term}+1} else - URL="function.${TM_CURRENT_WORD//_/-}" + URL="function.${term//_/-}" fi if [[ "$PHP_MANUAL_LOCATION" ]] then @@ -26,7 +28,7 @@ if grep <<<${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$' fi if [[ ! -f "$PHP_MANUAL_LOCATION/$URL.html" ]] then - exit_show_tool_tip "No documentation found for '$TM_CURRENT_WORD'" + exit_show_tool_tip "No documentation found for '$term'" fi . "$TM_SUPPORT_PATH/lib/webpreview.sh" html_header "PHP Help" "${TM_FILENAME:-}" @@ -49,7 +51,7 @@ if grep <<<${TM_CURRENT_WORD:-!} -Esq '^[a-zA-Z0-9_]+$' historyList.appendChild(item); item.selected = true; } - + function setupLinks() { var link, links = document.links; for (i = 0; i < links.length; i++) {