ipy_user_conf.py
64 lines
| 1.8 KiB
| text/x-python
|
PythonLexer
vivainio
|
r130 | """ User configuration file for IPython | |
This is a more flexible and safe way to configure ipython than *rc files | |||
(ipythonrc, ipythonrc-pysh etc.) | |||
vivainio
|
r176 | This file is always imported on ipython startup. You can import the | |
vivainio
|
r130 | ipython extensions you need here (see IPython/Extensions directory). | |
vivainio
|
r176 | Feel free to edit this file to customize your ipython experience. | |
Note that as such this file does nothing, for backwards compatibility. | |||
To enable this config file, uncomment the call to main() at the end. | |||
Try it out! | |||
vivainio
|
r131 | ||
vivainio
|
r130 | """ | |
vivainio
|
r131 | # Most of your config files and extensions will probably start with this import | |
vivainio
|
r130 | ||
vivainio
|
r146 | from IPython import ipapi | |
vivainio
|
r132 | import os | |
vivainio
|
r176 | from IPython import Release | |
vivainio
|
r130 | ||
vivainio
|
r176 | import sys | |
vivainio
|
r130 | ||
vivainio
|
r176 | ||
def main(): | |||
ip = ipapi.get() | |||
o = ip.options() | |||
# autocall to "full" mode (smart mode is default, I like full mode) | |||
o.autocall = 1 | |||
vivainio
|
r130 | # Jason Orendorff's path class is handy to have in user namespace | |
# if you are doing shell-like stuff | |||
vivainio
|
r175 | try: | |
ip.ex("from path import path" ) | |||
except ImportError: | |||
pass | |||
vivainio
|
r176 | ||
# Get prompt with working dir | |||
vivainio
|
r130 | ||
vivainio
|
r176 | o.prompt_in1= '\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> ' | |
o.prompt_in2= '\C_Green|\C_LightGreen\D\C_Green> ' | |||
o.prompt_out= '<\#> ' | |||
# I like my banner minimal. | |||
o.banner = "Py %s IPy %s\n" % (sys.version.split('\n')[0],Release.version) | |||
# make 'd' an alias for ls -F | |||
ip.magic('alias d ls -F --color=auto') | |||
# Make available all system commands through "rehashing" immediately. | |||
# You can comment these lines out to speed up startup on very slow | |||
# machines, and to conserve a bit of memory. Note that pysh profile does this | |||
# automatically | |||
#if os.name=='posix': | |||
# ip.magic('rehash') | |||
#else: | |||
# #slightly slower, but better results esp. with Windows | |||
# ip.magic('rehashx') | |||
vivainio
|
r134 | ||
vivainio
|
r176 | #main() |