ohmybash / oh-my-bash

A delightful community-driven framework for managing your bash configuration, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.
https://ohmybash.github.io
MIT License
6.01k stars 666 forks source link

How to use "U+e0b6" () at the beginning of the prompt? #538

Open moshpirit opened 8 months ago

moshpirit commented 8 months ago

I'd like to know if there's any way to achieve this, which I can get with Oh-my-posh, but couldn't find with Oh-my-bash:

akinomyoga commented 8 months ago

It depends on the theme, but I think no theme is currently supporting it. To show the character at the beginning of the prompt, You need to customize an existing theme by rewriting the implementation.

moshpirit commented 2 weeks ago

I've got this to work with this workaround on powerline.base.sh (although there's probably a better way to do this):

function __powerline_prompt_command {
  local last_status="$?" ## always the first
  local separator_char="${POWERLINE_PROMPT_CHAR}"

  # A new variable to put before the prompt. The '38;5;' tells the prompt to use a 256 colorbase. You can use the unicode of choice, like . See https://unicodes.jessetane.com/%EE%82%B6 for more options.
  CIRCLE="\[\033[38;5;${USER_INFO_THEME_PROMPT_COLOR}m\]\e[m"

  # Include the new variable here to be read.
  LEFT_PROMPT="$CIRCLE"
  SEGMENTS_AT_LEFT=0
  LAST_SEGMENT_COLOR=""

imagen

To get the other semi-circle at the other side, change this at powerline.theme.sh:

#! bash oh-my-bash.module

# source "$OSH/themes/powerline/powerline.base.sh"
source "$OSH_CUSTOM/themes/powerline/powerline.base.sh"

# This would change the latest part of the prompt from  to 
PROMPT_CHAR=${POWERLINE_PROMPT_CHAR:=""}

# This is just the separator. You can also use or 
POWERLINE_LEFT_SEPARATOR=${POWERLINE_LEFT_SEPARATOR:=""}

Now all I want to do is to remove these spaces haha imagen

EDIT: editing LEFT_PROMPT+="${separator}$(set_color - ${params[1]})${params[0]}${_omb_prompt_normal}" (removing the spaces) at function __powerline_in_vim_prompt {

moshpirit commented 1 week ago

Seems like my workaround brings a new issue: when moving the cursor makes the terminal to show 3 extra characters at the beginning of the command that were not supposed to be.

For example, when going back to the bash history, this pip part was added because I recently used it, but definitely not with ls. imagen

When pasting text weird things happen too, like adding htt at the beginning of the link (which is interesting, cause it's not at the beginning of the command): imagen