Skip to content

Commit 7935d7a

Browse files
author
Buck Ryan
committed
readme updates for custom segments
1 parent 3cf55e7 commit 7935d7a

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

README.md

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -172,40 +172,33 @@ powerline-shell --generate-config > ~/.powerline-shell.json
172172

173173
Once you have generated your config file, you can now start adding or removing
174174
"segments" - the building blocks of your shell. The list of segments available
175-
are:
176-
177-
- `aws_profile` - Show which AWS profile is in use. See the
178-
[AWS](http://docs.aws.amazon.com/cli/latest/userguide/cli-multiple-profiles.html)
179-
documentation.
180-
- `battery` - See percentage of battery charged and an icon when the battery is
181-
charging.
182-
- `bzr` - Details about the current Bazaar repo.
183-
- `cwd` - Shows your current working directory. See [Segment
184-
Configuration](#segment-configuration) for some options.
185-
- `exit_code` - When the previous command ends in a non-zero status, shows the
186-
value of the exit status in red.
187-
- `fossil` - Details about the current Fossil repo.
188-
- `git` - Details about the current Git repo.
189-
- `git_stash` - Number of stashes in the current Git repo.
190-
- `hg` - Details about the current Mercurial repo.
191-
- `hostname` - Current machine's hostname.
192-
- `jobs` - Number of background jobs currently running.
193-
- `newline` - Inserts a newline into the prompt.
194-
- `node_version` - `node --version`
195-
- `npm_version` - `npm --version`
196-
- `php_version` - Version of php on the machine.
197-
- `rbenv` - `rbenv local`
198-
- `read_only` - Shows a lock icon if the current directory is read-only.
199-
- `root` - Shows a `#` if logged in as root, `$` otherwise.
200-
- `ruby_version` - `ruby --version`
201-
- `set_term_title` - If able, sets the title of your terminal to include some
202-
useful info.
203-
- `ssh` - If logged into over SSH, shows a network icon.
204-
- `svn` - Details about the current SVN repo.
205-
- `time` - Shows the current time.
206-
- `uptime` - Uptime of the current machine.
207-
- `username` - Name of the logged-in user.
208-
- `virtual_env` - Shows the name of the current virtual env or conda env.
175+
can be seen
176+
[here](https://github.com/b-ryan/powerline-shell/tree/master/powerline_shell/segments).
177+
178+
You can also create custom segments. Start by copying an existing segment like
179+
[this](https://github.com/b-ryan/powerline-shell/blob/master/powerline_shell/segments/aws_profile.py).
180+
Make sure to change any relative imports to absolute imports. Ie. change things
181+
like:
182+
183+
```python
184+
from ..utils import BasicSegment
185+
```
186+
187+
to
188+
189+
```python
190+
from powerline_shell.utils import BasicSegment
191+
```
192+
193+
Then change the `add_to_powerline` function to do what you want. You can then
194+
use this segment in your configuration by putting the path to your segment in
195+
the segments section, like:
196+
197+
```json
198+
"segments": [
199+
"~/path/to/segment.py"
200+
]
201+
```
209202

210203
### Segment Separator
211204

0 commit comments

Comments
 (0)