External Tools Plugin Command Collection
This page contains an overview of the of third party commands for the External Tools Plugin that shipped with gEdit. If you have wrote a command for the External Tool Plugin you can add it yourself here or send it via email to bart neeneenee de. The snippet must contain: headline, language, requirements, menu name, description, command, input, output and applicability. You can learn more about the External Tools Plugin at the gEdit user manual.
Check Website Links (commandline tool)
Language: Any
Requires: Linkchecker (commandline tool), Zenity
Menu Name: Check Links...
Description: Check for broken Links of a Website
#!/bin/sh
exec linkchecker `zenity --entry --title="Links prüfen" --width="500" --height="150" --text="Enter the URL to validate:\n " --entry-text "http://www." ` &
Input: None
Output: Display in bottom pane
Applicability: All documents
Check Website Links (GUI)
Language: Any
Requires: gURLchecker, Zenity
Menu Name: Check for broken Links of a Website
Description: Validate Links of a Website
#!/bin/sh
exec gurlchecker `zenity --entry --title="Links prüfen" --width="500" --height="150" --text="Enter the URL to validate:\n " --entry-text "http://www." ` &
Input: None
Output: Display in bottom pane
Applicability: All documents
Code Snippets
Language: Any
Requires: pySnippet
Menu Name: Code Snippets
Description: Insert Code Snippets
#!/bin/sh
python /usr/bin/pysnippet.py &
Input: None
Output: Display in bottom pane
Applicability: All documents
Comparing Files
Language: Any
Requires: Meld, Zenity
Menu Name: Compare With...
Description: Compare current document with another document
#!/bin/sh
TITLE="Compare With..."
TEXT="Compare $GEDIT_CURRENT_DOCUMENT_NAME with:"
BROWSE=" browse..."
FILE=
while [ -z "$FILE" ]; do
FILE=`zenity --list --title="$TITLE" --text="$TEXT" --width=640 --height=320 --column=Documents $GEDIT_DOCUMENTS_PATH "$BROWSE"`
if [ "$FILE" == "$BROWSE" ]; then
FILE=`zenity --file-selection --title="$TITLE" --filename="$GEDIT_CURRENT_DOCUMENT_DIR/"`
elif [ -z "$FILE" ]; then
exit
fi
done
meld "$GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME" "$FILE" &
Input: Nothing
Output: Display in bottom pane
Applicability: Local files only
Directory listing
Language: Any
Requires: Shell
Menu Name: List current Directory
Description: List the directory of the current document
ls -l -h $GEDIT_CURRENT_DOCUMENT_DIR
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Environmet Variables listing
Language: Any
Requires: Shell Menu Name: List Environmet Variables Description: List the Environmet Variables of the system
env
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Java compile and run
Language: Java
Requires: Java
Menu Name: Java compile and run
Description: Compile the current Java code and execute it
#!/bin/sh
cd $GEDIT_CURRENT_DOCUMENT_DIR
if javac $GEDIT_CURRENT_DOCUMENT_NAME;
then
java ${GEDIT_CURRENT_DOCUMENT_NAME%\.java}
else
echo "Failed to compile"
fi
Input: Current document
Output: Display in bottom pane
Applicability: All documents
C compile and run
Language: C
Requires: gcc, xterm
Menu Name: C compile and run
Description: Compile the current C code and execute it
#!/bin/bash
gcc $GEDIT_CURRENT_DOCUMENT_NAME -o ${GEDIT_CURRENT_DOCUMENT_NAME%.*}
DESU=`echo ${GEDIT_CURRENT_DOCUMENT_NAME}|cut -d "." -f 1`
xterm -hold -e ./$DESU --working-directory=$GEDIT_CURRENT_DOCUMENT_DIR
Input: Nothing
Output: Display in bottom pane
Applicability: All documents
Lorem Ipsum Text
Language: Any
Requires: Lorem Ipsum Generator
Menu Name: Lorem Ipsum text...
Description: Create dummy text
#!/bin/sh
lorem-ipsum-generator &
Input: Current document
Output: Display in bottom pane
Applicability: All documents
PHP Code Formating
Language: PHP
Requires: PHP, PHP Pear
Menu Name: Reformat PHP code
Description: Reformat the PHP code of the current document
php_beautifier -s4 -l "ArrayNested() IndentStyles(style=bsd) NewLines(before=if:switch:while:for:foreach:function:T_CLASS:return:break,after=T_COMMENT)"
Input: Current document
Output: Create new document
Applicability: All documents
Rake
Language: Ruby on Rails (RoR)
Requires: Ruby on Rails, Ruby, Zenity
Menu Name: Rake Tasks
Description: Run Rake with selected Tasks
#!/bin/sh
rake `rake --tasks --silent | cut -d" " -f2 | zenity --list --title="Select rake task" --column="Task"` &
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Rename Files
Language: Any
Requires: PyRenamer
Menu Name: Rename files...
Description: Rename a sequence of files in the current directory
#!/bin/sh
pyrenamer --root $GEDIT_CURRENT_DOCUMENT_DIR &
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Ruby Execute
Language: Ruby
Requires: Ruby, Zenity
Menu Name: Ruby Execute
Description: Execute current document with Ruby
#!/bin/sh
ruby
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Search/ Replace in Files
Language: Any
Requires: Regexxer
Menu Name: Search/ Replace in files...
Description: Search or Replace in files at the directory of the current document
#!/bin/sh
regexxer --hidden --ignore-case --line-number --pattern=$GEDIT_CURRENT_DOCUMENT_NAME $GEDIT_CURRENT_DOCUMENT_DIR &
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Validate/ Optimize CSS
Language: Cascading Stylesheets CSS
Requires: CSStidy, Zenity
Menu Name: Validate/ Optimize CSS...
Description: Validate or optimize the current cascading stylesheet
#!/bin/sh
zenity --question --title="Validate/ Optimize CSS" --text="Should the stylesheet file optimized too?"
case "$?" in
0)
exec csstidy "$GEDIT_CURRENT_DOCUMENT_NAME" --compress_colors=true --lowercase_s=true --optimise_shorthands=true --compress_font-weight=true --merge_selectors=true --template=high --discard_invalid_properties=false "$GEDIT_CURRENT_DOCUMENT_NAME";;
1)
exec csstidy "$GEDIT_CURRENT_DOCUMENT_NAME" --compress_colors=true --lowercase_s=true --optimise_shorthands=true --compress_font-weight=true --merge_selectors=true --template=high --discard_invalid_properties=false "/tmp/$GEDIT_CURRENT_DOCUMENT_NAME";;
esac
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Validate/ Reformat XHTML Code
Language: XHTML
Requires: Tidy, Zenity
Menu Name: Validate/ Reformat XHTML code
Description: Validate or reformates the current XHTML document
#!/bin/sh
zenity --question --title="Validate/ Reformat XHTML" --text="Should the XHTML file be reformated too?"
case "$?" in
0)
exec tidy -utf8 -i -w 80 -c -q -asxhtml "$GEDIT_CURRENT_DOCUMENT_NAME";;
1)
exec tidy -e -utf8 -q "$GEDIT_CURRENT_DOCUMENT_NAME";;
esac
Input: Current document
Output: Create new document
Applicability: All documents
Validate/ Reformat XML Code
Language: XML, SVG, X3D
Requires: XMLlint, Zenity
Menu Name: Validate/ Reformat XML code
Description: Validate or reformates the current XML document
#!/bin/sh
zenity --question --title="Prüfen auf valides XML" --text="Soll das XML-Dokument auch formatiert werden?"
case "$?" in
0)
xmllint --postvalid --format --dtdattr $GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME;;
1)
xmllint --postvalid --dtdattr --noout $GEDIT_CURRENT_DOCUMENT_DIR/$GEDIT_CURRENT_DOCUMENT_NAME;;
esac
Input: Current document
Output: Create new document
Applicability: All documents
Validate PHP Code
Language: PHP
Requires: PHP
Menu Name: Validate PHP code
Description: Validate the PHP code of the current document
php -l
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Validate Python Code
Language: Python
Requires: Python
Menu Name: Validate Python code
Description: Validate the Python code of the current document
python -d
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Compile and View LilyPond Scores
Language: LilyPond
Requires: GNU LilyPond, Evince
Menu Name: LilyPond Compile and View
Description: Compile and View the current LilyPond document. Must have extension '.ly'.
#!/bin/bash
# Store the file name in a variable
FILE_NAME=$GEDIT_CURRENT_DOCUMENT_NAME
# Check if file extension is .ly
if [ `echo $FILE_NAME | cut -d "." -f 2` = "ly" ]
then
#Make LilyPond file
lilypond $FILE_NAME
DOC_NAME=`echo $FILE_NAME | cut -d "." -f 1`
evince $DOC_NAME'.pdf' &
fi
exit 0
Input: Current document
Output: Display in bottom pane
Applicability: All documents
Grepall
Language: Any
Requires: Grepall
Menu Name: Grepall
Description: Searches for references to the selected text in documents within the current directory with the same extension as the current document. Outputs file name and page number of each reference in the bottom pane.
#!/bin/bash
search=`xargs -0 echo`
$HOME/bin/grepall -e `echo $GEDIT_CURRENT_DOCUMENT_NAME | cut -d. -f2` "$search"
Input: Current selection
Output: Display in bottom pane
Applicability: All documents
