示例#1
0
def main():

    # uncomment if you want to get ipython -p sh behaviour
    # without having to use command line switches
    # import ipy_profile_sh

    import ipy_editors

    # emacsclient
    ipy_editors.install_editor("emacsclient -nw +$line $file")
    # or at least vim
    ipy_editors.install_editor("vim +$line $file")

    o = ip.options

    # automatically call callables without parens
    o.autocall = True
    # don't be verbose on system calls
    o.system_verbose = False
    # don't ask if you should quit
    o.confirm_exit = False
    # start editing on syntax errors
    o.autoedit_syntax = True

    ip.ex("import os, sys")
    ip.ex("import itertools as it")

    # future has landed
    o.autoexec.append("from __future__ import division, print_function, " "unicode_literals, absolute_import")

    # For autoreloading of modules (%autoreload, %aimport)
    import ipy_autoreload

    # Tab completer that is not quite so picky (i.e.
    # "foo".<TAB> and str(2).<TAB> will work). Complete
    # at your own risk!
    import ipy_greedycompleter

    import readline

    # set treshold for `n possibility' query higher
    readline.parse_and_bind("set completion-query-items 1000")
    # don't ask me if you should display more
    readline.parse_and_bind("set page-completions no")
示例#2
0
def main():

    # uncomment if you want to get ipython -p sh behaviour
    # without having to use command line switches
    # import ipy_profile_sh

    import ipy_editors
    # emacsclient
    ipy_editors.install_editor("emacsclient -nw +$line $file")
    # or at least vim
    ipy_editors.install_editor("vim +$line $file")


    o = ip.options

    # automatically call callables without parens
    o.autocall = True
    # don't be verbose on system calls
    o.system_verbose = False
    # don't ask if you should quit
    o.confirm_exit = False
    # start editing on syntax errors
    o.autoedit_syntax = True

    ip.ex('import os, sys')
    ip.ex('import itertools as it')

    # future has landed
    o.autoexec.append('from __future__ import division, print_function, '
                      'unicode_literals, absolute_import')

    # For autoreloading of modules (%autoreload, %aimport)
    import ipy_autoreload

    # Tab completer that is not quite so picky (i.e.
    # "foo".<TAB> and str(2).<TAB> will work). Complete
    # at your own risk!
    import ipy_greedycompleter

    import readline
    # set treshold for `n possibility' query higher
    readline.parse_and_bind('set completion-query-items 1000')
    # don't ask me if you should display more
    readline.parse_and_bind('set page-completions no')
def main():   

    # uncomment if you want to get ipython -p sh behaviour
    # without having to use command line switches  
    # import ipy_profile_sh

    # Configure your favourite editor?
    # Good idea e.g. for %edit os.path.isfile

    import ipy_editors
    
    # Choose one of these:
    
    #ipy_editors.scite()
    #ipy_editors.scite('c:/opt/scite/scite.exe')
    #ipy_editors.komodo()
    #ipy_editors.idle()
    ipy_editors.install_editor("vim +$line $file")
    # ... or many others, try 'ipy_editors??' after import to see them
    
    # Or roll your own:
    #ipy_editors.install_editor("c:/opt/jed +$line $file")
    
    
    o = ip.options
    # An example on how to set options
    #o.autocall = 1
    o.system_verbose = 0
    
    #import_all("os sys")
    #execf('~/_ipython/ns.py')


    # -- prompt
    # A different, more compact set of prompts from the default ones, that
    # always show your current location in the filesystem:

    #o.prompt_in1 = r'\C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Normal\n\C_Green|\#>'
    #o.prompt_in2 = r'.\D: '
    #o.prompt_out = r'[\#] '

    # Make the prompt a bit more like the standard shell.
    o.prompt_in1 = '[\#] >>> '
    o.prompt_in2 = ' .\D.: '
    o.prompt_out = '[\#] : '
    o.separate_out = ''
    o.separate_out2 = ''
     
    # Set up logging by Y/M/D directories
    logdir = os.path.expanduser(time.strftime("~/.ipython/logs/%Y/%m/"))
    logfile = os.path.join(logdir, time.strftime("%d.log"))
    if not os.path.exists(logdir):
        os.makedirs(logdir)
        ip.magic("logstart %s append" % logfile)


    
    # Try one of these color settings if you can't read the text easily
    # autoexec is a list of IPython commands to execute on startup
    #o.autoexec.append('%colors LightBG')
    #o.autoexec.append('%colors NoColor')
    o.autoexec.append('%colors Linux')
    
    # for sane integer division that converts to float (1/2 == 0.5)
    o.autoexec.append('from __future__ import division')
    
    # For %tasks and %kill
    #import jobctrl 
    
    # For autoreloading of modules (%autoreload, %aimport)    
    import ipy_autoreload
    
    # For winpdb support (%wdb)
    #import ipy_winpdb
    
    # For bzr completer, requires bzrlib (the python installation of bzr)
    #ip.load('ipy_bzr')
    
    # Tab completer that is not quite so picky (i.e. 
    # "foo".<TAB> and str(2).<TAB> will work). Complete 
    # at your own risk!
    #import ipy_greedycompleter
    
    # If you are on Linux, you may be annoyed by
    # "Display all N possibilities? (y or n)" on tab completion,
    # as well as the paging through "more". Uncomment the following
    # lines to disable that behaviour
    import readline
    readline.parse_and_bind('set completion-query-items 1000')
    readline.parse_and_bind('set page-completions no')