I never liked using gedit for programming because it needed extensive customization before it even came close to becoming a programming editor. However, those that are just starting out with linux will feel most at home in gedit. So here is how to enable "Compile and Run" functionality in gedit.
1. Enable the External Tools plugin by going to Edit -> Preferences -> Plugins as shown in the screenshot below
2. Go to Tools -> Manage External Tools and create a new Tool by clicking on the "new" icon near the Help button.
3. Name the new tool "Compile and Run" and press enter
4. In the coding area, paste the following script:
g++ -Wall -g $GEDIT_CURRENT_DOCUMENT_NAME && xterm -e "sh -c './a.out; echo Press enter to quit... && read KEY'"
5. Put in a shortcut key (eg. Ctrl + F5) in the shortcut key area
6. Set the save setting to Current Document
7. In the applicability setting, select C and C++
That's it. You're done! Press Ctrl + F5 to start off with compile and run. Happy coding!
PS: All the tools to make gedit programming worthy can be found in the blog posts here: