You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.3 KiB
Cheetah
117 lines
3.3 KiB
Cheetah
2 weeks ago
|
# chezmoi:template:left-delimiter=#{{
|
||
|
#{{- /* vim: set filetype=nu: */ -}}
|
||
|
# Nushell Environment Config File
|
||
|
|
||
|
def command_prompt [] {(
|
||
|
starship prompt
|
||
|
$'--cmd-duration=($env.CMD_DURATION_MS)'
|
||
|
$'--status=($env.LAST_EXIT_CODE)'
|
||
|
)}
|
||
|
|
||
|
def add_xdg [name ...parts] {
|
||
|
if $name in $env {
|
||
|
return ($env | get $name)
|
||
|
}
|
||
|
for $part in $parts {
|
||
|
let path = ($env.HOME | path join $part)
|
||
|
if ($path | path exists) {
|
||
|
return $path
|
||
|
}
|
||
|
}
|
||
|
return ''
|
||
|
}
|
||
|
|
||
|
def from_string [] {
|
||
|
$in | split row (char esep) | path expand --no-symlink
|
||
|
}
|
||
|
|
||
|
def to_string [] {
|
||
|
$in | path expand --no-symlink | str join (char esep)
|
||
|
}
|
||
|
|
||
|
load-env {
|
||
|
XDG_BIN_HOME: (add_xdg XDG_BIN_HOME .local/bin)
|
||
|
XDG_CACHE_HOME: (add_xdg XDG_CACHE_HOME .cache)
|
||
|
XDG_CONFIG_HOME: (add_xdg XDG_CONFIG_HOME .config)
|
||
|
XDG_DATA_HOME: (add_xdg XDG_DATA_HOME .local/share)
|
||
|
XDG_INCLUDE_HOME: (add_xdg XDG_INCLUDE_HOME .local/include)
|
||
|
XDG_STATE_HOME: (add_xdg XDG_STATE_HOME .local/state)
|
||
|
|
||
|
XDG_DESKTOP_DIR: (add_xdg XDG_DESKTOP_DIR desktop Desktop)
|
||
|
XDG_DOCUMENTS_DIR: (add_xdg XDG_DOCUMENTS_DIR documents Documents)
|
||
|
XDG_DOWNLOAD_DIR: (add_xdg XDG_DOWNLOAD_DIR downloads Downloads)
|
||
|
XDG_MUSIC_DIR: (add_xdg XDG_MUSIC_DIR music Music)
|
||
|
XDG_PICTURES_DIR: (add_xdg XDG_PICTURES_DIR pictures Pictures)
|
||
|
XDG_PODCAST_DIR: (add_xdg XDG_PODCAST_DIR podcasts Podcasts)
|
||
|
XDG_PUBLICSHARE_DIR: (add_xdg XDG_PUBLICSHARE_DIR public Public)
|
||
|
XDG_TEMPLATES_DIR: (add_xdg XDG_TEMPLATES_DIR templates Templates)
|
||
|
XDG_VIDEOS_DIR: (add_xdg XDG_VIDEOS_DIR videos Videos)
|
||
|
}
|
||
|
|
||
|
load-env {
|
||
|
STARSHIP_SHELL: nu
|
||
|
EDITOR: nvim
|
||
|
|
||
|
BROWSER: firefox
|
||
|
MAN_DIR: $'($env.XDG_DATA_HOME)/man/man1'
|
||
|
|
||
|
BAT_PAGER: "less --raw-control-chars --quit-if-one-screen --no-init"
|
||
|
BAT_STYLE: plain
|
||
|
BAT_THEME: zenburn
|
||
|
MANPAGER: "sh -c 'col -bx | bat --language man --plain'"
|
||
|
CLICOLOR: 1
|
||
|
GOPRIVATE: github.com/HelloTech
|
||
|
PULUMI_SKIP_UPDATE_CHECK: true
|
||
|
NPM_CONFIG_USERCONFIG: $'($env.XDG_CONFIG_HOME)/npm/npmrc'
|
||
|
RIPGREP_CONFIG_PATH: $'($env.XDG_CONFIG_HOME)/ripgrep/config'
|
||
|
|
||
|
PATH: ([
|
||
|
$env.XDG_BIN_HOME
|
||
|
($'($env.CARGO_HOME?)' | path join "bin")
|
||
|
($'($env.HOME)/go/bin')
|
||
|
($'($env.HOME)/.rbenv/shims')
|
||
|
($'($env.HOME)/.local/share/JetBrains/Toolbox/scripts')
|
||
|
'/usr/local/bin'
|
||
|
...($env.PATH | split row (char esep))
|
||
|
'/snap/bin'
|
||
|
] | each {|p| if ($p | path exists) { $p } else { null }}
|
||
|
| uniq)
|
||
|
|
||
|
PROMPT_COMMAND_RIGHT: ""
|
||
|
PROMPT_COMMAND: {|| command_prompt }
|
||
|
|
||
|
PROMPT_INDICATOR: ""
|
||
|
PROMPT_INDICATOR_VI_INSERT: ": "
|
||
|
PROMPT_INDICATOR_VI_NORMAL: "〉"
|
||
|
PROMPT_MULTILINE_INDICATOR: "::: "
|
||
|
|
||
|
NU_LIB_DIRS: [
|
||
|
($nu.default-config-dir | path join 'lib')
|
||
|
($nu.data-dir | path join 'completions')
|
||
|
]
|
||
|
|
||
|
NU_PLUGIN_DIRS: [
|
||
|
($nu.default-config-dir | path join 'plugins')
|
||
|
]
|
||
|
|
||
|
ENV_CONVERSIONS: {
|
||
|
PATH: {
|
||
|
from_string: { from_string }
|
||
|
to_string: { to_string }
|
||
|
}
|
||
|
XDG_DATA_DIRS: {
|
||
|
from_string: { from_string }
|
||
|
to_string: { to_string }
|
||
|
}
|
||
|
Path: {
|
||
|
from_string: { from_string }
|
||
|
to_string: { to_string }
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
hide add_xdg
|
||
|
hide command_prompt
|
||
|
hide from_string
|
||
|
hide to_string
|