##// END OF EJS Templates
ipy_sane_defaults
vivainio -
Show More
@@ -0,0 +1,60 b''
1 """ Set default options for "reasonable use"
2
3 Just import this module to get reasonable defaults for everything.
4
5 These configurations used to be performed in ipythonrc (or ipythonrc.ini).
6 Therefore importing this in your config files makes ipython basically
7 ignore your ipythonrc. This is *not* imported by default, you need to import
8 this manually in one of your config files.
9
10 You can further override these defaults in e.g. your ipy_user_config.py,
11 ipy_profile_PROFILENAME etc.
12
13 """
14
15 import IPython.rlineimpl as readline
16 import IPython.ipapi
17 ip = IPython.ipapi.get()
18
19 o = ip.options()
20
21
22 o.colors = "Linux"
23 o.color_info=1
24 o.confirm_exit=1
25 o.pprint=1
26 o.multi_line_specials=1
27 o.xmode="Context"
28
29
30 o.prompt_in1='In [\#]: '
31 o.prompt_in2 =' .\D.: '
32 o.prompt_out = 'Out[\#]: '
33 o.prompts_pad_left=1
34
35 o.readline_remove_delims="-/~"
36 o.readline_merge_completions=1
37
38 o.readline = 1
39
40 rlopts = """\
41 tab: complete
42 "\C-l": possible-completions
43 set show-all-if-ambiguous on
44 "\C-o": tab-insert
45 "\M-i": " "
46 "\M-o": "\d\d\d\d"
47 "\M-I": "\d\d\d\d"
48 "\C-r": reverse-search-history
49 "\C-s": forward-search-history
50 "\C-p": history-search-backward
51 "\C-n": history-search-forward
52 "\e[A": history-search-backward
53 "\e[B": history-search-forward
54 "\C-k": kill-line
55 "\C-u": unix-line-discard"""
56
57 for cmd in rlopts.split('\n'):
58 readline.parse_and_bind(cmd)
59
60 No newline at end of file
@@ -13,6 +13,11 b' compatibility)'
13 13 from IPython import ipapi
14 14 import os,textwrap
15 15
16 # The import below effectively obsoletes your old-style ipythonrc[.ini],
17 # so consider yourself warned!
18
19 import ipy_sane_defaults
20
16 21 def main():
17 22 ip = ipapi.get()
18 23 o = ip.options()
@@ -26,6 +31,9 b' def main():'
26 31 ip.ex("from path import path" )
27 32 except ImportError:
28 33 pass
34
35 ip.ex('import os')
36 ip.ex("def up(): os.chdir('..')")
29 37
30 38 # Get pysh-like prompt for all profiles.
31 39
@@ -9,57 +9,20 b' ipython extensions you need here (see IPython/Extensions directory).'
9 9 Feel free to edit this file to customize your ipython experience.
10 10
11 11 Note that as such this file does nothing, for backwards compatibility.
12 To enable this config file, uncomment the call to main() at the end.
13
14 Try it out!
12 Consult e.g. file 'ipy_profile_sh.py' for an example of the things
13 you can do here.
15 14
16 15 """
17 16
18 17 # Most of your config files and extensions will probably start with this import
19 18
20 from IPython import ipapi
21 import os
22 from IPython import Release
23
24 import sys
25
19 import IPython.ipapi
20 ip = IPython.ipapi.get()
26 21
27 22 def main():
28 ip = ipapi.get()
29 23 o = ip.options()
30 # autocall to "full" mode (smart mode is default, I like full mode)
31
32 o.autocall = 1
33
34 # Jason Orendorff's path class is handy to have in user namespace
35 # if you are doing shell-like stuff
36 try:
37 ip.ex("from path import path" )
38 except ImportError:
39 pass
40
41 # Get prompt with working dir
42
43 o.prompt_in1= '\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> '
44 o.prompt_in2= '\C_Green|\C_LightGreen\D\C_Green> '
45 o.prompt_out= '<\#> '
46
47 # I like my banner minimal.
48 o.banner = "Py %s IPy %s\n" % (sys.version.split('\n')[0],Release.version)
49
50 # make 'd' an alias for ls -F
51
52 ip.magic('alias d ls -F --color=auto')
53
54 # Make available all system commands through "rehashing" immediately.
55 # You can comment these lines out to speed up startup on very slow
56 # machines, and to conserve a bit of memory. Note that pysh profile does this
57 # automatically
58
59 #if os.name=='posix':
60 # ip.magic('rehash')
61 #else:
62 # #slightly slower, but better results esp. with Windows
63 # ip.magic('rehashx')
24 # An example on how to set options
25 #o.autocall = 1
64 26
65 #main() No newline at end of file
27 main()
28 No newline at end of file
@@ -1,6 +1,11 b''
1 1 2006-02-15 Ville Vainio <vivainio@gmail.com>
2 2
3 3 * Magic.py: %Pprint works again
4
5 * Extensions/ipy_sane_defaults.py: Provide everything provided
6 in default ipythonrc, to make it possible to have a completely empty
7 ipythonrc (and thus completely rc-file free configuration)
8
4 9
5 10 2006-02-11 Fernando Perez <Fernando.Perez@colorado.edu>
6 11
General Comments 0
You need to be logged in to leave comments. Login now