From e58444da98c42889c753432ac52f15826e8d0cc8 Mon Sep 17 00:00:00 2001 From: elkowar Date: Sun, 11 May 2025 14:26:58 +0200 Subject: [PATCH] Some laptop changes --- eggs/niri/config.kdl | 4 +-- eggs/nushell/config.nu | 7 +++++ eggs/nushell/env.nu | 35 +++------------------- eggs/nushell/zoxide.nu | 60 +++++++++++++++++++++++++++++++++++++ eggs/nvim/lazyvim.json | 1 + eggs/zed/settings.json | 58 +++++++++++++++++++++++++++++++++++ eggs/zsh/.config/zsh/.zshrc | 16 ++++++---- 7 files changed, 142 insertions(+), 39 deletions(-) create mode 100644 eggs/nushell/config.nu create mode 100644 eggs/nushell/zoxide.nu diff --git a/eggs/niri/config.kdl b/eggs/niri/config.kdl index 0550005..a86445f 100644 --- a/eggs/niri/config.kdl +++ b/eggs/niri/config.kdl @@ -1,6 +1,6 @@ // vim:set ft=kdl shiftwidth=4 commentstring=//%s: debug { - keep-laptop-panel-on-when-lid-is-closed + // keep-laptop-panel-on-when-lid-is-closed } input { @@ -26,7 +26,7 @@ input { accel-speed -0.1 } trackpoint { - accel-speed -0.1 + accel-speed -0.4 } //warp-mouse-to-focus focus-follows-mouse max-scroll-amount="20%" diff --git a/eggs/nushell/config.nu b/eggs/nushell/config.nu new file mode 100644 index 0000000..52c7987 --- /dev/null +++ b/eggs/nushell/config.nu @@ -0,0 +1,7 @@ +$env.config = { + buffer_editor: "nvim", + show_banner : false, +} + +alias cr = cargo run + diff --git a/eggs/nushell/env.nu b/eggs/nushell/env.nu index 906fd3a..576ee1b 100644 --- a/eggs/nushell/env.nu +++ b/eggs/nushell/env.nu @@ -1,38 +1,11 @@ # Nushell Environment Config File # # version = "0.99.1" +# -def create_left_prompt [] { - let dir = match (do --ignore-shell-errors { $env.PWD | path relative-to $nu.home-path }) { - null => $env.PWD - '' => '~' - $relative_pwd => ([~ $relative_pwd] | path join) - } +source ($nu.default-config-dir | path join 'zoxide.nu') - let path_color = (if (is-admin) { ansi red_bold } else { ansi green_bold }) - let separator_color = (if (is-admin) { ansi light_red_bold } else { ansi light_green_bold }) - let path_segment = $"($path_color)($dir)(ansi reset)" - $path_segment | str replace --all (char path_sep) $"($separator_color)(char path_sep)($path_color)" -} - -def create_right_prompt [] { - # create a right prompt in magenta with green separators and am/pm underlined - let time_segment = ([ - (ansi reset) - (ansi magenta) - (date now | format date '%x %X') # try to respect user's locale - ] | str join | str replace --regex --all "([/:])" $"(ansi green)${1}(ansi magenta)" | - str replace --regex --all "([AP]M)" $"(ansi magenta_underline)${1}") - - let last_exit_code = if ($env.LAST_EXIT_CODE != 0) {([ - (ansi rb) - ($env.LAST_EXIT_CODE) - ] | str join) - } else { "" } - - ([$last_exit_code, (char space), $time_segment] | str join) -} # Use nushell functions to define your right and left prompt $env.PROMPT_COMMAND = {|| create_left_prompt } @@ -97,5 +70,5 @@ $env.NU_PLUGIN_DIRS = [ # path add ($env.HOME | path join ".local" "bin") # $env.PATH = ($env.PATH | uniq) -# To load from a custom file you can use: -# source ($nu.default-config-dir | path join 'custom.nu') +mkdir ($nu.data-dir | path join "vendor/autoload") +starship init nu | save -f ($nu.data-dir | path join "vendor/autoload/starship.nu") diff --git a/eggs/nushell/zoxide.nu b/eggs/nushell/zoxide.nu new file mode 100644 index 0000000..aa338b6 --- /dev/null +++ b/eggs/nushell/zoxide.nu @@ -0,0 +1,60 @@ +# Code generated by zoxide. DO NOT EDIT. + +# ============================================================================= +# +# Hook configuration for zoxide. +# + +# Initialize hook to add new entries to the database. +if (not ($env | default false __zoxide_hooked | get __zoxide_hooked)) { + $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 + })) +} + +# ============================================================================= +# +# 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] { + 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 --interactive -- ...$rest | str trim -r -c "\n")' +} + +# ============================================================================= +# +# Commands for zoxide. Disable these using --no-cmd. +# + +alias z = __zoxide_z +alias zi = __zoxide_zi + +# ============================================================================= +# +# Add this to your env file (find it by running `$nu.env-path` in Nushell): +# +# zoxide init nushell | save -f ~/.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.89.0+. diff --git a/eggs/nvim/lazyvim.json b/eggs/nvim/lazyvim.json index c2f2a2d..1b7f000 100644 --- a/eggs/nvim/lazyvim.json +++ b/eggs/nvim/lazyvim.json @@ -7,6 +7,7 @@ "lazyvim.plugins.extras.editor.telescope", "lazyvim.plugins.extras.lang.json", "lazyvim.plugins.extras.lang.markdown", + "lazyvim.plugins.extras.lang.nushell", "lazyvim.plugins.extras.lang.rust", "lazyvim.plugins.extras.lang.toml", "lazyvim.plugins.extras.util.mini-hipatterns" diff --git a/eggs/zed/settings.json b/eggs/zed/settings.json index 01930ba..85a65b7 100644 --- a/eggs/zed/settings.json +++ b/eggs/zed/settings.json @@ -22,6 +22,64 @@ // "always_treat_brackets_as_autoclosed": false, // "unstable.ui_density": "compact", "assistant": { + "always_allow_tool_actions": true, + "default_profile": "code", + "profiles": { + "code": { + "name": "Code", + "tools": { + "rename": false, + "thinking": true, + "terminal": true, + "symbol_info": true, + "read_file": true, + "open": true, + "now": true, + "list_directory": true, + "grep": true, + "find_path": true, + "fetch": true, + "edit_file": true, + "diagnostics": true, + "create_file": true, + "contents": true, + "code_symbols": true, + "code_actions": true, + "batch_tool": true + }, + "enable_all_context_servers": false, + "context_servers": {} + }, + "write": { + "name": "Write", + "tools": { + "open": true, + "batch_tool": true, + "code_actions": true, + "code_symbols": true, + "contents": false, + "copy_path": false, + "create_file": true, + "delete_path": false, + "diagnostics": true, + "edit_file": true, + "fetch": true, + "list_directory": true, + "move_path": false, + "now": true, + "find_path": true, + "read_file": true, + "grep": true, + "rename": false, + "symbol_info": true, + "terminal": true, + "thinking": true, + "web_search": true + }, + "enable_all_context_servers": true, + "context_servers": {} + } + }, "default_model": { "provider": "copilot_chat", "model": "claude-3-7-sonnet" diff --git a/eggs/zsh/.config/zsh/.zshrc b/eggs/zsh/.config/zsh/.zshrc index 0cf2be8..40a73b1 100644 --- a/eggs/zsh/.config/zsh/.zshrc +++ b/eggs/zsh/.config/zsh/.zshrc @@ -10,12 +10,6 @@ setopt SHARE_HISTORY source "$ZDOTDIR/utils.zsh" -if [ "$(hostname)" = "crabbix" ]; then - if command -v nu; then - exec nu - fi -fi - if [ ! -f "$HISTFILE" ]; then mkdir -p "$(dirname "$HISTFILE")" @@ -164,6 +158,7 @@ export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.bun/bin:$PATH" + export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" if [ -s "$NVM_DIR/nvm.sh" ]; then . "$NVM_DIR/nvm.sh" @@ -188,3 +183,12 @@ if [ -f '~/Downloads/google-cloud-sdk/completion.zsh.inc' ]; then . '~/Downloads [[ -f '/Applications/Tailscale.app/Contents/MacOS/Tailscale' ]] && alias tailscale="/Applications/Tailscale.app/Contents/MacOS/Tailscale" command -v jless >/dev/null && alias yless="jless --yaml" + + +## SWITCH TO NU SHELL +# if [ "$(hostname)" = "crabbix" ]; then +# if command -v nu; then +# exec nu +# fi +# fi +