1
0
Fork 0

chore: update nushell env and completions

Signed-off-by: jolheiser <john.olheiser@gmail.com>
main
jolheiser 2023-08-11 19:48:14 -05:00
parent b50b7cfcde
commit d45c5c7839
Signed by: jolheiser
GPG Key ID: B853ADA5DA7BBF7A
7 changed files with 31 additions and 31 deletions

View File

@ -20,12 +20,12 @@
use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/btm/btm-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/btm/btm-completions.nu *
use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/git/git-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/git/git-completions.nu *
use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/glow/glow-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/glow/glow-completions.nu *
use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/just/just.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/just/just-completions.nu *
use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/nix/nix-completions.nu * use ${pkgs.nu_scripts}/share/nu_scripts/custom-completions/nix/nix-completions.nu *
''; '';
extraEnv = '' extraEnv = ''
let-env GOPATH = "${config.xdg.dataHome}/go" $env.GOPATH = "${config.xdg.dataHome}/go"
let-env PATH = ($env.PATH | split row (char esep) | prepend '${config.xdg.dataHome}/go/bin') $env.PATH = ($env.PATH | split row (char esep) | prepend '${config.xdg.dataHome}/go/bin')
''; '';
}; };
xdg.configFile = { xdg.configFile = {

View File

@ -297,7 +297,7 @@ let light_theme = {
# The default config record. This is where much of your global configuration is setup. # The default config record. This is where much of your global configuration is setup.
let-env config = { $env.config = {
ls: { ls: {
use_ls_colors: true # use the LS_COLORS environment variable to colorize output use_ls_colors: true # use the LS_COLORS environment variable to colorize output
clickable_links: true # enable or disable clickable links. Your terminal has to support links. clickable_links: true # enable or disable clickable links. Your terminal has to support links.

View File

@ -19,21 +19,21 @@ def create_right_prompt [] {
} }
# Use nushell functions to define your right and left prompt # Use nushell functions to define your right and left prompt
let-env PROMPT_COMMAND = { create_left_prompt } $env.PROMPT_COMMAND = { create_left_prompt }
let-env PROMPT_COMMAND_RIGHT = { create_right_prompt } $env.PROMPT_COMMAND_RIGHT = { create_right_prompt }
# The prompt indicators are environmental variables that represent # The prompt indicators are environmental variables that represent
# the state of the prompt # the state of the prompt
let-env PROMPT_INDICATOR = { "〉" } $env.PROMPT_INDICATOR = { "〉" }
let-env PROMPT_INDICATOR_VI_INSERT = { ": " } $env.PROMPT_INDICATOR_VI_INSERT = { ": " }
let-env PROMPT_INDICATOR_VI_NORMAL = { "〉" } $env.PROMPT_INDICATOR_VI_NORMAL = { "〉" }
let-env PROMPT_MULTILINE_INDICATOR = { "::: " } $env.PROMPT_MULTILINE_INDICATOR = { "::: " }
# Specifies how environment variables are: # Specifies how environment variables are:
# - converted from a string to a value on Nushell startup (from_string) # - 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) # - converted from a value back to a string when running external commands (to_string)
# Note: The conversions happen *after* config.nu is loaded # Note: The conversions happen *after* config.nu is loaded
let-env ENV_CONVERSIONS = { $env.ENV_CONVERSIONS = {
"PATH": { "PATH": {
from_string: { |s| $s | split row (char esep) | path expand -n } from_string: { |s| $s | split row (char esep) | path expand -n }
to_string: { |v| $v | path expand -n | str join (char esep) } to_string: { |v| $v | path expand -n | str join (char esep) }
@ -47,16 +47,16 @@ let-env ENV_CONVERSIONS = {
# Directories to search for scripts when calling source or use # Directories to search for scripts when calling source or use
# #
# By default, <nushell-config-dir>/scripts is added # By default, <nushell-config-dir>/scripts is added
let-env NU_LIB_DIRS = [ $env.NU_LIB_DIRS = [
($nu.config-path | path dirname | path join 'scripts') ($nu.config-path | path dirname | path join 'scripts')
] ]
# Directories to search for plugin binaries when calling register # Directories to search for plugin binaries when calling register
# #
# By default, <nushell-config-dir>/plugins is added # By default, <nushell-config-dir>/plugins is added
let-env NU_PLUGIN_DIRS = [ $env.NU_PLUGIN_DIRS = [
($nu.config-path | path dirname | path join 'plugins') ($nu.config-path | path dirname | path join 'plugins')
] ]
# To add entries to PATH (on Windows you might use Path), you can use the following pattern: # To add entries to PATH (on Windows you might use Path), you can use the following pattern:
# let-env PATH = ($env.PATH | split row (char esep) | prepend '/some/path') # $env.PATH = ($env.PATH | split row (char esep) | prepend '/some/path')

View File

@ -26,8 +26,8 @@ def nixdev [
} }
## Other ## ## Other ##
let-env EDITOR = hx $env.EDITOR = hx
let-env config = ($env.config | upsert "shell_integration" ("WEZTERM_PANE" not-in $env and "SSH_CLIENT" not-in $env)) $env.config = ($env.config | upsert "shell_integration" ("WEZTERM_PANE" not-in $env and "SSH_CLIENT" not-in $env))
source ~/.config/nushell/zoxide.nu source ~/.config/nushell/zoxide.nu
source ~/.config/nushell/ohmyposh.nu source ~/.config/nushell/ohmyposh.nu

View File

@ -1,18 +1,18 @@
export-env { export-env {
let-env POWERLINE_COMMAND = 'oh-my-posh' $env.POWERLINE_COMMAND = 'oh-my-posh'
let-env POSH_THEME = "~/.config/oh-my-posh/config.json" $env.POSH_THEME = "~/.config/oh-my-posh/config.json"
let-env PROMPT_INDICATOR = "" $env.PROMPT_INDICATOR = ""
let-env POSH_PID = (random uuid) $env.POSH_PID = (random uuid)
# By default displays the right prompt on the first line # By default displays the right prompt on the first line
# making it annoying when you have a multiline prompt # making it annoying when you have a multiline prompt
# making the behavior different compared to other shells # making the behavior different compared to other shells
let-env PROMPT_COMMAND_RIGHT = {''} $env.PROMPT_COMMAND_RIGHT = {''}
let-env NU_VERSION = (version | get version) $env.NU_VERSION = (version | get version)
# PROMPTS # PROMPTS
let-env PROMPT_MULTILINE_INDICATOR = (^oh-my-posh print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)") $env.PROMPT_MULTILINE_INDICATOR = (^oh-my-posh print secondary $"--config=($env.POSH_THEME)" --shell=nu $"--shell-version=($env.NU_VERSION)")
let-env PROMPT_COMMAND = { $env.PROMPT_COMMAND = {
# We have to do this because the initial value of `$env.CMD_DURATION_MS` is always `0823`, # We have to do this because the initial value of `$env.CMD_DURATION_MS` is always `0823`,
# which is an official setting. # which is an official setting.
# See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687. # See https://github.com/nushell/nushell/discussions/6402#discussioncomment-3466687.

View File

@ -7,12 +7,12 @@
# Initialize hook to add new entries to the database. # Initialize hook to add new entries to the database.
if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) { if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) {
let-env __zoxide_hooked = true $env.__zoxide_hooked = true
let-env config = ($env | default {} config).config $env.config = ($env | default {} config).config
let-env config = ($env.config | default {} hooks) $env.config = ($env.config | default {} hooks)
let-env config = ($env.config | update hooks ($env.config.hooks | default {} env_change)) $env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
let-env config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD)) $env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
let-env config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir| $env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir|
zoxide add -- $dir zoxide add -- $dir
})) }))
} }

View File

@ -64,5 +64,5 @@
systemPackages = with pkgs; [podman podman-compose podman-tui]; systemPackages = with pkgs; [podman podman-compose podman-tui];
}; };
fonts.fonts = with pkgs; [(nerdfonts.override {fonts = ["JetBrainsMono"];})]; fonts.packages = with pkgs; [(nerdfonts.override {fonts = ["JetBrainsMono"];})];
} }