mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-11 00:00:06 +00:00
commit
f18c92d766
2 changed files with 46 additions and 11 deletions
22
README.md
22
README.md
|
@ -233,7 +233,6 @@ currently available are:
|
|||
|
||||
* **aws** - The current AWS profile, if active (more info below)
|
||||
* **context** - Your username and host (more info below)
|
||||
* **vi_mode** - Vi editing mode (NORMAL|INSERT).
|
||||
* **dir** - Your current working directory.
|
||||
* **history** - The command number for the current line.
|
||||
* **ip** - Shows the current IP address.
|
||||
|
@ -247,6 +246,7 @@ currently available are:
|
|||
* **symfony2_tests** - Show a ratio of test classes vs code classes for Symfony2.
|
||||
* **symfony2_version** - Show the current Symfony2 version, if you are in a Symfony2-Project dir.
|
||||
* **time** - System time.
|
||||
* **vi_mode** - Vi editing mode (NORMAL|INSERT).
|
||||
* **virtualenv** - Your Python [VirtualEnv](https://virtualenv.pypa.io/en/latest/).
|
||||
* **vcs** - Information about this `git` or `hg` repository (if you are in one).
|
||||
|
||||
|
@ -336,6 +336,26 @@ is count your source files and test files, and calculate the ratio between them.
|
|||
Just enough to give you a quick overview about the test situation of the project
|
||||
you are dealing with.
|
||||
|
||||
#### VI-Mode Indicator
|
||||
|
||||
This Segment shows the current mode of your ZSH. If you want to use your ZSH in
|
||||
VI-Mode, you need to configure it separatly in your `~/.zshrc`:
|
||||
|
||||
# VI-Mode
|
||||
# general activation
|
||||
bindkey -v
|
||||
|
||||
# set some nice hotkeys
|
||||
bindkey '^P' up-history
|
||||
bindkey '^N' down-history
|
||||
bindkey '^?' backward-delete-char
|
||||
bindkey '^h' backward-delete-char
|
||||
bindkey '^w' backward-kill-word
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
|
||||
# make it more responsive
|
||||
export KEYTIMEOUT=1
|
||||
|
||||
#### The 'vcs' Segment
|
||||
|
||||
By default, the `vcs` segment will provide quite a bit of information. If you
|
||||
|
|
|
@ -580,16 +580,6 @@ prompt_context() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Vi Mode: show editing mode (NORMAL|INSERT)
|
||||
prompt_vi_mode() {
|
||||
local mode="${${KEYMAP/vicmd/NORMAL}/(main|viins)/INSERT}"
|
||||
if [[ "$mode" == "NORMAL" ]]; then
|
||||
$1_prompt_segment "$0_NORMAL" "$DEFAULT_COLOR" "default" "$mode"
|
||||
else
|
||||
$1_prompt_segment "$0_INSERT" "$DEFAULT_COLOR" "blue" "$mode"
|
||||
fi
|
||||
}
|
||||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
local current_path='%~'
|
||||
|
@ -817,6 +807,18 @@ prompt_time() {
|
|||
"$1_prompt_segment" "$0" "$DEFAULT_COLOR_INVERTED" "$DEFAULT_COLOR" "$time_format"
|
||||
}
|
||||
|
||||
# Vi Mode: show editing mode (NORMAL|INSERT)
|
||||
prompt_vi_mode() {
|
||||
case ${KEYMAP} in
|
||||
main|viins)
|
||||
"$1_prompt_segment" "$0_INSERT" "$DEFAULT_COLOR" "blue" "INSERT"
|
||||
;;
|
||||
vicmd)
|
||||
"$1_prompt_segment" "$0_NORMAL" "$DEFAULT_COLOR" "default" "NORMAL"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Virtualenv: current working virtualenv
|
||||
# More information on virtualenv (Python):
|
||||
# https://virtualenv.pypa.io/en/latest/
|
||||
|
@ -876,6 +878,16 @@ $(print_icon 'MULTILINE_SECOND_PROMPT_PREFIX')"
|
|||
fi
|
||||
}
|
||||
|
||||
function zle-line-init {
|
||||
powerlevel9k_prepare_prompts
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
function zle-keymap-select {
|
||||
powerlevel9k_prepare_prompts
|
||||
zle reset-prompt
|
||||
}
|
||||
|
||||
powerlevel9k_init() {
|
||||
# Display a warning if the terminal does not support 256 colors
|
||||
local term_colors
|
||||
|
@ -898,6 +910,9 @@ powerlevel9k_init() {
|
|||
|
||||
# prepare prompts
|
||||
add-zsh-hook precmd powerlevel9k_prepare_prompts
|
||||
|
||||
zle -N zle-line-init
|
||||
zle -N zle-keymap-select
|
||||
}
|
||||
|
||||
powerlevel9k_init "$@"
|
||||
|
|
Loading…
Reference in a new issue