NOGDUS

Articles, Tutorials, and other things. => General Programming => Topic started by: Richard Marks on October 21, 2008, 08:19:01 AM



Title: gedit is now by far the best code editor!
Post by: Richard Marks on October 21, 2008, 08:19:01 AM
If you know me, you know that I used to use and preach the use of SciTE for writing code.

I have found a plugin that makes gedit MUCH better than SciTE.

Get it here: gedit Symbol Browser Plugin SourceForge project page (http://sourceforge.net/projects/symbol-browser/)

And here is what you need to do to install:

(ignore the first line if you already have ctags installed)

Code:
$ sudo apt-get install ctags
$ cd /path/to/the/downloaded/file/
$ cp downloaded-filename.tar.gz ~/.gnome2/gedit/
$ cd ~/.gnome2/gedit/
$ tar -xvf downloaded-filename.tar.gz

If you don't have a 64-bit Linux OS, then you need to build the plugin from source.
Instructions are found here:

Symbol Browser Homepage (http://www.micahcarrick.com/11-14-2007/gedit-symbol-browser-plugin.html)

Okay, so what did that do?

run gedit, open the Edit->Preferences->Plugins and then place checkmarks in the following plugins:
  • Change Case
  • Devhelp Support
  • Document Statistics
  • External Tools
  • Indent Lines
  • Insert Date/Time
  • Python Console
  • Snippets
  • Sort
  • Spell Checker
  • Symbol Browser
  • Tag List

Here are my preference settings that I use:

Edit->Preferences->View:

Display Line Numbers is checked
Highlight current line is checked
Display Right margin at 80 characters
Bracket matching is enabled

Edit->Preferences->Editor:

Tab width is 4
Enable Automatic Indentation is checked
Create a backup of files before saving is checked

Edit->Preferences->Fonts & Colors:

Use the system font is checked
Oblivion Color scheme is selected

and thats it. 8)

Here is what my gedit looks like (the loaded source is the GTK hello world I wrote in another article)
(http://www.ccpssolutions.com/storage/geditisthabomb.png)

So, now is the time to ditch SciTE, and bring on the wonderful power and ease of gedit!


Title: Re: gedit is now by far the best code editor!
Post by: Richard Marks on October 21, 2008, 08:39:45 AM
You know I use scons instead of autotools/make for building my projects,
so I created a few scripts for gedit's External Tools plugin to make my job easier.

open Tools->External Tools

then click the New button to add a new entry and then fill out the details for the tool like this:

Name: Build with SConS
Description: Builds the project with scons
Shortcut Key: F5
Output: Display in Bottom pane
Applicability: Local Files
Command:
Code:
#!/bin/sh
EHOME=`echo $HOME | sed "s/#/\#/"`
DIR=$GEDIT_CURRENT_DOCUMENT_DIR
while test "$DIR" != "/"; do
    for m in SConstruct; do
        if [ -f "${DIR}/${m}" ]; then
            echo "Using ${m} from ${DIR}" | sed "s#$EHOME#~#" > /dev/stderr
            cd "${DIR}" ; scons -Q
            exit
        fi
    done
    DIR=`dirname "${DIR}"`
done
echo "No SConstruct script found!" > /dev/stderr

add another tool entry with the new button with these details:

Name: ReBuild with SConS
Description: Clears the project with scons and rebuilds with scons
Shortcut Key: F6
Output: Display in Bottom pane
Applicability: Local Files
Command:
Code:
#!/bin/sh
EHOME=`echo $HOME | sed "s/#/\#/"`
DIR=$GEDIT_CURRENT_DOCUMENT_DIR
while test "$DIR" != "/"; do
    for m in SConstruct; do
        if [ -f "${DIR}/${m}" ]; then
            echo "Using ${m} from ${DIR}" | sed "s#$EHOME#~#" > /dev/stderr
            cd "${DIR}" ; scons -c ; scons -Q
            exit
        fi
    done
    DIR=`dirname "${DIR}"`
done
echo "No SConstruct script found!" > /dev/stderr

Now you can build your stuff all from within gedit!