-
-
Save splace/4d186d2ed8642d39a5ab5ca090f2b6ba to your computer and use it in GitHub Desktop.
gedit tool to search go-lang package files for text and produce clickable links to the files/lines found.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# [Gedit Tool] | |
# Name=find | |
# Languages=go | |
# Input=nothing | |
# Output=output-panel | |
# Applicability=all | |
# Save-files=nothing | |
# Shortcut=<Primary><Shift>f | |
# search selected (text) in all go files in CWD | |
# use zenity query when no selection | |
if [ -z "$GEDIT_SELECTED_TEXT" ]; then | |
GEDIT_SELECTED_TEXT=`zenity --entry --title="Find in files" --text="Find:" --entry-text "XXX"` || exit 1 | |
fi | |
# with all (non-test) go files in current dir; | |
for filename in *.go | |
do | |
case $filename in *_test.go) continue;; esac | |
awk "/$GEDIT_SELECTED_TEXT/{ print FILENAME\":\"NR\":\", \$0 }" $filename | |
done; | |
# with test files. | |
for filename in *_test.go | |
do | |
awk "/$GEDIT_SELECTED_TEXT/{ print FILENAME\":\"NR\":\", \$0 }" $filename | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
file format, the meta data comments, are for gedit 3+
but cut/paste into 'manage external tools' for all versions.
and/or change "GEDIT" to "PLUMA" for Pluma.