Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: HowTo: Setup gedit For C++ Programming

  1. #1
    Join Date
    Sep 2005
    Beans
    72

    HowTo: Setup gedit For C++ Programming

    Here are a few settings that I set to make it easy for me to code in C++ using gedit:

    1. Edit>Preferences>View>Bracket Matching>Highlight Matching Bracket
    2. Edit>Preferences>Editor>Tab Width 4
    3. Edit>Preferences>Editor>Automatic Indentation>Enable Automatic Indentation
    4. Edit>Preferences>Syntax Highlighting>Highlight Mode>C++

    If you have any additional tips please add them below.

  2. #2
    Join Date
    Dec 2005
    Location
    Waukesha, WI
    Beans
    572
    Distro
    Ubuntu

    Re: HowTo: Setup gedit For C++ Programming

    Also, if you're looking for an app with a bit more gusto, check out scite, it's in the repositories.
    The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt.
    Moving /home To a New Partition | Creating Backups | Mounting Windows Shares At Boot
    Linux User #409900 | Ubuntu User #4897

  3. #3
    Join Date
    Oct 2004
    Beans
    80

    Re: HowTo: Setup gedit For C++ Programming

    I show tabs and spaces (draw spaces plugin). You can pick the colour. Mine is very light grey so I can see them but they are not distracting.

    I also have an integrated terminal at the bottom (another plugin). Better for me than having to keep going to a separate terminal to compile and run.

    Word completion. Another plugin which isn't included by default. You can get it (and other experimental plugins) here. It wasn't exactly the way I liked it, but since these plugins are written in Python, they're easy to change.

    For me, these are all really useful regardless of what language I'm using. Would have been really helpful if I had known about them when writing my thesis in LaTex.

  4. #4
    WW is offline Iced Blended Vanilla Crème Ubuntu
    Join Date
    Oct 2004
    Beans
    1,532

    Re: HowTo: Setup gedit For C++ Programming

    Use the "External Tools" plugin. For compiling a single C++ file, you can set up gedit so that a single key will compile the program. For example, you can set up a g++ tool with options set up like this:
    Code:
    Description:   g++
    Accelerator:   F5
    Command(s):    g++ $GEDIT_CURRENT_DOCUMENT_NAME -o ${GEDIT_CURRENT_DOCUMENT_NAME%.*}
    Input:         Nothing
    Output:        Insert in output panel
    Applicability: All documents
    With this tool set up, hitting the F5 function key opens up a console at the bottom of the window and runs g++ there. And with this:
    Code:
    Description:   Run
    Accelerator:   F6
    Command(s):    ./${GEDIT_CURRENT_DOCUMENT_NAME%.*}
    Input:         Nothing
    Output:        Insert in output panel
    Applicability: All documents
    hitting the function key F6 will run the program.

    (This idea was taken from this thread.)

    For a program with multiple source files, create a Makefile, and use the Build tool to run make.
    Last edited by WW; May 24th, 2007 at 11:39 PM. Reason: Changed Description of the F6 example to Run.

  5. #5
    Join Date
    Dec 2005
    Location
    Lund, Skåne
    Beans
    580

    Re: HowTo: Setup gedit For C++ Programming

    There are some plugins that could be useful. Of course the Text Snippets plugin is hugely useful for programming, for example for C++. Also the External Tools plugin is useful to let you run 'make' etc from gedit..

    Third-party plugins are available at the gnome wiki, I haven't tried them but some could be useful (like reindent, project manager, class browser etc..)

    I write Kupfer, a smart, quick launcher.
    Recommended apps and tools: Vim!

  6. #6

    Re: HowTo: Setup gedit For C++ Programming

    I still preffer Vim =)

    Code completion (C/C++) + TextMate like snippets = Good one =)

  7. #7
    Join Date
    Sep 2005
    Beans
    72

    Re: HowTo: Setup gedit For C++ Programming

    Kanem what are the actual names of the plugins that you mention in your comment? I was not able to find an exact match for the terminal and the space showing plugins. Thanks! They both seem very interesting.

  8. #8
    Join Date
    Oct 2004
    Beans
    80

    Re: HowTo: Setup gedit For C++ Programming

    Quote Originally Posted by Sabot View Post
    Kanem what are the actual names of the plugins that you mention in your comment? I was not able to find an exact match for the terminal and the space showing plugins. Thanks! They both seem very interesting.
    Draw Spaces and Integrated Terminal. The terminal is in the gedit-plugins package you can get from Synaptic. I'm not sure where I got the Draw Spaces one. I think it came with gedit.

    Word completion is a third party plugin under development that can be found on the same page I linked to, after the official ones. There are two versions for you to pick from.

  9. #9
    Join Date
    Sep 2005
    Beans
    72

    Re: HowTo: Setup gedit For C++ Programming

    Quote Originally Posted by kanem View Post
    Draw Spaces and Integrated Terminal. The terminal is in the gedit-plugins package you can get from Synaptic. I'm not sure where I got the Draw Spaces one. I think it came with gedit.

    Word completion is a third party plugin under development that can be found on the same page I linked to, after the official ones. There are two versions for you to pick from.
    I was able to find the location of Drawspaces and another one that would be helpful called codecomment (it allows you to quickly comment out code).

    http://www.gnome.org/~pborelli/gedit-plugins/

    To install the files read the readme at this same web location.

  10. #10
    Join Date
    Sep 2005
    Location
    Indiana
    Beans
    130

    Re: HowTo: Setup gedit For C++ Programming

    I don't see the built in terminal being very useful... at least not for me. I prefer to code with a text editor (usually gedit) and then I just keep a terminal handy. I always use another workspace for coding, so I'm no overwhelmed with extra/non-important programs I've got up.

    Ctrl+S
    Alt-Tab
    [up][up][Enter] (Resends compile command)
    [up][up][Enter] (Resends run command)

    Efficient enough for me. Keeps my mouse movement to a minimum too.

    I may look into some other text editors though... see what all the rave is about emacs and vim, but it is hard to switch to something else when gedit 'just works'.

    My $.02 anyways.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •