From 095b092e080bfdf5de0e95aafe3d7ef60a0c8627 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sat, 15 Jun 2024 11:23:56 +0800 Subject: [PATCH] feat: adjust nushell --- flake.lock | 6 ++-- home/base/core/shells/config.nu | 29 ++++++++++++++++++- home/base/core/shells/default.nix | 3 +- .../neovim/nvim/lua/plugins/treesitter.lua | 4 +++ home/base/tui/shell.nix | 4 +-- modules/darwin/apps.nix | 7 +++-- modules/nixos/desktop/misc.nix | 3 +- 7 files changed, 45 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index 7b8bf34d..26d11697 100644 --- a/flake.lock +++ b/flake.lock @@ -1177,11 +1177,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1718333206, - "narHash": "sha256-eilG1IDuHUiTCiE7gx+UbtbRPjSiEi600zg/eZeDIuw=", + "lastModified": 1718376599, + "narHash": "sha256-cTFGqLYTrIxORc673fUUCecQVXiXHDj6Z8vFQ5K4SDg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1740b0f87b1c4ff0ed5a499c0109fb71e7b6fd78", + "rev": "3bac01780f87646b70326db70920902bc4d49fab", "type": "github" }, "original": { diff --git a/home/base/core/shells/config.nu b/home/base/core/shells/config.nu index 40bcaa54..f57efdd5 100644 --- a/home/base/core/shells/config.nu +++ b/home/base/core/shells/config.nu @@ -115,6 +115,33 @@ $env.config = { # buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL bracketed_paste: true # enable bracketed paste, currently useless on windows edit_mode: emacs # emacs, vi - shell_integration: true # enables terminal markers and a workaround to arrow keys stop working issue + shell_integration: { + # osc2 abbreviates the path if in the home_dir, sets the tab/window title, shows the running command in the tab/window title + osc2: true + # osc7 is a way to communicate the path to the terminal, this is helpful for spawning new tabs in the same directory + osc7: true + # osc8 is also implemented as the deprecated setting ls.show_clickable_links, it shows clickable links in ls output if your terminal supports it. show_clickable_links is deprecated in favor of osc8 + osc8: true + # osc9_9 is from ConEmu and is starting to get wider support. It's similar to osc7 in that it communicates the path to the terminal + osc9_9: false + # osc133 is several escapes invented by Final Term which include the supported ones below. + # 133;A - Mark prompt start + # 133;B - Mark prompt end + # 133;C - Mark pre-execution + # 133;D;exit - Mark execution finished with exit code + # This is used to enable terminals to know where the prompt is, the command is, where the command finishes, and where the output of the command is + osc133: true + # osc633 is closely related to osc133 but only exists in visual studio code (vscode) and supports their shell integration features + # 633;A - Mark prompt start + # 633;B - Mark prompt end + # 633;C - Mark pre-execution + # 633;D;exit - Mark execution finished with exit code + # 633;E - NOT IMPLEMENTED - Explicitly set the command line with an optional nonce + # 633;P;Cwd= - Mark the current working directory and communicate it to the terminal + # and also helps with the run recent menu in vscode + osc633: true + # reset_application_mode is escape \x1b[?1l and was added to help ssh work better + reset_application_mode: true + } render_right_prompt_on_last_line: false # true or false to enable or disable right prompt to be rendered on last line of the prompt. } diff --git a/home/base/core/shells/default.nix b/home/base/core/shells/default.nix index 1a2dc205..93470796 100644 --- a/home/base/core/shells/default.nix +++ b/home/base/core/shells/default.nix @@ -1,4 +1,4 @@ -let +{pkgs-unstable, ...}: let shellAliases = { k = "kubectl"; @@ -11,6 +11,7 @@ in { programs.nushell = { enable = true; + package = pkgs-unstable.nushell; configFile.source = ./config.nu; inherit shellAliases; }; diff --git a/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua b/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua index 3d597783..b2e8080f 100644 --- a/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua +++ b/home/base/tui/editors/neovim/nvim/lua/plugins/treesitter.lua @@ -3,6 +3,10 @@ ---@type LazySpec return { "nvim-treesitter/nvim-treesitter", + dependencies = { + -- NOTE: additional parser + { "nushell/tree-sitter-nu" }, + }, opts = function(_, opts) opts.incremental_selection = { enable = true, diff --git a/home/base/tui/shell.nix b/home/base/tui/shell.nix index a5c2a79e..0cb23973 100644 --- a/home/base/tui/shell.nix +++ b/home/base/tui/shell.nix @@ -31,9 +31,9 @@ in { use ${nu_scripts}/share/nu_scripts/custom-completions/cargo/cargo-completions.nu * use ${nu_scripts}/share/nu_scripts/custom-completions/zellij/zellij-completions.nu * # alias - use ${nu_scripts}/share/nu_scripts/aliases/git/git-aliases.nu * + # use ${nu_scripts}/share/nu_scripts/aliases/git/git-aliases.nu * use ${nu_scripts}/share/nu_scripts/aliases/eza/eza-aliases.nu * - # use ${nu_scripts}/share/nu_scripts/aliases/bat/bat-aliases.nu * + use ${nu_scripts}/share/nu_scripts/aliases/bat/bat-aliases.nu * ''; }; } diff --git a/modules/darwin/apps.nix b/modules/darwin/apps.nix index 8b0b0a66..eaf765b8 100644 --- a/modules/darwin/apps.nix +++ b/modules/darwin/apps.nix @@ -2,6 +2,7 @@ config, lib, pkgs, + pkgs-unstable, ... }: ########################################################################## @@ -80,7 +81,7 @@ in { programs.zsh.enable = true; environment.shells = [ pkgs.zsh - pkgs.nushellFull # my custom shell + pkgs-unstable.nushell # my custom shell ]; # homebrew need to be installed manually, see https://brew.sh @@ -103,7 +104,7 @@ in { Wechat = 836500024; QQ = 451108668; WeCom = 1189898970; # Wechat for Work - TecentMetting = 1484048379; + TecentMeeting = 1484048379; QQMusic = 595615424; }; @@ -164,7 +165,7 @@ in { # Misc "shadowsocksx-ng" # proxy tool "iina" # video player - "raycast" # (HotKey: alt/option + space)search, caculate and run scripts(with many plugins) + "raycast" # (HotKey: alt/option + space)search, calculate and run scripts(with many plugins) "stats" # beautiful system status monitor in menu bar # "reaper" # audio editor "sonic-pi" # music programming diff --git a/modules/nixos/desktop/misc.nix b/modules/nixos/desktop/misc.nix index 333010d7..5838684d 100644 --- a/modules/nixos/desktop/misc.nix +++ b/modules/nixos/desktop/misc.nix @@ -2,12 +2,13 @@ config, lib, pkgs, + pkgs-unstable, ... }: { # add user's shell into /etc/shells environment.shells = with pkgs; [ bashInteractive - nushellFull + pkgs-unstable.nushell ]; # set user's default shell system-wide users.defaultUserShell = pkgs.bashInteractive;