Open amrinder-cs opened 1 month ago
While a prompt viewer may be a challenge, there is the Themes wiki page: https://github.com/ohmybash/oh-my-bash/wiki/Themes
If you find any missing, feel free to add them.
I've added the themes
plugin over at https://github.com/ohmybash/oh-my-bash/pull/620 which gives you an easy way to switch between the themes.
Would be pretty cool to add to it and have a dynamic switcher.
I tried using the command echo -e $PS1 > file.txt
, but when I ran cat -e file.txt
, it printed gibberish like \u
and \w
instead of evaluating them.
What I need is a way to output my $PS1
variable as it appears in the terminal into files. Once I have that, the rest should be straightforward.
Here's a snippet I’m working with:
for file in *; do [ -f "$file" ] && head -n 1 "$file"; done | fzf --height 40% --info=inline --ansi
Or perhaps we can have the PS1's one in each line to make it simple, idk.
These files would contain the actual $PS1
values. The challenge I'm facing is figuring out how to get those $PS1
values correctly.
I tried using the command
echo -e $PS1 > file.txt
,
You can use printf '%s\n' "${PS1@P}" > file.txt
You can use
printf '%s\n' "${PS1@P}" > file.txt
Thanks a lot, so far i've come up with:fzf --height 40% --info=inline --preview "printf '%s' \"${PS1@P}\""
currently it just shows the current theme in the preview section, but with that omb theme implemented, i guess we can have a theme switcher, which takes in the arguments from the {+} (as theme name ) and switch the theme before preview.
However im very unsure about how to switch theme, tried foolishly setting export OSH_THEME="whatever"
but it didnt work , ,
So i did OSH_THEME=random and manually saved the files with theme names, and added preview via fzf:
However i think we could have something better than this, need suggestions
Okay i might sound too ambitious with this, but i believe we could have a theme viewer/selector to select the theme we need.
Like a small tool which can help us choose the theme which suits us the best, it could be something fzf based which shows us the bash PS1 in each line and we should be able to simply select it .
Here's kinda what i mean:
But instead of showing simply the theme names, it should show the different available bash prompts.
It can be a nice QOL update. I'm a bash noob honestly and im not very familiar with oh-my-bash code, but i wish someone would help me make it :pleading_face: