Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
moshpirit opened this issue Mar 3, 2024 · 3 comments
Open

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

moshpirit opened this issue Mar 3, 2024 · 3 comments

Comments

@moshpirit
Copy link

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
Copy link
Contributor

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
Copy link
Author

moshpirit commented Oct 27, 2024

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 moshpirit reopened this Nov 3, 2024
@moshpirit
Copy link
Author

moshpirit commented Nov 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants