Compare commits

..

1 Commits

Author SHA1 Message Date
jolheiser b08df470b6
feat: omp->nix
Signed-off-by: jolheiser <git@jolheiser.com>
2024-10-22 22:47:17 -05:00
3 changed files with 34 additions and 36 deletions

View File

@ -393,7 +393,7 @@ $env.config = {
format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto format: "auto" # b, kb, kib, mb, mib, gb, gib, tb, tib, pb, pib, eb, eib, zb, zib, auto
} }
color_config: $dark_theme # if you want a light theme, replace `$dark_theme` to `$light_theme` color_config: $dark_theme # if you want a light theme, replace `$dark_theme` to `$light_theme`
footer_mode: 25 # always, never, number_of_rows, auto footer_mode: "25" # always, never, number_of_rows, auto
float_precision: 2 float_precision: 2
# 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 # 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
use_ansi_coloring: true use_ansi_coloring: true

View File

@ -1,9 +1,8 @@
{ pkgs, ... }: { pkgs, ... }:
let let
unicode = x: builtins.fromJSON ''"${x}"'';
script = pkgs.writeShellApplication { script = pkgs.writeShellApplication {
name = "jj-prompt"; name = "jj-prompt";
runtimeInputs = [ pkgs.jujutsu ]; runtimeInputs = [ pkgs.jj ];
text = text =
let let
bookmarkMax = 10; bookmarkMax = 10;
@ -11,26 +10,25 @@ let
descriptionMax = 24; descriptionMax = 24;
in in
'' ''
jj log -r@ -n1 --ignore-working-copy --no-graph --color never -T ' jj log -r@ -n1 --ignore-working-copy --no-graph --color always -T '
separate(" ", separate(" ",
bookmarks.map(|x| if( bookmarks.map(|x| if(
x.name().substr(0, ${builtins.toString bookmarkMax}).starts_with(x.name()), x.name().substr(0, ${builtins.toString bookmarkMax}).starts_with(x.name()),
"󰃀 " ++ x.name().substr(0, ${builtins.toString bookmarkMax}), x.name().substr(0, ${builtins.toString bookmarkMax}),
"󰃀 " ++ x.name().substr(0, ${builtins.toString (bookmarkMax - 1)}) ++ "") x.name().substr(0, ${builtins.toString (bookmarkMax - 1)}) ++ "")
).join(" "), ).join(" "),
tags.map(|x| if( tags.map(|x| if(
x.name().substr(0, ${builtins.toString tagMax}).starts_with(x.name()), x.name().substr(0, ${builtins.toString tagMax}).starts_with(x.name()),
"󰓹 " ++ x.name().substr(0, ${builtins.toString tagMax}), x.name().substr(0, ${builtins.toString tagMax}),
"󰓹 " ++ x.name().substr(0, ${builtins.toString (tagMax - 1)}) ++ "") x.name().substr(0, ${builtins.toString (tagMax - 1)}) ++ "")
).join(" "), ).join(" "),
surround("\"","\"",
if( if(
description.first_line().substr(0, ${builtins.toString descriptionMax}).starts_with(description.first_line()), description.first_line().substr(0, ${builtins.toString descriptionMax}).starts_with(description.first_line()),
"󰍡 " ++ description.first_line().substr(0, ${builtins.toString descriptionMax}), description.first_line().substr(0, ${builtins.toString descriptionMax}),
"󰍡 " ++ description.first_line().substr(0, ${ description.first_line().substr(0, ${builtins.toString (descriptionMax - 1)}) ++ ""
builtins.toString (descriptionMax - 1) )
}) ++ ""
), ),
"",
change_id.shortest(), change_id.shortest(),
commit_id.shortest(), commit_id.shortest(),
if(empty, "(empty)"), if(empty, "(empty)"),
@ -54,25 +52,25 @@ in
{ {
background = "p:lavender"; background = "p:lavender";
foreground = "p:black"; foreground = "p:black";
leading_diamond = unicode "\\ue0b6"; leading_diamond = "ue0b6";
properties = { properties = {
display_host = false; display_host = false;
}; };
style = "diamond"; style = "diamond";
template = " {{ if .SSHSession }}${unicode "\\udb80\\udf18"} {{ end }}{{ if .Env.IN_NIX_SHELL }}${unicode "\\udb84\\udd05"} {{ end }}{{ .UserName }}@{{ .HostName }} "; template = " {{ if .SSHSession }}U000f0318 {{ end }}{{ if .Env.IN_NIX_SHELL }}U000f1105 {{ end }}{{ .UserName }}@{{ .HostName }} ";
trailing_diamond = unicode "\\ue0b0"; trailing_diamond = "ue0b0";
type = "session"; type = "session";
} }
{ {
background = "p:orange"; background = "p:orange";
foreground = "p:black"; foreground = "p:black";
powerline_symbol = unicode "\\ue0b0"; powerline_symbol = "ue0b0";
properties = { properties = {
home_icon = "~"; home_icon = "~";
style = "folder"; style = "folder";
}; };
style = "powerline"; style = "powerline";
template = " ${unicode "\\ue613"} {{ path .Path .Location }} "; template = " ue613 {{ path .Path .Location }} ";
type = "path"; type = "path";
} }
{ {
@ -89,29 +87,29 @@ in
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}" "{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}"
"{{ if gt .Ahead 0 }}p:white{{ end }}" "{{ if gt .Ahead 0 }}p:white{{ end }}"
]; ];
powerline_symbol = unicode "\\ue0b0"; powerline_symbol = "ue0b0";
properties = { properties = {
branch_max_length = 25; branch_max_length = 25;
fetch_status = true; fetch_status = true;
fetch_upstream_icon = true; fetch_upstream_icon = true;
git_icon = unicode "\\ue702"; git_icon = "ue702";
github_icon = unicode "\\uf408"; github_icon = "uf408";
upstream_icons = { upstream_icons = {
"codeberg.org" = unicode "\\ue2a6"; "codeberg.org" = "ue2a6";
"git.jojodev.com" = unicode "\\udb83\\udd9e"; "git.jojodev.com" = "U000f0d9e";
"gitea.com" = unicode "\\udb83\\udd9e"; "gitea.com" = "U000f0d9e";
}; };
}; };
style = "powerline"; style = "powerline";
template = "{{ if not (glob \".jj\")}} {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} ${unicode "\\uf044"} {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} ${unicode "\\uf046"} {{ .Staging.String }}{{ end }} {{ end }}"; template = "{{ if not (glob \".jj\")}} {{ if .UpstreamURL }}{{ url .UpstreamIcon .UpstreamURL }} {{ end }}{{ .HEAD }}{{if .BranchStatus }} {{ .BranchStatus }}{{ end }}{{ if .Working.Changed }} uf044 {{ .Working.String }}{{ end }}{{ if .Staging.Changed }} uf046 {{ .Staging.String }}{{ end }} {{ end }}";
type = "git"; type = "git";
} }
{ {
background = "p:green"; background = "p:green";
foreground = "p:black"; foreground = "p:black";
powerline_symbol = unicode "\\ue0b0"; powerline_symbol = "ue0b0";
properties = { properties = {
script = "${script}/bin/jj-prompt"; inherit script;
}; };
style = "powerline"; style = "powerline";
template = "{{ if (glob \".jj\")}} {{ .Output }} {{ end }}"; template = "{{ if (glob \".jj\")}} {{ .Output }} {{ end }}";
@ -121,13 +119,13 @@ in
background = "p:blue"; background = "p:blue";
background_templates = [ "{{ if gt .Code 0 }}p:red{{ end }}" ]; background_templates = [ "{{ if gt .Code 0 }}p:red{{ end }}" ];
foreground = "p:black"; foreground = "p:black";
leading_diamond = "<transparent,background>${unicode "\\ue0b0"}</>"; leading_diamond = "<transparent,background>ue0b0</>";
properties = { properties = {
always_enabled = true; always_enabled = true;
}; };
style = "diamond"; style = "diamond";
template = " {{ if gt .Code 0 }}${unicode "\\uf00d"}{{ else }}${unicode "\\uf00c"}{{ end }} "; template = " {{ if gt .Code 0 }}uf00d{{ else }}uf00c{{ end }} ";
trailing_diamond = unicode "\\ue0b4"; trailing_diamond = "ue0b4";
type = "exit"; type = "exit";
} }
]; ];

View File

@ -869,11 +869,11 @@
"tailwind-ctp-lsp": "tailwind-ctp-lsp" "tailwind-ctp-lsp": "tailwind-ctp-lsp"
}, },
"locked": { "locked": {
"lastModified": 1729617923, "lastModified": 1729110754,
"narHash": "sha256-sMxbCVrHKMMZO5Rku8EL9lFGbnrwsCu6tO3Rr26a5tk=", "narHash": "sha256-OVGbwhFwzCv19PCLOOARE9BMdCbetrgZoGuFPRUg3n0=",
"ref": "refs/heads/main", "ref": "refs/heads/main",
"rev": "3a4e09a218dde7b4161a0b83276a73149e105d3f", "rev": "03fa43600d9b553892c395209efde8bc0a645b6c",
"revCount": 65, "revCount": 64,
"type": "git", "type": "git",
"url": "https://git.jolheiser.com/ugit.git" "url": "https://git.jolheiser.com/ugit.git"
}, },