5
Add %global magic for GNU Global usage.
7
http://www.gnu.org/software/global/
11
from IPython.core import ipapi
15
# alter to your liking
16
global_bin = 'd:/opt/global/bin/global'
18
def global_f(self,cmdline):
20
if '-' not in cmdline:
21
cmdline = '-rx ' + cmdline
24
lines = [l.rstrip() for l in os.popen( global_bin + ' ' + cmdline ).readlines()]
27
parts = [l.split(None,3) for l in lines]
28
lines = ['%s [%s]\n%s' % (p[2].rjust(70),p[1],p[3].rstrip()) for p in parts]
29
print "\n".join(lines)
31
ip.define_magic('global', global_f)
33
def global_completer(self,event):
34
compl = [l.rstrip() for l in os.popen(global_bin + ' -c ' + event.symbol).readlines()]
37
ip.set_hook('complete_command', global_completer, str_key = '%global')