Last updated by cknoblauch 11 months ago
Customize Gedit for Groovy/GrailsGedit is a highly customizable, lightweight, powerful text editor especially for the Gnome desktop.
BundlesThese are targeted specifically at Ubuntu, but may work for other flavors.
- gedit-grails-bundle - files for syntax highlighting, snippets, bash_completion, color-schemes, essential plugins, and fast tag insertion along with a script to install things.
- gmate - a handful of plugins and other customizations to make gedit more like textmate in general (includes parts of the gedit-grails-bundle)
Syntax HighlightingBasically just some XML files that you need to place in the right locations on your system. Files are available in gedit-grails-bundle on github. These files work reasonably well but could stand to be improved by someone who loves reg-ex :) if you want to give it a shot check out the docs for how to build these filesFor Ubuntu:
.lang files go in /usr/share/gtksourceview-2.0/language-specs/
-mime.xml files go in /usr/share/mime/packages/to get the system to recognize
sudo update-mime-database /usr/share/mime
The syntax highlighting may apply to some other text editors in Linux like Gobby - a nifty collaborative text editor.For Windows
.lang files go in %ProgramFiles%\gedit\share\gtksourceview-2.0\language-specs\
plugins go in %UserProfile%\AppData\Roaming\gedit\plugins\
styles go in %UserProfile%\AppData\Roaming\gedit\styles\
-mime.xml files do not appear to need installation
Bash CompletionThis utilizes the script posted on grails.org. The install script in the gedit=grails-bundle does the work of installing it for you. If you want to do it manually it is pretty easy. Just drop the script into /etc/bash_completion.d/
Command Line Sweetness
Official PluginsGedit comes with a few plugins, but they are not enabled. You can also install popular extra ones easily
sudo apt-get install gedit-plugins
- Session Saver: you can save the status of the tabs/files opened
- Snippets: insert useful pieces of code fast with tab completion(very cool!)
- File Browser Pane: a mini file browser embedded in the editor
- Code comment: a shortcut to comment your code. (ctrl+m)
- Indent Lines: indents or unidents selected lines (ctrl+t/ctrl+shift+t)
- Smart Spaces: makes navigating within documents with keyboard smoother
- Bracket Completion: obvious...
- Quick Open: open files by reg-ex (this plugin stinks in Ubuntu 9.10 i highly recommend installing the Snap-Open plugin instead)
Third Party plugins
- Auto Completion - Display a completion popup, updating as you type, with suggestions from all words in all documents in all windows. suggests word completions based on the text in the active document. It first attempts to suggest compound words for a given word start, and only if such words do not exist it resorts to suggesting simple words. Select completions with arrow keys and complete with the return key.(doesn't interfere with snippets)
- Find in Files - Search within files of your filebrowser root. Useful for refactoring
- Snap Open - This plugin makes it much more convenient to open related source files.
- TODO - find TODO's and such in your code
- ZenCoding - Sort of like snippets on steroids. Meant for writing html and css very fast
CustomizationUnder Edit>Preferences there are numerous other options to customize gedit.
- line numbers
- text wrapping
- current line highlighting
- bracket matching
- tab width
- auto indentation
- color scheme
Color SchemesGood color schemes paired with syntax highlighting make for less eye strain and more productivity. (I think so anyway...) the gedit-bundle includes a few extra dark themes and the gmate-bundle has a plethora to chose from.for some additional color schemes -- gedit-themes
g:tag helpersBased on gedit's Tag List plugin. Easily insert grails tag snippets from the side panel. Gedit comes with a handful of useful code tags for things like HTML, but if you want g:tags you need to include some of your own stuff. Place the tags file from the gedit-grails-bundle into /usr/share/gedit-2/taglist/there is also a bunch of tags for CSS, PHP and HTML in this blog post on using Gedit for web-development
SnippetsEven better than the tag plugin is the snippets plugin. CSS, JS, HTML and JAVA are already supported. A good number of Groovy and Grails snippets are available, and you can easily add your own. Install snippets from the gedit-grails-bundle by putting xml files into ~/.gnome2/gedit/snippets
CreditsThis page compiled by Aaron Eischeid but based on work by others: