Configuration for Sublime Text 2


1. Install Subime Text 2
2. Ctrl+~: show the command console, run the code and restart sublime.
import urllib2,os;pf='Package Control.sublime-package';ipp=sublime.installed_packages_path();os.makedirs(ipp) if not os.path.exists(ipp) else None;open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read())

3. Ctrl + Alt + P, open the command palette, input "install"to install packages:
SublimeGDB, Open-Include, SVN, jQuery.
4. Replace the 1287 line in sublimegdb.py with the following code:
                # Jan-28 1024
                # igame used a error dialog to show this message, and show some advice.
                # print("I'm confused... I think status is %s, but it seems it wasn't..." % gdb_run_status)
                sublime.error_message("I'm confused... I think status is %s, but it seems it wasn't...
Please try to close gdb process attached to target file." % gdb_run_status)

5. Open github, get igame branch of Open-Include, replace the responding open-include.py.
here is the link of  https://github.com/igame2000/Open-Include/tree/igame.
6. Open Preference->Settings-User, replace it's content with the following code:
{
	"file_exclude_patterns":
	[
		"*.o",
		"*.a",
		"*.so",
		"*.dylib"
	],
	"folder_exclude_patterns":
	[
		".svn",
		".git",
		"Debug",
		"Release"
	],
	"settings":
	{
		"sublimegdb_workingdir": "${folder:${project_path:Debug}}",
		"sublimegdb_commandline": "gdb --interpreter=mi ./${file_base_name}"
	},
	"ignored_packages":
	[
		"Vintage"
	]
}

7. Create new "Build System"with name "G++.Debug", fill with code like this:
{
	"cmd": ["g++", "${file}", "-o", "${file_path}/Debug/${file_base_name}", "-O0", "-g", "-std=c++0x", "-v"],
	"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
	"working_dir": "${file_path}",
	"selector": "source.c, source.c++",
	
	"variants":
	[
		{
			"name": "Run",
			"cmd": ["g++ -O0 -g -std=c++0x ${file} -o ${file_path}/Debug/${file_base_name}"],
			"shell":true
		}
	]
}

8. Create new "Build System"with name "G++.Release", fill with code like this:
{
	"cmd": ["g++", "${file}", "-o", "${file_path}/Release/${file_base_name}", "-O3", "-g", "-v","-std=c++0x"],
	"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
	"working_dir": "${file_path}",
	"selector": "source.c, source.c++",
	
	"variants":
	[
		{
			"name": "Run",
			"cmd": ["g++ -v -g -std=c++0x -O3 ${file} -o ${file_path}/Release/${file_base_name}"],
			"shell":true
		}
	]
}