Enter root mode
1 sudo -i
Open gedit
1 gedit
&# 160;
In the preferences, you can choose the color theme, line number, etc. of the text editor
Please complete this operation before proceeding to the next step
dconf-editor
Enter the last item of the terminal in plugins, cancel use-them-colors, if gedit is not installed -plugins
Execute
sudo apt-get install gedit-plugins
Then we proceed to the next step, Write Sell to compile and run the code in gedit
Click on the external management tool
Only this content, let’s click the plus sign in the lower left corner
Create the first tool: Compile #The name can be arbitrary
#!/bin/sh
fullname=$GEDIT_CURRENT_DOCUMENT_NAME
name=`echo $fullname | cut -d. -f1`
suffix=`echo $fullname | cut -d. -f2`
if [ $suffix = “c” ]; then
gcc $fullname -o $name -O2 -Wall -std=gnu99 -static -lm
elif [ $suffix = “cpp” ] || [ $suffix = “c++” ] || [ $suffix = “cc” ] || [ $suffix = “cxx” ] || [ $suffix = “C ” ]; then
g++ $fullname -o $name -O2 -Wall -std=gnu++0x -static -lm
elif [ $suffix = “java” ]; then
javac $fullname – encoding UTF-8 -sourcepath . -d .
fi
View Code
Copy these shell commands into it and set the shortcut key to Ctrl+ F5 #Of course you can also set it yourself, but be careful not to conflict with hotkeys
Now we set up the shell script to run
#!/bin/sh
fullname =$GEDIT_CURRENT_DOCUMENT_NAME
name=`echo $fullname | cut -d. -f1`
suffix=`echo $fullname | cut -d. -f2`
dir=$GEDIT_CURRENT_DOCUMENT_DIR
if [ $ suffix = “c” ]; then
gnome-terminal –hide-menubar –working-directory=$dir -t “Terminal-$name” -x bash -c “$dir/$name; echo;echo 'press ENTER to continue';read”
elif [ $suffix = “cpp” ] || [ $suffix = “c++” ] || [ $suffix = “cc” ] || [ $ suffix = “cxx” ] || [ $suffix = “C” ]; then
gnome-terminal –hide-menubar –working-directory=$dir -t “Terminal-$name” -x bash -c “$dir/$name; echo;echo 'press ENTER to continue';read”
elif [ $suffix = “java” ]; then
gnome-terminal –hide-menubar – -working-directory=$dir -t “Terminal-$name” -x bash -c “java $name echo;echo 'press ENTER to continue';read”
fi
View Code
Copy this Shell and set the shortcut key to F5. #Customizable, be careful not to conflict with hotkeys
Okay
Now let’s try the effect
Write a basic java statement:
Press Ctrl+F5
As you can see, the following tool output shows that it has The newly created compilation tool was called and completed
We continue to press F5 to start running
Program Works perfectly!
The steps are relatively simple, I hope this can help everyone
I hope everyone has a smooth journey on the road to Linux!
Reference article: https://blog.csdn.net/u012965890/article/details/38472149