##// END OF EJS Templates
check if readline is available before calling readline functions in ipy_defaults.py
jstenar -
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,59 +1,60 b''
1 """ Set default options for IPython.
1 """ Set default options for IPython.
2
2
3 Just import this module to get reasonable defaults for everything.
3 Just import this module to get reasonable defaults for everything.
4
4
5 These configurations used to be performed in ipythonrc (or ipythonrc.ini).
5 These configurations used to be performed in ipythonrc (or ipythonrc.ini).
6 Therefore importing this in your config files makes ipython basically
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
7 ignore your ipythonrc. This is *not* imported by default, you need to import
8 this manually in one of your config files.
8 this manually in one of your config files.
9
9
10 You can further override these defaults in e.g. your ipy_user_config.py,
10 You can further override these defaults in e.g. your ipy_user_config.py,
11 ipy_profile_PROFILENAME etc.
11 ipy_profile_PROFILENAME etc.
12
12
13 """
13 """
14
14
15 import IPython.rlineimpl as readline
15 import IPython.rlineimpl as readline
16 import IPython.ipapi
16 import IPython.ipapi
17 ip = IPython.ipapi.get()
17 ip = IPython.ipapi.get()
18
18
19 o = ip.options
19 o = ip.options
20
20
21 o.colors = "Linux"
21 o.colors = "Linux"
22 o.color_info=1
22 o.color_info=1
23 o.confirm_exit=1
23 o.confirm_exit=1
24 o.pprint=1
24 o.pprint=1
25 o.multi_line_specials=1
25 o.multi_line_specials=1
26 o.xmode="Context"
26 o.xmode="Context"
27
27
28
28
29 o.prompt_in1='In [\#]: '
29 o.prompt_in1='In [\#]: '
30 o.prompt_in2 =' .\D.: '
30 o.prompt_in2 =' .\D.: '
31 o.prompt_out = 'Out[\#]: '
31 o.prompt_out = 'Out[\#]: '
32 o.prompts_pad_left=1
32 o.prompts_pad_left=1
33
33
34 o.readline_remove_delims="-/~"
34 o.readline_remove_delims="-/~"
35 o.readline_merge_completions=1
35 o.readline_merge_completions=1
36
36
37 o.readline = 1
37 o.readline = 1
38
38
39 rlopts = """\
39 rlopts = """\
40 tab: complete
40 tab: complete
41 "\C-l": possible-completions
41 "\C-l": possible-completions
42 set show-all-if-ambiguous on
42 set show-all-if-ambiguous on
43 "\C-o": tab-insert
43 "\C-o": tab-insert
44 "\M-i": " "
44 "\M-i": " "
45 "\M-o": "\d\d\d\d"
45 "\M-o": "\d\d\d\d"
46 "\M-I": "\d\d\d\d"
46 "\M-I": "\d\d\d\d"
47 "\C-r": reverse-search-history
47 "\C-r": reverse-search-history
48 "\C-s": forward-search-history
48 "\C-s": forward-search-history
49 "\C-p": history-search-backward
49 "\C-p": history-search-backward
50 "\C-n": history-search-forward
50 "\C-n": history-search-forward
51 "\e[A": history-search-backward
51 "\e[A": history-search-backward
52 "\e[B": history-search-forward
52 "\e[B": history-search-forward
53 "\C-k": kill-line
53 "\C-k": kill-line
54 "\C-u": unix-line-discard"""
54 "\C-u": unix-line-discard"""
55
55
56 for cmd in rlopts.split('\n'):
56 if readline.have_readline:
57 readline.parse_and_bind(cmd)
57 for cmd in rlopts.split('\n'):
58 readline.parse_and_bind(cmd)
58
59
59
60
1 NO CONTENT: modified file
NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now