mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-12-12 19:18:28 +02:00
Merge pull request #114 from alexlafroscia/add-nvm-prompt-segment
Add nvm prompt segment
This commit is contained in:
commit
d459ec0983
@ -77,6 +77,7 @@ The segments that are currently available are:
|
||||
* [ip](#ip) - Shows the current IP address.
|
||||
* **load** - Your machines 5 minute load average and free RAM.
|
||||
* **node_version** - Show the version number of the installed Node.js.
|
||||
* **nvm** - Show the version of Node that is currently active, if it differs from the version used by NVM
|
||||
* **os_icon** - Display a nice little icon, depending on your operating system.
|
||||
* **php_version** - Show the current PHP version.
|
||||
* [rbenv](#rbenv) - Ruby environment information (if one is active).
|
||||
|
@ -755,6 +755,17 @@ prompt_php_version() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Node version from NVM
|
||||
# Only prints the segment if different than the default value
|
||||
prompt_nvm() {
|
||||
local node_version=$(nvm current)
|
||||
local nvm_default=$(cat $NVM_DIR/alias/default)
|
||||
[[ -z "${node_version}" ]] && return
|
||||
[[ "$node_version" =~ "$nvm_default" ]] && return
|
||||
NODE_ICON=$'\u2B22' # ⬢
|
||||
$1_prompt_segment "$0" "green" "011" "${node_version:1} $NODE_ICON"
|
||||
}
|
||||
|
||||
# rbenv information
|
||||
prompt_rbenv() {
|
||||
if [[ -n "$RBENV_VERSION" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user