Add nushell config
parent
75ca9068b6
commit
dbabc8b550
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,63 @@
|
||||
# Nushell Environment Config File
|
||||
#
|
||||
# version = "0.100.0"
|
||||
|
||||
$env.STARSHIP_SHELL = "nu"
|
||||
|
||||
def create_left_prompt [] {
|
||||
starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)'
|
||||
}
|
||||
|
||||
# Use nushell functions to define your right and left prompt
|
||||
$env.PROMPT_COMMAND = { || create_left_prompt }
|
||||
$env.PROMPT_COMMAND_RIGHT = ""
|
||||
|
||||
$env.PROMPT_INDICATOR = ""
|
||||
$env.PROMPT_INDICATOR_VI_INSERT = ": "
|
||||
$env.PROMPT_INDICATOR_VI_NORMAL = "〉"
|
||||
$env.PROMPT_MULTILINE_INDICATOR = "::: "
|
||||
|
||||
# Specifies how environment variables are:
|
||||
# - converted from a string to a value on Nushell startup (from_string)
|
||||
# - converted from a value back to a string when running external commands (to_string)
|
||||
# Note: The conversions happen *after* config.nu is loaded
|
||||
$env.ENV_CONVERSIONS = {
|
||||
"PATH": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
"XDG_DATA_DIRS": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
"Path": {
|
||||
from_string: { |s| $s | split row (char esep) | path expand --no-symlink }
|
||||
to_string: { |v| $v | path expand --no-symlink | str join (char esep) }
|
||||
}
|
||||
}
|
||||
|
||||
# Directories to search for scripts when calling source or use
|
||||
# The default for this is $nu.default-config-dir/scripts
|
||||
$env.NU_LIB_DIRS = [
|
||||
($nu.default-config-dir | path join 'scripts') # add <nushell-config-dir>/scripts
|
||||
($nu.data-dir | path join 'completions') # default home for nushell completions
|
||||
]
|
||||
|
||||
# Directories to search for plugin binaries when calling register
|
||||
# The default for this is $nu.default-config-dir/plugins
|
||||
$env.NU_PLUGIN_DIRS = [
|
||||
# add <nushell-config-dir>/plugins
|
||||
($nu.default-config-dir | path join 'plugins')
|
||||
]
|
||||
|
||||
$env.PATH = [
|
||||
($'($env.HOME)/.local/bin')
|
||||
($'($env.CARGO_HOME?)' | path join "bin")
|
||||
($'($env.HOME)/go/bin')
|
||||
($'($env.HOME)/.rbenv/shims')
|
||||
($'($env.HOME)/.local/share/JetBrains/Toolbox/scripts')
|
||||
...($env.PATH | split row (char esep))
|
||||
'/snap/bin'
|
||||
] | each {|p| if ($p | path exists) { $p } else { null }} | uniq
|
||||
|
||||
source ($nu.default-config-dir | path join 'xdg.nu')
|
@ -0,0 +1,28 @@
|
||||
$env.XDG_BIN_HOME = $'($env.HOME)/.local/bin'
|
||||
$env.XDG_CACHE_HOME = $'($env.HOME)/.cache'
|
||||
$env.XDG_CONFIG_HOME = $'($env.HOME)/.config'
|
||||
$env.XDG_DATA_HOME = $'($env.HOME)/.local/share'
|
||||
$env.XDG_INCLUDE_HOME = $'($env.HOME)/.local/include'
|
||||
$env.XDG_STATE_HOME = $'($env.HOME)/.local/state'
|
||||
|
||||
$env.XDG_DESKTOP_DIR = $'($env.HOME)/desktop'
|
||||
$env.XDG_DOCUMENTS_DIR = $'($env.HOME)/documents'
|
||||
$env.XDG_DOWNLOAD_DIR = $'($env.HOME)/downloads'
|
||||
$env.XDG_MUSIC_DIR = $'($env.HOME)/music'
|
||||
$env.XDG_PICTURES_DIR = $'($env.HOME)/pictures'
|
||||
$env.XDG_PODCAST_DIR = $'($env.HOME)/podcasts'
|
||||
$env.XDG_PUBLICSHARE_DIR = $'($env.HOME)/public'
|
||||
$env.XDG_TEMPLATES_DIR = $'($env.HOME)/templates'
|
||||
$env.XDG_VIDEOS_DIR = $'($env.HOME)/videos'
|
||||
|
||||
let xdg = $env
|
||||
| transpose name value
|
||||
| each {|e| if $e.name =~ 'XDG_' { $e } else { null }}
|
||||
| each {|e| {
|
||||
name: ($e.name | str replace 'XDG_' '' | str downcase),
|
||||
value: $e.value
|
||||
}}
|
||||
| reduce --fold {} {|e, memo| {
|
||||
...$memo,
|
||||
$e.name: ($e.value | if $in =~ ':' { split row ':' } else { $e.value })
|
||||
}}
|
Loading…
Reference in New Issue