Tuesday, November 4, 2008

gedit as a powerful web development tool

All I have to say is WOW. I wish I knew this earlier. I was messing around with gedit's external tools and came to a stump when trying to configure external tools to do svn commit for me. What did I do? I googled about it and found this great article on configuring gedit for development. Now I can use this tool more effectively than what I have been using(kwrite,kate,stock gedit configuration and screem). I have to say that gedit is by far the best one. Plus you can create python plugins to run inside of it. I think my dreams have just come true. :) Now that I think about it. About the only thing gedit can't do is cook, clean and drive my car. Who knows maybe one day it will. Ah, whatever. You should read this great article though. It can make development on linux with less headaches. Dreamweaver? whats that?

You can find the article here:
micahcarrick.com/09-29-2007/gedit-html-editor.html


This is my external tool I came up with to do svn commit from gedit. Currently you need to type the file to commit or a . (dot) to commit whole directory. Maybe someone knows how to fix this mistake. But it works for now so I have to stick with it until I fix it. Yay, now I can commit from gedit. :) The file is below. You can place this file in ~.gnome2/gedit/tools/ and use it as an extenal tool or in gedit goto tools->external tools and type it in manually, minus comments after shebang.

file: svn-commit

#!/bin/sh
# [Gedit Tool]
# Comment=svn commit
# Name=svn commit
# Shortcut=F11
# Applicability=all
# Output=output-panel
# Input=document

svn ci -m exec `zenity --entry --title="Commit" --text="Enter Commit Message"`


EDIT:
Okay, I fixed it after looking at the commit log. Use this one below and not the one above since it's the new updated version that allows you to commit changes to svn repository from gedit. I don't know why I had to say that. But there you go. Notice the dot on the end. Although, you may want to change it to commit a single file instead of the cwd. If so then you can use $GEDIT_CURRENT_DOCUMENT_PATH instead. Just as a note for all my readers. I use my blog posts as a reminder for me for how I did certain things so that I don't have to re-google and re-research my finding again.



#!/bin/sh

svn ci -m "`zenity --entry --title="Commit" --text="Enter Commit Message"`" .



you might also want this as well:



#!/bin/sh

svn add $GEDIT_CURRENT_DOCUMENT_PATH



It's also not very hard to run python from external tools as well. See example below:



#!/bin/sh

python -c "
import os
os.system('ifconfig')
"


After having learned this about gedit. I have a feeling that I'm going to dwell on it alot more and come up with some plugins hopefully. That depends on how swamped I am with everything else though. Look for plugins in the near future. Hopefully one that can cook and clean. hehehe, jk. :)

No comments: