-
Notifications
You must be signed in to change notification settings - Fork 5
/
ipythonrc-pysh
94 lines (71 loc) · 3.52 KB
/
ipythonrc-pysh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# -*- Mode: Shell-Script -*- Not really, but shows comments correctly
#***************************************************************************
# Configuration file for ipython -- ipythonrc format
#
# The format of this file is one of 'key value' lines.
# Lines containing only whitespace at the beginning and then a # are ignored
# as comments. But comments can NOT be put on lines with data.
#***************************************************************************
# If this file is found in the user's ~/.ipython directory as ipythonrc-pysh,
# it can be loaded by calling passing the '-profile pysh' (or '-p pysh')
# option to IPython.
# This profile turns IPython into a lightweight system shell with python
# syntax.
# We only set a few options here, the rest is done in the companion pysh.py
# file. In the future _all_ of IPython's configuration will be done via
# proper python code.
############################################################################
# First load common user configuration
include ipythonrc
############################################################################
# Load all the actual syntax extensions for shell-like operation, which live
# in the InterpreterExec standard extension.
import_all IPython.Extensions.InterpreterExec
############################################################################
# PROMPTS
#
# Configure prompt for more shell-like usage.
# Most bash-like escapes can be used to customize IPython's prompts, as well as
# a few additional ones which are IPython-specific. All valid prompt escapes
# are described in detail in the Customization section of the IPython HTML/PDF
# manual.
prompt_in1 '\C_LightGreen\u@\h\C_LightBlue[\C_LightCyan\Y1\C_LightBlue]\C_Green|\#> '
prompt_in2 '\C_Green|\C_LightGreen\D\C_Green> '
prompt_out '<\#> '
# Here's a more complex prompt, showing the hostname and more path depth (\Y3)
#prompt_in1 '\C_LightRed\u\C_Blue@\C_Red\h\C_LightBlue[\C_LightCyan\Y3\C_LightBlue]\C_LightGreen\#> '
# Select whether to left-pad the output prompts to match the length of the
# input ones. This allows you for example to use a simple '>' as an output
# prompt, and yet have the output line up with the input. If set to false,
# the output prompts will be unpadded (flush left).
prompts_pad_left 1
# Remove all blank lines in between prompts, like a normal shell.
separate_in 0
separate_out 0
separate_out2 0
# Allow special syntax (!, magics and aliases) in multiline input
multi_line_specials 1
############################################################################
# ALIASES
# Declare some common aliases. Type alias? at an ipython prompt for details on
# the syntax, use @unalias to delete existing aliases.
# Don't go too crazy here, the file pysh.py called below runs @rehash, which
# loads ALL of your $PATH as aliases (except for Python keywords and
# builtins).
# Some examples:
# A simple alias without arguments
#alias cl clear
# An alias which expands the full line before the end of the alias. This
# lists only directories:
#alias ldir pwd;ls -oF --color %l | grep /$
# An alias with two positional arguments:
#alias parts echo 'First <%s> Second <%s>'
# In use these two aliases give (note that ldir is already built into IPython
# for Unix):
#fperez[IPython]16> ldir
#/usr/local/home/fperez/ipython/ipython/IPython
#drwxr-xr-x 2 fperez 4096 Jun 21 01:01 CVS/
#drwxr-xr-x 3 fperez 4096 Jun 21 01:10 Extensions/
#drwxr-xr-x 3 fperez 4096 Jun 21 01:27 UserConfig/
#fperez[IPython]17> parts Hello world and goodbye
#First <Hello> Second <world> and goodbye