Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

nushell/config.nu

Raw
use std/util "path add"

const NU_LIB_DIRS = [
    ($nu.default-config-dir | path join modules)
]

$env.WIN32 = ($nu.os-info.name =~ "windows")
$env.TERMUX = ($nu.os-info.name =~ "android")

$env.WORKSPACE = if $env.WIN32 { "~/Workspace" } else {
    "~/Workspace" | path expand
}
$env.DOTFILES = ($env.WORKSPACE | path join "dotfiles" | path expand)
$env.NOTES = ("~/Notes" | path expand)
$env.TOOLS = ("~/Tools" | path expand)
path add --append ($env.TOOLS | path join bin)

$env.CARGO_HOME = ("~/.cargo" | path expand)
path add --append ($env.CARGO_HOME | path join bin)
$env.GO_HOME = ("~/.go" | path expand)
path add --append ($env.GO_HOME | path join bin)
$env.NPM_CONFIG_PREFIX = ("~/.local/share/npm" | path expand)
path add (
    if $env.WIN32 { $env.NPM_CONFIG_PREFIX } else {
        $env.NPM_CONFIG_PREFIX | path join bin
    }
)

$env.DOT_LOCAL = ("~/.local" | path expand)
if not $env.WIN32 {
    path add --append ($env.DOT_LOCAL | path join bin)
}

if (not $env.WIN32) and ($env.XDG_RUNTIME_DIR? != null) {
    # make sure to start ssh-agent user service: userctl enable --now ssh-agent
    $env.SSH_AUTH_SOCK = $"($env.XDG_RUNTIME_DIR)/ssh-agent.socket"
}

$env.PI_TELEMETRY = true
# this seems to be ignored! duplicated in settings for now...
$env.PI_CODING_AGENT_SESSION_DIR = "~/.local/state/pi/sessions" | path expand
$env.PI_CACHE_RETENTION = "long"

if (which sccache | is-not-empty) {
    $env.RUSTC_WRAPPER = "sccache"
}

if (which nvim | is-not-empty) {
    $env.EDITOR = "nvim"
    $env.GIT_EDITOR = "nvim"
}

if (which neovide | is-not-empty) {
    $env.VISUAL = "neovide"
}

$env.LS_COLORS = "rs=0:di=1;34:ln=1;35:ex=1;32:bd=1;33;40:cd=1;33;40:pi=33:so=35:do=35:or=1;31:mi=1;37;41:su=37;41:sg=30;43:tw=30;41:ow=37;41:st=37;44:*.tar=1;31:*.tgz=1;31:*.zip=1;31:*.gz=1;31:*.xz=1;31:*.7z=1;31:*.rar=1;31:*.jpg=1;35:*.png=1;35:*.gif=1;35:*.bmp=1;35:*.mp4=1;33:*.mp3=1;33:*.flac=1;33:*.pdf=1;33:*.doc=1;33:*.docx=1;33:*.txt=0:*.md=0:*.c=1;34:*.cpp=1;34:*.h=1;34:*.java=1;34:*.py=1;34:*.sh=1;34:"

# Claude tweaking
# do not ask for feedback
$env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY = 1
# disable remote control
$env.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = 1
# no autoupdate
$env.DISABLE_AUTOUPDATER = 1
# Reduce splash screen size.
$env.IS_DEMO = 1

# Carapace bridges available on this system: bash.
# fish/zsh/inshellisense executables are not installed, so those bridges add no completions.
$env.CARAPACE_BRIDGES = "bash"
$env.CARAPACE_LENIENT = 1

$env.config.show_banner = false
$env.config.edit_mode = "vi"
$env.config.buffer_editor = "nvim"
$env.config.table.mode = "thin"
$env.config.rm.always_trash = (not $env.TERMUX)
$env.config.cursor_shape.vi_insert = "line"
$env.config.cursor_shape.vi_normal = "block"
$env.config.float_precision = 3
$env.config.shell_integration.osc133 = true
$env.config.highlight_resolved_externals = true
$env.config.use_kitty_protocol = (not $env.WIN32)
$env.config.history.file_format = "sqlite"
$env.config.history.isolation = true
$env.config.history.path = ($nu.data-dir | path join "history.sqlite3")

source ($nu.default-config-dir | path join "theme.nu")

# Generate aliases here so login.nu can source the evaluated file.
source ($nu.default-config-dir | path join "gen-aliases.nu")