nushell and prompt play
This commit is contained in:
parent
8f62ae3202
commit
4f7d109a37
5 changed files with 82 additions and 27 deletions
|
@ -1,6 +1,12 @@
|
|||
|
||||
$env.config.completions.external.completer = $fish_completer
|
||||
$env.LS_COLORS = (vivid generate one-dark)
|
||||
$env.TRANSIENT_PROMPT_COMMAND = ^starship module character
|
||||
$env.TRANSIENT_PROMPT_INDICATOR = ""
|
||||
$env.TRANSIENT_PROMPT_INDICATOR_VI_INSERT = ""
|
||||
$env.TRANSIENT_PROMPT_INDICATOR_VI_NORMAL = ""
|
||||
$env.TRANSIENT_PROMPT_MULTILINE_INDICATOR = ""
|
||||
$env.TRANSIENT_PROMPT_COMMAND_RIGHT = ^starship module time
|
||||
|
||||
def --env doomup [...args] {
|
||||
doom sync ...$args
|
||||
|
@ -9,7 +15,7 @@ def --env doomup [...args] {
|
|||
}
|
||||
|
||||
def --env lla [...args] {
|
||||
ls -alm ...$args | select name size type mode
|
||||
ls -alm ...$args | select name type size modified mode user group
|
||||
}
|
||||
|
||||
# def --env pullall [] {
|
||||
|
@ -19,3 +25,40 @@ def --env lla [...args] {
|
|||
def pdf-compress [...args] {
|
||||
gs -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dNOPAUSE -dBATCH -sOutputFile=output.pdf $args
|
||||
}
|
||||
|
||||
def nh-switch-gc [...args] {
|
||||
nh os switch; nh clean all --keep 3 --nogcroots; nix store optimise;
|
||||
}
|
||||
|
||||
def "nu-complete zoxide path" [context: string] {
|
||||
let parts = $context | str trim --left | split row " " | skip 1 | each { str downcase }
|
||||
let completions = (
|
||||
^zoxide query --list --exclude $env.PWD -- ...$parts
|
||||
| lines
|
||||
| each { |dir|
|
||||
if ($parts | length) <= 1 {
|
||||
$dir
|
||||
} else {
|
||||
let dir_lower = $dir | str downcase
|
||||
let rem_start = $parts | drop 1 | reduce --fold 0 { |part, rem_start|
|
||||
($dir_lower | str index-of --range $rem_start.. $part) + ($part | str length)
|
||||
}
|
||||
{
|
||||
value: ($dir | str substring $rem_start..),
|
||||
description: $dir
|
||||
}
|
||||
}
|
||||
})
|
||||
{
|
||||
options: {
|
||||
sort: false,
|
||||
completion_algorithm: substring,
|
||||
case_sensitive: false,
|
||||
},
|
||||
completions: $completions,
|
||||
}
|
||||
}
|
||||
|
||||
def --env --wrapped z [...rest: string@"nu-complete zoxide path"] {
|
||||
__zoxide_z ...$rest
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
nu_scripts
|
||||
];
|
||||
|
||||
programs.nushell = {
|
||||
enable = true;
|
||||
shellAliases = {
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
"$schema" = 'https://starship.rs/config-schema.json'
|
||||
|
||||
format = "$env_var$all$line_break$character"
|
||||
format = "$env_var$shell$all$line_break$character"
|
||||
right_format = ""
|
||||
|
||||
[shell]
|
||||
fish_indicator = ' '
|
||||
nu_indicator = 'nu'
|
||||
style = "#aaaaaa"
|
||||
format = '[$indicator ]($style) '
|
||||
disabled = false
|
||||
|
||||
[env_var.yazi_level]
|
||||
description = "Indicate the shell was launched by `yazi`"
|
||||
variable = "YAZI_LEVEL"
|
||||
# 🦆: U+1f986 Duck
|
||||
# Alternatively: " ": U+E795 <Private Use>
|
||||
symbol = "🦆"
|
||||
format = '[ $symbol ]($style)'
|
||||
symbol = ""
|
||||
style = "yellow"
|
||||
format = '[$symbol ]($style)'
|
||||
|
||||
[directory]
|
||||
truncation_length = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue