JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
16.73k stars 2.35k forks source link

[wish] TMUX status line integration #475

Open tigerinus opened 3 years ago

tigerinus commented 3 years ago

Prerequisites

Description

The only reason I am still staying with Powerline is its integration with TMUX. I've been looking for an alternative to Powerline + TMUX + bash for a long time, but no luck. OMP has a cross-shell prompt customizer seems to be promising. It'd be nice to support TMUX.

JanDeDobbeleer commented 3 years ago

@tigerinus what exactly do you mean by supporting TMUX? The way I understand it, TMUX is a multiplexer running a shell (which we already support).

tigerinus commented 3 years ago

@tigerinus what exactly do you mean by supporting TMUX? The way I understand it, TMUX is a multiplexer running a shell (which we already support).

TMUX has a customizable status line. The legacy powerline has a TMUX plugin that shares its segments within TMUX status line. See https://powerline.readthedocs.io/en/latest/usage/other.html#tmux-statusline

bewing commented 2 years ago

I'm interested in this as I'm currently only running powerline-daemon to render a tmux status line, and spent the last day or two of my vacation doing research.

Powerline supports a large amount of tmux versions -- 1.7 through 2.1+

tmux used to (pre-2.9) only support rendering a left bar, the window list (center), and a right bar. Powerline's default config was to statically set the window list coloring during init, and then tell tmux to call powerline every 2 seconds for the left and right bar lines, as separate commands. The default config only had the session name in the left bar, a powerline-like window list in the current colorscheme, and then uptime, load, time, date, and hostname in the right statusbar.

Newer tmux (2.9+) supports rendering the entire status line via the status-format array. By default, status-format[0] keeps with the tmux standard of the left bar, the window list, and the right bar, but this could be overwritten.

Given the current approach of posh regarding static shell inits without coloring information present, and only using the engine and renderer when rendering a status line, the best approach might be to only support tmux 2.9+ via the status-format line, and have tmux be a different "shell", with different config files for your standard shell and tmux. Then we could tell tmux to completely delegate status-format[0] (and perhaps other lines, in a multi-line format) to omp.

I'm happy to slowly work on this if there is interest in my copious spare time, but given my lack of familiarity with the current codebase, would welcome any advice or guidance regarding the above.

toolonely commented 2 years ago

Another example of prompt/vim/tmux integration would be promptline.vim / tmuxline.vim (both are on GitHub)

heaths commented 1 year ago

What might this look like for configuration? I too run powerline for the statusline support and works love to switch to OMP, but powerline supports different shells for different layouts. You certainly wouldn't want a typical shell e.g., pwsh or bash, layout in vim. Would we first need to add support for different configurations?

I suppose one way is just to point to a different config file when starting OMP from inside vim. Would likely need vim-specific segments, though.

JanDeDobbeleer commented 1 year ago

The main reason this one's still open is that the documentation on the subject is (for me at least) impossible to find. And I mean actual implementation examples.

hugo-ricateau commented 1 year ago

Perhaps it might be worth closing this issue in favour of a dedicated one per target tool. By the way, support for ipython prompt customisation would be similarly nice, and enable even more powerline users to migrate to oh-my-posh (event though hybrid configurations work, it is a bit cumbersome to setup).

Definitely not an official documentation, but the source code of the powerline projet might be of some help on these subjects.

For tmux, the following configuration guides might help as well: here, here or here; for ipython, there is fortunately an official documentation.

xborke commented 1 week ago

@tigerinus what exactly do you mean by supporting TMUX? The way I understand it, TMUX is a multiplexer running a shell (which we already support).

but seems like it is not possible to run TMUX in Windows Terminal Powershell, right?