basecamp / omakub

Opinionated Ubuntu Setup
https://omakub.org
5.5k stars 480 forks source link

Prompt tooling: Oh My Posh #126

Closed csfh closed 3 months ago

csfh commented 5 months ago

I have a PR already to customize prompts but I figured it may be a lot of ground to cover for us to satisfy everyone in an easy way.

Just like mise is an all-in-one option for installing various language runtimes and compilers, Oh My Posh has the potential to do the same but for prompt. Of course with some beautiful, sane and curated defaults.

https://ohmyposh.dev

dhh commented 5 months ago

I like the idea of this. And having a curated set of default prompts to pick from too. I like mine super minimal, and leaning on zellij for path, but I think it's a great place for some personalization too. Please do explore.

dimitrismistriotis commented 4 months ago

If allowed to suggest an alternative, I really liked + using: https://starship.rs which looks to have similar targets with Oh My Posh, "to work with any shell".

JxJxxJxJ commented 4 months ago

Yeah I use starship and I think it could go very well with omakub. Specially if the themes get changed for it as well image

florentdestremau commented 4 months ago

did the same on my custom post-omakub template

curl -sS https://starship.rs/install.sh | sh
starship preset pure-preset -o ~/.config/starship.toml
dimitrismistriotis commented 4 months ago

did the same on my custom post-omakub template

curl -sS https://starship.rs/install.sh | sh
starship preset pure-preset -o ~/.config/starship.toml

This is the uninstall:

# Locate and delete the starship binary
sh -c 'rm "$(command -v 'starship')"'

Plus removal from shell configuration

Source: https://starship.rs/faq/

dhh commented 4 months ago

I explored Starship at length, but never did come up with a prompt that felt worth the space it took up when running under Zellij where the path is in the pane. If someone wants to propose some potential prompts that don't feel redundant like that, I'd be happy to consider, though.

florentdestremau commented 4 months ago

image I don't like (force of habit probably) having to read the path in the pane, the pure implementation seems very ok to me!

dimitrismistriotis commented 4 months ago

If one wants to remove path:

https://starship.rs/config/

format = '$all'

# Which is equivalent to
format = """
$username\
$hostname\
$localip\
$shlvl\
...

Can use format and remove $directory\

Tried:

image

  1. My default
  2. With "directory" out
  3. Removed "on" from branch as it looks too verbose

Above can be achieved with the following configuration:

# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'

format = """
$username\
$hostname\
$localip\
$shlvl\
$singularity\
$kubernetes\
$vcsh\
$fossil_branch\
$fossil_metrics\
$git_branch\
$git_commit\
$git_state\
$git_metrics\
$git_status\
$hg_branch\
$pijul_channel\
$docker_context\
$package\
$c\
$cmake\
$cobol\
$daml\
$dart\
$deno\
$dotnet\
$elixir\
$elm\
$erlang\
$fennel\
$gleam\
$golang\
$guix_shell\
$haskell\
$haxe\
$helm\
$java\
$julia\
$kotlin\
$gradle\
$lua\
$nim\
$nodejs\
$ocaml\
$opa\
$perl\
$php\
$pulumi\
$purescript\
$python\
$quarto\
$raku\
$rlang\
$red\
$ruby\
$rust\
$scala\
$solidity\
$swift\
$terraform\
$typst\
$vlang\
$vagrant\
$zig\
$buf\
$nix_shell\
$conda\
$meson\
$spack\
$memory_usage\
$aws\
$gcloud\
$openstack\
$azure\
$nats\
$direnv\
$env_var\
$crystal\
$custom\
$sudo\
$cmd_duration\
$line_break\
$jobs\
$battery\
$time\
$status\
$os\
$container\
$shell\
$character"""

# Inserts a blank line between shell prompts
add_newline = true

# Replace the '❯' symbol in the prompt with '➜'
[character] # The name of the module we are configuring is 'character'
success_symbol = '[➜](bold green)' # The 'success_symbol' segment is being set to '➜' with the color 'bold green'

# Disable the package module, hiding it from the prompt completely
[package]
disabled = true

[line_break]
disabled = true

[battery]
full_symbol = "• "
charging_symbol = "⇡ "
discharging_symbol = "⇣ "
unknown_symbol = "❓ "
empty_symbol = "❗ "

[erlang]
symbol = "ⓔ "

[nodejs]
symbol = "[⬢](bold green) "

[pulumi]
symbol = "🧊 "

[typst]
symbol = "t "

[python]
format = "[$virtualenv]($style) "

[git_branch]
format = "[$symbol$branch(:$remote_branch)]($style)"
csfh commented 4 months ago

Going to be taking a closer look at this issue this weekend. Really appreciate the conversation.

JxJxxJxJ commented 4 months ago

Yeah, it's fully customizable. No need to see anything you don't like. Personally I think the most potential is in the theming aspect, specially in sync with the color scheme scripts

csfh commented 4 months ago

I'd support if anyone else wants to attempt integrating either omp or starship. The key integration point being changing along with the themes of omakub.

dimitrismistriotis commented 4 months ago

I can give a stab at starfhish with everything except theming. I can write here a small gap analysis of what I believe should be done.

dimitrismistriotis commented 4 months ago

Theming: https://starship.rs/advanced-config/#style-strings

dhh commented 3 months ago

I like what starship is doing, but I don't see any default prompt that I'd prefer to have in Omakub. So I think we should just leave this as something that people can pursue themselves. We could add a pointer to the docs, though.