Apply changes for nushell update

main
trivernis 1 year ago
parent 26be3e221a
commit 5a29231ffa
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG Key ID: DFFFCC2C7A02DB45

@ -111,7 +111,7 @@ let light_theme = {
# The default config record. This is where much of your global configuration is setup.
let-env config = {
$env.config = {
cursor_shape: {
vi_insert: underscore
vi_normal: block
@ -422,9 +422,6 @@ source ~/.config/nushell/path.nu
# Starship
source ~/.config/nushell/starship.nu
# Zoxide
source ~/.config/nushell/zoxide.nu
# aliases
source ~/.config/nushell/aliases.nu

@ -19,21 +19,21 @@ def create_right_prompt [] {
}
# Use nushell functions to define your right and left prompt
let-env PROMPT_COMMAND = {|| create_left_prompt }
let-env PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
$env.PROMPT_COMMAND = {|| create_left_prompt }
$env.PROMPT_COMMAND_RIGHT = {|| create_right_prompt }
# The prompt indicators are environmental variables that represent
# the state of the prompt
let-env PROMPT_INDICATOR = {|| "〉" }
let-env PROMPT_INDICATOR_VI_INSERT = {|| ": " }
let-env PROMPT_INDICATOR_VI_NORMAL = {|| "〉" }
let-env PROMPT_MULTILINE_INDICATOR = {|| "::: " }
$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
let-env ENV_CONVERSIONS = {
$env.ENV_CONVERSIONS = {
"PATH": {
from_string: { |s| $s | split row (char esep) | path expand -n }
to_string: { |v| $v | path expand -n | str join (char esep) }
@ -47,18 +47,18 @@ let-env ENV_CONVERSIONS = {
# Directories to search for scripts when calling source or use
#
# 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')
]
# Directories to search for plugin binaries when calling register
#
# 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')
]
let-env EDITOR = "hx"
let-env SSH_AUTH_SOCK = $"($env.XDG_RUNTIME_DIR)/ssh-agent.socket"
$env.EDITOR = "hx"
$env.SSH_AUTH_SOCK = $"($env.XDG_RUNTIME_DIR)/ssh-agent.socket"
# :$PATH# 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')

@ -1,4 +1,4 @@
let-env PATH = ( $env.PATH
$env.PATH = ( $env.PATH
| prepend $'($env.HOME)/.local/bin'
| prepend $'($env.HOME)/.cargo/bin'
| prepend $'($env.HOME)/.local/share/nenv/bin'

@ -1,12 +1,12 @@
let-env STARSHIP_SHELL = "nu"
let-env STARSHIP_SESSION_KEY = (random chars -l 16)
let-env PROMPT_MULTILINE_INDICATOR = (^/usr/bin/starship prompt --continuation)
$env.STARSHIP_SHELL = "nu"
$env.STARSHIP_SESSION_KEY = (random chars -l 16)
$env.PROMPT_MULTILINE_INDICATOR = (^/usr/bin/starship prompt --continuation)
# Does not play well with default character module.
# TODO: Also Use starship vi mode indicators?
let-env PROMPT_INDICATOR = ""
$env.PROMPT_INDICATOR = ""
let-env PROMPT_COMMAND = {||
$env.PROMPT_COMMAND = {||
# jobs are not supported
let width = (term size | get columns | into string)
^/usr/bin/starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
@ -15,4 +15,4 @@ let-env PROMPT_COMMAND = {||
# Not well-suited for `starship prompt --right`.
# Built-in right prompt is equivalent to $fill$right_format in the first prompt line.
# Thus does not play well with default `add_newline = True`.
let-env PROMPT_COMMAND_RIGHT = {||''}
$env.PROMPT_COMMAND_RIGHT = {||''}

@ -1,59 +0,0 @@
# Code generated by zoxide. DO NOT EDIT.
# =============================================================================
#
# Hook configuration for zoxide.
#
# Initialize hook to add new entries to the database.
let-env config = ($env | default {} config).config
let-env config = ($env.config | default {} hooks)
let-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))
let-env config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir|
zoxide add -- $dir
}))
# =============================================================================
#
# When using zoxide with --no-cmd, alias these internal functions as desired.
#
# Jump to a directory using only keywords.
def-env __zoxide_z [...rest:string] {
# `z -` does not work yet, see https://github.com/nushell/nushell/issues/4769
let arg0 = ($rest | append '~').0
let path = if (($rest | length) <= 1) and ($arg0 == '-' or ($arg0 | path expand | path type) == dir) {
$arg0
} else {
(zoxide query --exclude $env.PWD -- $rest | str trim -r -c "\n")
}
cd $path
}
# Jump to a directory using interactive search.
def-env __zoxide_zi [...rest:string] {
cd $'(zoxide query -i -- $rest | str trim -r -c "\n")'
}
# =============================================================================
#
# Commands for zoxide. Disable these using --no-cmd.
#
alias z = __zoxide_z
# old-alias cd = __zoxide_z
alias zi = __zoxide_zi
# =============================================================================
#
# Add this to your env file (find it by running `$nu.env-path` in Nushell):
#
# zoxide init nushell --hook prompt | save ~/.zoxide.nu
#
# Now, add this to the end of your config file (find it by running
# `$nu.config-path` in Nushell):
#
# source ~/.zoxide.nu
#
# Note: zoxide only supports Nushell v0.63.0 and above.
Loading…
Cancel
Save