1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Merge pull request #24 from fdncred/main

update title with abbreviated path and terminal size
This commit is contained in:
Darren Schroeder 2021-02-23 15:22:07 -06:00 committed by GitHub
commit 135324413d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,8 @@ def construct_prompt [] {
# let right = $(build-string $current_time)
# let the_prompt = $(build-string $left $(echo $right | str lpad -c ' ' -l $(= $term_width - $(echo $left | str length))) $(char newline) $decorator ' ')
echo $title_bar
echo $the_prompt | str collect
## put this in your config.toml
@ -39,11 +41,11 @@ def set_title_str [str-arg] {
echo [$(ansi title) ' ' $str-arg ' ' $(ansi bel)] | str collect
}
def get_abbrev_pwd_win [] {
echo [$(pwd | split row '\\' | first $(pwd | split row '\\' | count | each {= $it - 1} ) | str substring '0,1' | format '{$it}/' | append $(pwd | split row '\\' | last ) | str collect)] | str collect
echo [$(pwd | split row '\' | first $(pwd | split row '\' | count | each {= $it - 1} ) | str substring '0,1' | format '{$it}/' | append $(pwd | split row '\' | last ) | str collect)] | str collect
}
def get_abbrev_pwd_lin [] {
echo [$(pwd | split row '/' | first $(pwd | split row '/' | count | each {= $it - 1} ) | each { str substring '0,1' | format '{$it}/' } | append $(pwd | split row '/' | last ) | str collect)] | str collect
}
def set_title [] {
set_title_str $(echo $(get_abbrev_pwd_win))
set_title_str $(build-string $(get_abbrev_pwd_win) ' ' $(term size -w) 'x' $(term size -t) | str collect)
}