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

export env is not in nushell (#529)

* `export env` is not in nushell
using `load-env` and `export-env` since we are `use`-ing  init.nu

* reformatted export-env part to move this along

---------

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
This commit is contained in:
Daniel Mijares 2023-06-17 08:48:08 -04:00 committed by GitHub
parent 1c19087afd
commit c544a92a40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,30 +7,34 @@ export def egd [...rest] {
with-env [GIT_EXTERNAL_DIFF 'difft'] { git diff $rest } with-env [GIT_EXTERNAL_DIFF 'difft'] { git diff $rest }
} }
# env # we need to export the env we create witk load-env
export env LS_COLORS { # because we are `use`-ing here and not `source`-ing this file
[ export-env {
"di=01;34;2;102;217;239" load-env {
"or=00;40;31" BROWSER: "firefox"
"mi=00;40;31" CARGO_TARGET_DIR: "~/.cargo/target"
"ln=00;36" EDITOR: "nvim"
"ex=00;32" VISUAL: "nvim"
] | str join (char env_sep) PAGER: "less"
SHELL: "~/.cargo/bin/nu"
JULIA_NUM_THREADS: nproc
HOSTNAME: (hostname | split row '.' | first | str trim)
SHOW_USER: true
LS_COLORS: ([
"di=01;34;2;102;217;239"
"or=00;40;31"
"mi=00;40;31"
"ln=00;36"
"ex=00;32"
] | str join (char env_sep))
}
} }
export env BROWSER { "firefox" }
export env CARGO_TARGET_DIR { "~/.cargo/target" }
export env EDITOR { "nvim" }
export env VISUAL { "nvim" }
export env PAGER { "less" }
export env SHELL { "~/.cargo/bin/nu" }
export env JULIA_NUM_THREADS { nproc }
export env HOSTNAME { hostname | split row '.' | first | str trim }
export env SHOW_USR { "true" }
# prompt # prompt
export env PROMPT_COMMAND { "build-prompt" } PROMPT_COMMAND: { build-prompt }
export def build-prompt [] { export def build-prompt [] {
let usr_str = (if $env.SHOW_USR == "true" { let usr_str = (if $env.SHOW_USER {
[ [
$env.USER $env.USER
'@' '@'
@ -41,8 +45,8 @@ export def build-prompt [] {
'' ''
}) })
let pwd_str = (if (pwd | str starts-with $env.HOME).0 { let pwd_str = (if (pwd | str starts-with $env.HOME) {
(pwd | str replace $env.HOME '~' | str trim).0 (pwd | str replace $env.HOME '~' | str trim)
} else { } else {
pwd pwd
}) })