blob: 771ab8ed33ee7b7068368b751d80858b946e0682 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
{ config, lib, pkgs, ...}: with lib; let
cfg = config.santi-modules;
in {
options.santi-modules.nushell.enable = mkEnableOption "Enable nushell as the default shell";
config = mkIf cfg.nushell.enable {
users.users.leonardo.shell = pkgs.nushell;
home-manager = {
users.leonardo = {
programs.direnv.enableNushellIntegration = true;
programs.nushell = {
enable = true;
settings = {
show_banner = false;
};
extraConfig = ''
module vprompt {
# Complete escape sequence based on environment
def complete-escape-by-env [
arg: string # argument to send
] {
let tmux: string = (if ($env.TMUX? | is-empty) { '''''' } else { $env.TMUX })
let term: string = (if ($env.TERM? | is-empty) { '''''' } else { $env.TERM })
if $tmux =~ "screen|tmux" {
# tell tmux to pass the escape sequences through
$"\ePtmux;\e\e]($arg)\a\e\\"
} else if $term =~ "screen.*" {
# GNU screen (screen, screen-256color, screen-256color-bce)
$"\eP\e]($arg)\a\e\\"
} else {
$"\e]($arg)\e\\"
}
}
def create_left_prompt [] {
${pkgs.starship}/bin/starship prompt --cmd-duration $env.CMD_DURATION_MS $'--status=($env.LAST_EXIT_CODE)'
}
# Output text prompt that vterm can use to track current directory
export def left-prompt-track-cwd [] {
$"(create_left_prompt)(complete-escape-by-env $'51;A(whoami)@(hostname):(pwd)')"
}
}
use vprompt
$env.PROMPT_COMMAND = {|| vprompt left-prompt-track-cwd }
$env.PROMPT_COMMAND_RIGHT = ""
$env.PROMPT_INDICATOR = ""
'';
};
};
};
};
}
|