LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   How To: Gedit with the Click of a Button (GNOME) (https://www.linuxquestions.org/questions/linux-desktop-74/how-to-gedit-with-the-click-of-a-button-gnome-729151/)

BslBryan 05-28-2009 02:26 PM

How To: Gedit with the Click of a Button (GNOME)
 
Hello, everyone. I'm visiting over from the Ubuntu forums, and I'd like to share this quick tutorial with all of you. :)

Have you ever found yourself dealing with editing several files, and sighing at having to type out different "gedit" or "vi" commands in the terminal?

If I correctly described an experience that you've had, the following tutorial is a must. My tutorial allows you to add "Open with gedit" to the Right-click menu, making it easy to gedit anything!

First, we need to run this command in the terminal, making the file that will hold our script:

Code:

gedit ~/.gnome2/nautilus-scripts/Open\ with\ gedit
Now, a blank document in the text editor should open. Copy and paste these contents:

Code:

#!/bin/bash
#
# Nautilus script -> open gedit
#
filesall=""
while [ $# -gt 0 ]
do
files=`echo "$1″ | sed 's/ /\?/g'`
filesall="$files $filesall"
shift
done
gedit $filesall&

Now click save, and close the text editor.

Finally, we need to make the previous script executable. So let's run this command:

Code:

chmod u+x ~/.gnome2/nautilus-scripts/Open\ with\ gedit
And that's it! Open up the file browser, and right-click on any file to test it out!

I hope I've helped to make someone's life a lot easier. Enjoy, everyone.

repo 05-29-2009 11:44 PM

On my system, in nautilius text files are associated with gedit by default.


All times are GMT -5. The time now is 12:23 PM.