[update] Upate nushell configs to reflect the latest changes
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
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 = (^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).columns
|
||||
^/usr/bin/starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
|
||||
^starship prompt $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
|
||||
}
|
||||
|
||||
# Whether we have config items
|
||||
let has_config_items = (not ($env | get -i config | is-empty))
|
||||
|
||||
let-env config = if $has_config_items {
|
||||
$env.config = if $has_config_items {
|
||||
$env.config | upsert render_right_prompt_on_last_line true
|
||||
} else {
|
||||
{render_right_prompt_on_last_line: true}
|
||||
}
|
||||
|
||||
let-env PROMPT_COMMAND_RIGHT = { ||
|
||||
$env.PROMPT_COMMAND_RIGHT = { ||
|
||||
let width = (term size).columns
|
||||
^/usr/bin/starship prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
|
||||
^starship prompt --right $"--cmd-duration=($env.CMD_DURATION_MS)" $"--status=($env.LAST_EXIT_CODE)" $"--terminal-width=($width)"
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
# Initialize hook to add new entries to the database.
|
||||
if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) {
|
||||
let-env __zoxide_hooked = true
|
||||
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|
|
||||
$env.__zoxide_hooked = true
|
||||
$env.config = ($env | default {} config).config
|
||||
$env.config = ($env.config | default {} hooks)
|
||||
$env.config = ($env.config | update hooks ($env.config.hooks | default {} env_change))
|
||||
$env.config = ($env.config | update hooks.env_change ($env.config.hooks.env_change | default [] PWD))
|
||||
$env.config = ($env.config | update hooks.env_change.PWD ($env.config.hooks.env_change.PWD | append {|_, dir|
|
||||
zoxide add -- $dir
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ let light_theme = {
|
||||
|
||||
|
||||
# The default config record. This is where much of your global configuration is setup.
|
||||
let-env config = {
|
||||
$env.config = {
|
||||
ls: {
|
||||
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.
|
||||
@@ -654,3 +654,4 @@ let-env config = {
|
||||
source starship.nu
|
||||
source zoxide.nu
|
||||
source alias.nu
|
||||
use conda.nu
|
||||
|
||||
@@ -12,28 +12,28 @@ def create_left_prompt [] {
|
||||
|
||||
def create_right_prompt [] {
|
||||
let time_segment = ([
|
||||
(date now | date format '%m/%d/%Y %r')
|
||||
(date now | format date '%m/%d/%Y %r')
|
||||
] | str join)
|
||||
|
||||
$time_segment
|
||||
}
|
||||
|
||||
# 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,7 +47,7 @@ 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')
|
||||
($nu.config-path | path dirname | path join 'conf.d')
|
||||
]
|
||||
@@ -55,16 +55,16 @@ let-env NU_LIB_DIRS = [
|
||||
# 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')
|
||||
]
|
||||
|
||||
load-env (fnm env --shell bash | lines | str replace 'export ' '' | str replace -a '"' '' | split column = | rename name value | where name != "FNM_ARCH" and name != "PATH" | reduce -f {} {|it, acc| $acc | upsert $it.name $it.value })
|
||||
|
||||
# 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')
|
||||
# macOS ARM64 (Apple Silicon)
|
||||
let-env PATH = ($env.PATH | split row (char esep) | prepend '/opt/homebrew/bin')
|
||||
let-env PATH = ($env.PATH | prepend $"($env.FNM_MULTISHELL_PATH)/bin")
|
||||
$env.PATH = ($env.PATH | split row (char esep) | prepend '/opt/homebrew/bin')
|
||||
$env.PATH = ($env.PATH | prepend $"($env.FNM_MULTISHELL_PATH)/bin")
|
||||
# Linux
|
||||
# let-env PATH = ($env.PATH | split row (char esep) | prepend '/home/linuxbrew/.linuxbrew/bin')
|
||||
# $env.PATH = ($env.PATH | split row (char esep) | prepend '/home/linuxbrew/.linuxbrew/bin')
|
||||
|
||||
89
config/nushell/scripts/conda.nu
Normal file
89
config/nushell/scripts/conda.nu
Normal file
@@ -0,0 +1,89 @@
|
||||
export-env {
|
||||
$env.CONDA_BASE_PATH = (if ((sys).host.name == "Windows") {$env.Path} else {$env.PATH})
|
||||
|
||||
let info = (
|
||||
if not (which mamba | is-empty) {
|
||||
(mamba info --envs --json | from json)
|
||||
} else if not (which conda | is-empty) {
|
||||
(conda info --envs --json | from json)
|
||||
} else {
|
||||
('{"root_prefix": "", "envs": ""}' | from json)
|
||||
})
|
||||
|
||||
$env.CONDA_ROOT = $info.root_prefix
|
||||
|
||||
$env.CONDA_ENVS = ($info.envs | reduce -f {} {|it, acc|
|
||||
if $it == $info.root_prefix {
|
||||
$acc | upsert "base" $it
|
||||
} else {
|
||||
$acc | upsert ($it | path basename) $it
|
||||
}})
|
||||
|
||||
$env.CONDA_CURR = null
|
||||
}
|
||||
|
||||
export def-env activate [name: string] {
|
||||
if ($env.CONDA_ROOT | is-empty) {
|
||||
print "Neither Conda nor Mamba is valid."
|
||||
return
|
||||
}
|
||||
|
||||
if not ($name in $env.CONDA_ENVS) {
|
||||
print $"Environment ($name) is invalid. Available:"
|
||||
print $env.CONDA_ENVS
|
||||
return
|
||||
}
|
||||
|
||||
let new_path = (
|
||||
if ((sys).host.name == "Windows") {
|
||||
update-path-windows ($env.CONDA_ENVS | get $name)
|
||||
} else {
|
||||
update-path-linux ($env.CONDA_ENVS | get $name)
|
||||
})
|
||||
|
||||
load-env ({CONDA_CURR: $name} | merge $new_path)
|
||||
}
|
||||
|
||||
export def-env deactivate [] {
|
||||
if ($env.CONDA_ROOT | is-empty) {
|
||||
print "Neither Conda nor Mamba is valid."
|
||||
return
|
||||
}
|
||||
|
||||
$env.CONDA_CURR = null
|
||||
|
||||
load-env {Path: $env.CONDA_BASE_PATH, PATH: $env.CONDA_BASE_PATH}
|
||||
}
|
||||
|
||||
export def-env list [] {
|
||||
$env.CONDA_ENVS |
|
||||
flatten |
|
||||
transpose |
|
||||
rename name path |
|
||||
insert active { |it| $it.name == $env.CONDA_CURR } |
|
||||
move path --after active
|
||||
}
|
||||
|
||||
def update-path-linux [env_path: path] {
|
||||
let env_path = [
|
||||
$env_path,
|
||||
([$env_path, "bin"] | path join)
|
||||
]
|
||||
|
||||
return {
|
||||
Path: ($env.PATH | prepend $env_path),
|
||||
PATH: ($env.PATH | prepend $env_path)
|
||||
}
|
||||
}
|
||||
|
||||
def update-path-windows [env_path: path] {
|
||||
let env_path = [
|
||||
$env_path,
|
||||
([$env_path, "Scripts"] | path join),
|
||||
]
|
||||
|
||||
return {
|
||||
Path: ($env.Path | prepend $env_path),
|
||||
PATH: ($env.Path | prepend $env_path)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
local vim = vim;
|
||||
-- autocmd BufWinLeave,BufLeave,BufWritePost,BufHidden,QuitPre ?* nested mkview!
|
||||
-- autocmd BufWinEnter ?* silent! loadview
|
||||
vim.api.nvim_exec([[
|
||||
augroup AutoSaveGroup
|
||||
autocmd!
|
||||
autocmd BufWritePost ?* nested mkview!
|
||||
autocmd BufRead * silent! loadview
|
||||
augroup end
|
||||
]], false)
|
||||
-- vim.api.nvim_exec([[
|
||||
-- augroup AutoSaveGroup
|
||||
-- autocmd!
|
||||
-- autocmd BufWritePost ?* nested mkview!
|
||||
-- autocmd BufRead * silent! loadview
|
||||
-- augroup end
|
||||
-- ]], false)
|
||||
|
||||
vim.o.number = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
@@ -1,43 +1,43 @@
|
||||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "c5fb16a934892086d4ba01bac48b77c65435025e" },
|
||||
"LuaSnip": { "branch": "master", "commit": "cdbf6f41381e5ee4810b4b09284b603d8f18365d" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" },
|
||||
"cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"comfortable-motion.vim": { "branch": "master", "commit": "e20aeafb07c6184727b29f7674530150f7ab2036" },
|
||||
"copilot-cmp": { "branch": "master", "commit": "72fbaa03695779f8349be3ac54fa8bd77eed3ee3" },
|
||||
"copilot.lua": { "branch": "master", "commit": "1a8032ae496916ccc7a7a52ee79194fbef29f462" },
|
||||
"d2-vim": { "branch": "master", "commit": "981c87dccb63df2887cc41b96e84bf550f736c57" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "a111d19ccceac6530448d329c63f998f77b5626e" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "0437ef8bfdd67156d87140d692840a3c2824fa20" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" },
|
||||
"formatter.nvim": { "branch": "master", "commit": "34dcdfa0c75df667743b2a50dd99c84a557376f0" },
|
||||
"galaxyline.nvim": { "branch": "main", "commit": "4d4f5fc8e20a10824117e5beea7ec6e445466a8f" },
|
||||
"git-conflict.nvim": { "branch": "main", "commit": "4e0191c9a0ae05d7fbdcdc7f15cd358f56d23bfb" },
|
||||
"glow.nvim": { "branch": "main", "commit": "5b38fb7b6e806cac62707a4aba8c10c5f14d5bb5" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "9637670896b68805430e2f72cf5d16be5b97a22a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "75c920883f44243f2bbb172be423e484a58f7c45" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "b808248f6a93ff4a2ed2932d68c6833ae167ecfc" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "0d9989d46cd2ae624858b94e529ee3e9d07773fd" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "de35012036d43bca03628d40d083f7c02a4cda3f" },
|
||||
"lsp-status.nvim": { "branch": "master", "commit": "54f48eb5017632d81d0fd40112065f1d062d0629" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "14f0c87db4c52d0b9e92d8c1a1fece10a00f6f91" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "2451adb9bdb0fd32140bf3aa8dbc17ff60050db3" },
|
||||
"lspsaga.nvim": { "branch": "main", "commit": "d76f9b736ef36840e0f35ce63ca4ad8e658c34eb" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "e2705063f395b44f676cd26596a11007a2cbd3bd" },
|
||||
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
|
||||
"neorg": { "branch": "main", "commit": "745715c873395840a5127413d1ef30a42735605e" },
|
||||
"neorg": { "branch": "main", "commit": "7d507d4fdd1c4a3cb8a8299a469d22190ebaf7f0" },
|
||||
"no-neck-pain.nvim": { "branch": "main", "commit": "6000e12d13188e008e9539085c24ff34794da40b" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
|
||||
"nvim-dap": { "branch": "master", "commit": "b3d4408e29d924fe130c9397a7c3b3630b3ea671" },
|
||||
"nvim-dap": { "branch": "master", "commit": "e79007c6d7a24db3ad19ea9196f1f0b2840e8ae7" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "34160a7ce6072ef332f350ae1d4a6a501daf0159" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "ede4114e1fd41acb121c70a27e1b026ac68c42d6" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" },
|
||||
"nvim-nu": { "branch": "main", "commit": "f45f36a97fb0ea6e39f08cc2fac7a2fb3dc3999b" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "af6b3ecea9b3cff18b9244027e23e7f2c34ebdd5" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "6edf3604354d482290400ce252f7848d3b70e61d" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "b844d3da4affb77fb2ba56ed235946f0ba0ab200" },
|
||||
"octo.nvim": { "branch": "master", "commit": "ffa4c4f9d6579039d772ae32c13083e0974fa31c" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "1d1c32b64b17b866152f29a3676a719cb6078028" },
|
||||
"nvim-treesitter-context": { "branch": "master", "commit": "4cf64264c049c55f256550ad247b606f3e53bc77" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" },
|
||||
"octo.nvim": { "branch": "master", "commit": "15e1c949bdc6f77b1296977a6a7dde5d06c6c004" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"rest.nvim": { "branch": "main", "commit": "f13ae54ae2545d4d612593d4a442cbb33a1b5b65" },
|
||||
"rest.nvim": { "branch": "main", "commit": "8b62563cfb19ffe939a260504944c5975796a682" },
|
||||
"ron.vim": { "branch": "master", "commit": "f749e543975a82e8dd9a6e7df9600a1c098ae800" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
|
||||
"sonokai": { "branch": "master", "commit": "17308ee6d9c764bfc1e0fa97213e7a99701b4144" },
|
||||
@@ -46,14 +46,14 @@
|
||||
"symbols-outline.nvim": { "branch": "master", "commit": "512791925d57a61c545bc303356e8a8f7869763c" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "62ea5e58c7bbe191297b983a9e7e89420f581369" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "ed9574dd6dde143d009b2528ea6d79bd34bbe6c8" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5a747a9587e4bfc4ae086a38cc679fe54f983b69" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "3094ead8edfa9040de2421deddec55d3762f64d1" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "0427b908ebefcb3701c7f2cfbdafa37d11afe71a" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "c80844fd52ba76f48fabf83e2b9f9b93273f418d" },
|
||||
"tree-sitter-just": { "branch": "main", "commit": "4e5f5f3ff37b12a1bbf664eb3966b3019e924594" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "3f85d8ed30e97ceeddbbcf80224245d347053711" },
|
||||
"vim-abolish": { "branch": "master", "commit": "cb3dcb220262777082f63972298d57ef9e9455ec" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "02219b557d4726a789be58c5d6bd6e139c46a9fe" },
|
||||
"vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" },
|
||||
"vim-commentary": { "branch": "master", "commit": "e87cd90dc09c2a203e13af9704bd0ef79303d755" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "99db68d9b3304580bd383da7aaee05c7a954a344" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" },
|
||||
"vim-mergetool": { "branch": "master", "commit": "0275a85256ad173e3cde586d54f66566c01b607f" },
|
||||
"vim-repeat": { "branch": "master", "commit": "24afe922e6a05891756ecf331f39a1f6743d3d5a" },
|
||||
"vim-speeddating": { "branch": "master", "commit": "5a36fd29df63ea3f65562bd2bb837be48a5ec90b" },
|
||||
|
||||
@@ -6,7 +6,7 @@ set -g @plugin 'wfxr/tmux-fzf-url'
|
||||
set -g @plugin 'kylepeeler/tmux-nightowl'
|
||||
set -g @nightowl-cpu-usage true
|
||||
set -g @nightowl-gpu-usage false
|
||||
set -g @nightowl-ram-usage true
|
||||
set -g @nightowl-ram-usage false
|
||||
set -g @nightowl-show-network true
|
||||
set -g @nightowl-show-powerline true
|
||||
set -g @nightowl-show-timezone false
|
||||
@@ -69,11 +69,4 @@ bind m send-keys -t.- 'mpcfzf' Enter
|
||||
bind o set status
|
||||
|
||||
bind-key -n C-\\ run-shell '~/.config/tmux/scratch'
|
||||
|
||||
|
||||
|
||||
if-shell 'uname | grep -q Darwin' { set -s copy-command 'pbcopy' }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user