update prezto
This commit is contained in:
@@ -29,6 +29,53 @@ To test if your terminal and font support it, check that all the necessary chara
|
||||
|
||||

|
||||
|
||||
## Customize your prompt view
|
||||
|
||||
By default prompt has these segments: `prompt_status`, `prompt_context`, `prompt_virtualenv`, `prompt_dir`, `prompt_git`, `prompt_end` in that particular order.
|
||||
|
||||
If you want to add, change the order or remove some segments of the prompt, you can use array environment variable named `AGNOSTER_PROMPT_SEGMENTS`.
|
||||
|
||||
Examples:
|
||||
- Show all segments of the prompt with indices:
|
||||
```
|
||||
echo "${(F)AGNOSTER_PROMPT_SEGMENTS[@]}" | cat -n
|
||||
```
|
||||
- Add the new segment of the prompt to the beginning:
|
||||
```
|
||||
AGNOSTER_PROMPT_SEGMENTS=("prompt_git" "${AGNOSTER_PROMPT_SEGMENTS[@]}")
|
||||
```
|
||||
- Add the new segment of the prompt to the end:
|
||||
```
|
||||
AGNOSTER_PROMPT_SEGMENTS+="prompt_end"
|
||||
```
|
||||
- Insert the new segment of the prompt = `PROMPT_SEGMENT_NAME` on the particular position = `PROMPT_SEGMENT_POSITION`:
|
||||
```
|
||||
PROMPT_SEGMENT_POSITION=5 PROMPT_SEGMENT_NAME="prompt_end";\
|
||||
AGNOSTER_PROMPT_SEGMENTS=("${AGNOSTER_PROMPT_SEGMENTS[@]:0:$PROMPT_SEGMENT_POSITION-1}" "$PROMPT_SEGMENT_NAME" "${AGNOSTER_PROMPT_SEGMENTS[@]:$PROMPT_SEGMENT_POSITION-1}");\
|
||||
unset PROMPT_SEGMENT_POSITION PROMPT_SEGMENT_NAME
|
||||
```
|
||||
- Swap segments 4th and 5th:
|
||||
```
|
||||
SWAP_SEGMENTS=(4 5);\
|
||||
TMP_VAR="$AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[1]]"; AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[1]]="$AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[2]]"; AGNOSTER_PROMPT_SEGMENTS[$SWAP_SEGMENTS[2]]="$TMP_VAR"
|
||||
unset SWAP_SEGMENTS TMP_VAR
|
||||
```
|
||||
- Remove the 5th segment:
|
||||
```
|
||||
AGNOSTER_PROMPT_SEGMENTS[5]=
|
||||
```
|
||||
|
||||
A small demo of the dummy custom prompt segment, which has been created with help of the built-in `prompt_segment()` function from Agnoster theme:
|
||||
```
|
||||
# prompt_segment() - Takes two arguments, background and foreground.
|
||||
# Both can be omitted, rendering default background/foreground.
|
||||
|
||||
customize_agnoster() {
|
||||
prompt_segment 'red' '' ' ⚙ ⚡⚡⚡ ⚙ '
|
||||
}
|
||||
```
|
||||

|
||||
|
||||
## Future Work
|
||||
|
||||
I don't want to clutter it up too much, but I am toying with the idea of adding RVM (ruby version) and n (node.js version) display.
|
||||
|
@@ -22,6 +22,17 @@
|
||||
# jobs are running in this shell will all be displayed automatically when
|
||||
# appropriate.
|
||||
|
||||
### Segments of the prompt, default order declaration
|
||||
|
||||
typeset -aHg AGNOSTER_PROMPT_SEGMENTS=(
|
||||
prompt_status
|
||||
prompt_context
|
||||
prompt_virtualenv
|
||||
prompt_dir
|
||||
prompt_git
|
||||
prompt_end
|
||||
)
|
||||
|
||||
### Segment drawing
|
||||
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||
|
||||
@@ -135,12 +146,9 @@ prompt_virtualenv() {
|
||||
prompt_agnoster_main() {
|
||||
RETVAL=$?
|
||||
CURRENT_BG='NONE'
|
||||
prompt_status
|
||||
prompt_context
|
||||
prompt_virtualenv
|
||||
prompt_dir
|
||||
prompt_git
|
||||
prompt_end
|
||||
for prompt_segment in "${AGNOSTER_PROMPT_SEGMENTS[@]}"; do
|
||||
[[ -n $prompt_segment ]] && $prompt_segment
|
||||
done
|
||||
}
|
||||
|
||||
prompt_agnoster_precmd() {
|
||||
|
BIN
.zprezto/modules/prompt/external/agnoster/agnoster_customization.gif
vendored
Normal file
BIN
.zprezto/modules/prompt/external/agnoster/agnoster_customization.gif
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 MiB |
Reference in New Issue
Block a user