Another thing I mentioned on G+ lately, and thought I'd throw in here: gedit configuration.

I've been using gedit for years in pretty much its dead stock configuration, which is more or less 'notepad clone mode'. It's very, very basic. You get some highlighting if you open a file it recognizes as some kind of source code or other structured format (RPM spec file, XML, HTML, etc), but that's about it.

I was hitting bugs in gedit in Rawhide and used Geany for a bit, then when I switched back to gedit, started missing some of the more developer-ish features of Geany (since I find myself actually honest-to-god working on source code more and more these days, for my sins...and I've been working on RPM spec files forever, just without much in the way of convenience features).

So I poked around, and found some settings and features for gedit that I now find rather more comfortable.

Some really obvious low-hanging fruit that I'm kicking myself for not doing earlier, from Preferences:

Snippets

Snippets I came across in geany - Christoph Wicket has a great geany configuration in his github space - and had no idea gedit had tucked away until I went looking. Turn that plugin on! You want it!

Snippets are basically just a way of inserting pre-canned text - say you're always typing your name, you can define a snippet that contains your name, and then configure a trigger for inserting it (you can use a shortcut key combo to 'trigger' a snippet, or you can use a form of tab completion - e.g. typing 'name' then hitting tab would insert your name). Just this function is neat enough, but you can get much cleverer, because of course, since we're talking about geeks, you get quite a powerful syntax (that page is pretty crappy, it gives you two lines of introduction then dives into head-spinny mode, but you get the idea) for doing Clever Stuff in snippets.

You can set up snippets by going to Tools / Manage Snippets..., and for a simple one, just go to Global / Add a new snippet..., type some text in the Edit: box, assign a Tab trigger and/or a Shortcut key - the Tab trigger thing is described above - optionally give your snippet a name, and close the dialog. Now use your trigger and your snippet will show up.

Pretty obviously, you can make snippets global (like the one above) or only active for particular types of file (there's an extremely long list of types of structured files gedit distinguishes between on the left, and you can create type-specific snippets for any of them). I recreated a few of the RPM spec snippets from cwickert's geany config that I found most useful. A lot of these are just simple text strings - mainly RPM macros like %{_bindir}, %{_libdir} and the like. I did set up one slightly clever one, though, which serves to illustrate some of the 'clever' features of snippets. It looks like this:

* $(date +"%a %b %d %Y") Adam Williamson <myemail@address.com> - ${1}
- ${2}

...and as you might be able to guess, it's just a snippet for inserting an RPM changelog entry. The gedit doc page I linked to earlier makes the 'placeholder' concept sound crazy complex, but really a simple placeholder is just 'a series of places you might want to manually insert text into the pre-canned snippet', and all the other types of placeholder are different ways of inserting some kind of dynamic content - i.e., something that will be different depending on when or where or in what context you invoke the snippet.

You could try and write something very snazzy to figure out the EVR (Epoch, Version, Release) for the package from the appropriate fields - effectively re-implementing what RPM does - but I just stick a simple placeholder at the appropriate point in the snippet (that's the ${1}) so when I insert the snippet, the next thing I do is type in the correct EVR manually.

Then obviously I can't include the actual changelog entry in the snippet, so I have a second simple placeholder - the ${2} - for typing that. So, when I insert this snippet, the cursor shows up at the end of the first line (with a very faint grey box to indicate that it's at a placeholder location) and I type the EVR, then I hit tab, and the cursor moves to the second line where the changelog entry goes, and I type the changelog entry, and we're all done.

That only leaves the other clever bit: that $(date +"%a %b %d %Y"). That's one of the simplest forms of a 'complex' placeholder. What that does is actually pretty simple: it's just the way you call out to an external command and stick the result into the snippet. It runs the command date +"%a %b %d %Y" when you invoke the snippet, and stuffs the result into the snippet at that location. And what that command does is give you a date string in RPM changelog format - "Tue Jan 21 2014" or whatever.

I gave this snippet the Tab trigger clog, so when I type 'clog' and hit tab, I get a properly-formatted RPM changelog entry into which I just have to type the EVR and the actual changelog entry. Veeeery handy.

And that's some gedit configuration stuff for ya! Hope it was useful. And yes, I'm extremely lame for not being some kind of emacs/vim magician by now, I know.