mirror of
https://github.com/RGBCube/ncc
synced 2025-07-29 19:17:45 +00:00
nushell: remove starship
This commit is contained in:
parent
cbd9d5c906
commit
6f97a03ae7
2 changed files with 82 additions and 50 deletions
|
@ -1,7 +1,7 @@
|
||||||
use std-rfc/clip
|
use std-rfc/clip
|
||||||
|
use std null_device
|
||||||
|
|
||||||
source ~/.config/nushell/zoxide.nu
|
source ~/.config/nushell/zoxide.nu
|
||||||
source ~/.config/nushell/starship.nu
|
|
||||||
|
|
||||||
# Retrieve the output of the last command.
|
# Retrieve the output of the last command.
|
||||||
def _ []: nothing -> any {
|
def _ []: nothing -> any {
|
||||||
|
@ -128,6 +128,86 @@ $env.config.float_precision = 2
|
||||||
$env.LS_COLORS = (open ~/.config/nushell/ls_colors.txt)
|
$env.LS_COLORS = (open ~/.config/nushell/ls_colors.txt)
|
||||||
$env.config.ls.use_ls_colors = true
|
$env.config.ls.use_ls_colors = true
|
||||||
|
|
||||||
|
do --env {
|
||||||
|
def prompt-header [
|
||||||
|
--left-char: string
|
||||||
|
]: nothing -> string {
|
||||||
|
let jj_workspace_root = try {
|
||||||
|
jj workspace root err> $null_device
|
||||||
|
} catch {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
let body = if ($jj_workspace_root | is-not-empty) {
|
||||||
|
let subpath = pwd | path relative-to $jj_workspace_root
|
||||||
|
let subpath = if ($subpath | is-not-empty) {
|
||||||
|
$"(ansi magenta_bold) → (ansi reset)(ansi blue)($subpath)"
|
||||||
|
}
|
||||||
|
|
||||||
|
$"(ansi light_yellow_bold)($jj_workspace_root | path basename)($subpath)(ansi reset)"
|
||||||
|
} else {
|
||||||
|
let pwd = if (pwd | str starts-with $env.HOME) {
|
||||||
|
"~" | path join (pwd | path relative-to $env.HOME)
|
||||||
|
} else {
|
||||||
|
pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
$"(ansi cyan)($pwd)(ansi reset)"
|
||||||
|
}
|
||||||
|
|
||||||
|
$"(ansi light_yellow_bold)($left_char)━━━(ansi reset) ($body)(char newline)"
|
||||||
|
}
|
||||||
|
|
||||||
|
$env.PROMPT_INDICATOR = $"(ansi light_yellow_bold)┃(ansi reset) "
|
||||||
|
$env.PROMPT_INDICATOR_VI_NORMAL = $env.PROMPT_INDICATOR
|
||||||
|
$env.PROMPT_INDICATOR_VI_INSERT = $env.PROMPT_INDICATOR
|
||||||
|
$env.PROMPT_MULTILINE_INDICATOR = $env.PROMPT_INDICATOR
|
||||||
|
$env.PROMPT_COMMAND = {||
|
||||||
|
prompt-header --left-char "┏"
|
||||||
|
}
|
||||||
|
$env.PROMPT_COMMAND_RIGHT = {||
|
||||||
|
let jj_status = try {
|
||||||
|
jj --quiet --color always --ignore-working-copy log --no-graph --revisions @ --template '
|
||||||
|
separate(
|
||||||
|
" ",
|
||||||
|
if(empty, label("empty", "(empty)")),
|
||||||
|
coalesce(
|
||||||
|
surround(
|
||||||
|
"\"",
|
||||||
|
"\"",
|
||||||
|
if(
|
||||||
|
description.first_line().substr(0, 24).starts_with(description.first_line()),
|
||||||
|
description.first_line().substr(0, 24),
|
||||||
|
description.first_line().substr(0, 23) ++ "…"
|
||||||
|
)
|
||||||
|
),
|
||||||
|
label(if(empty, "empty"), description_placeholder)
|
||||||
|
),
|
||||||
|
bookmarks.join(", "),
|
||||||
|
change_id.shortest(),
|
||||||
|
commit_id.shortest(),
|
||||||
|
if(conflict, label("conflict", "(conflict)")),
|
||||||
|
if(divergent, label("divergent prefix", "(divergent)")),
|
||||||
|
if(hidden, label("hidden prefix", "(hidden)")),
|
||||||
|
)
|
||||||
|
' err> $null_device
|
||||||
|
} catch {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
|
||||||
|
$jj_status
|
||||||
|
}
|
||||||
|
|
||||||
|
$env.TRANSIENT_PROMPT_INDICATOR = " "
|
||||||
|
$env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = $env.TRANSIENT_PROMPT_INDICATOR
|
||||||
|
$env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = $env.TRANSIENT_PROMPT_INDICATOR
|
||||||
|
$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = $env.TRANSIENT_PROMPT_INDICATOR
|
||||||
|
$env.TRANSIENT_PROMPT_COMMAND = {||
|
||||||
|
prompt-header --left-char "━"
|
||||||
|
}
|
||||||
|
$env.TRANSIENT_PROMPT_COMMAND_RIGHT = $env.PROMPT_COMMAND_RIGHT
|
||||||
|
}
|
||||||
|
|
||||||
$env.config.hooks.pre_prompt = []
|
$env.config.hooks.pre_prompt = []
|
||||||
|
|
||||||
$env.config.hooks.pre_execution = [
|
$env.config.hooks.pre_execution = [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{ config, lib, pkgs, ... }: let
|
{ config, lib, pkgs, ... }: let
|
||||||
inherit (lib) attrValues const enabled getExe mapAttrs mkIf optionalAttrs readFile removeAttrs replaceString;
|
inherit (lib) attrValues const disabled enabled getExe mapAttrs mkIf optionalAttrs readFile removeAttrs replaceString;
|
||||||
in {
|
in {
|
||||||
environment = optionalAttrs config.isLinux {
|
environment = optionalAttrs config.isLinux {
|
||||||
sessionVariables.SHELLS = getExe pkgs.nushell;
|
sessionVariables.SHELLS = getExe pkgs.nushell;
|
||||||
|
@ -26,31 +26,8 @@ in {
|
||||||
zoxide # For completions and better cd.
|
zoxide # For completions and better cd.
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
variables.STARSHIP_LOG = "error";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nixpkgs.overlays = [(self: super: {
|
|
||||||
starship = super.starship.overrideAttrs (old: {
|
|
||||||
src = self.fetchFromGitHub {
|
|
||||||
owner = "poliorcetics";
|
|
||||||
repo = "starship";
|
|
||||||
rev = "92aba18381994599850053ba667c25017566b8ee";
|
|
||||||
hash = "sha256-FKDvkDcxUPDLcjFQzvqsGXeJUm0Dq8TcA4edf5OkdWo=";
|
|
||||||
};
|
|
||||||
|
|
||||||
cargoDeps = self.rustPlatform.fetchCargoVendor {
|
|
||||||
inherit (self.starship) src;
|
|
||||||
hash = "sha256-nH1iYjKw/GbYKadoymH3onWBbMzuMUaRCSTNWVE+A9E=";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
|
||||||
pkgs.cmake
|
|
||||||
pkgs.zlib-ng
|
|
||||||
];
|
|
||||||
});
|
|
||||||
})];
|
|
||||||
|
|
||||||
home-manager.sharedModules = [(homeArgs: let
|
home-manager.sharedModules = [(homeArgs: let
|
||||||
homeConfig = homeArgs.config;
|
homeConfig = homeArgs.config;
|
||||||
in {
|
in {
|
||||||
|
@ -62,31 +39,6 @@ in {
|
||||||
"nushell/ls_colors.txt".source = pkgs.runCommand "ls_colors.txt" {} ''
|
"nushell/ls_colors.txt".source = pkgs.runCommand "ls_colors.txt" {} ''
|
||||||
${getExe pkgs.vivid} generate gruvbox-dark-hard > $out
|
${getExe pkgs.vivid} generate gruvbox-dark-hard > $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"nushell/starship.nu".source = pkgs.runCommand "starship.nu" {} ''
|
|
||||||
${getExe pkgs.starship} init nu > $out
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.starship = enabled {
|
|
||||||
# No because we are doing it at build time instead of the way
|
|
||||||
# this retarded module does it. Why the hell do you generate
|
|
||||||
# the config every time the shell is launched?
|
|
||||||
enableNushellIntegration = false;
|
|
||||||
|
|
||||||
settings = {
|
|
||||||
vcs.disabled = false;
|
|
||||||
|
|
||||||
command_timeout = 100;
|
|
||||||
scan_timeout = 20;
|
|
||||||
|
|
||||||
cmd_duration.show_notifications = config.isDesktop;
|
|
||||||
|
|
||||||
package.disabled = config.isServer;
|
|
||||||
|
|
||||||
character.error_symbol = "";
|
|
||||||
character.success_symbol = "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.direnv = enabled {
|
programs.direnv = enabled {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue