oh-my-posh icon indicating copy to clipboard operation
oh-my-posh copied to clipboard

[wish] TMUX status line integration

Open tigerinus opened this issue 3 years ago • 7 comments

Prerequisites

  • [x] I have read and understand the CONTRIBUTING guide
  • [x] I looked for duplicate issues before submitting this one

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.

tigerinus avatar Mar 02 '21 18:03 tigerinus

@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).

JanDeDobbeleer avatar Mar 02 '21 20:03 JanDeDobbeleer

@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

tigerinus avatar Mar 02 '21 20:03 tigerinus

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.

bewing avatar Oct 01 '21 23:10 bewing

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

toolonely avatar Jun 03 '22 16:06 toolonely

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.

heaths avatar Nov 30 '22 16:11 heaths

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.

JanDeDobbeleer avatar Jan 14 '23 09:01 JanDeDobbeleer

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.

hugo-ricateau avatar Jan 16 '23 09:01 hugo-ricateau