vimpostor / vim-tpipeline

Embed your vim statusline in tmux
GNU General Public License v3.0
352 stars 10 forks source link
integration statusline tmux vim

vim-tpipeline

Embed your vim statusline in the tmux statusline!

Screenshot

Installation

Using vim-plug:

Plug 'vimpostor/vim-tpipeline'

It is highly recommended to put this in your ~/.tmux.conf:

set -g focus-events on
set -g status-style bg=default
set -g status-left-length 90
set -g status-right-length 90
set -g status-justify centre

Restart tmux and now you should see your vim statusline inside tmux.

vim-tpipeline is compatible with all statuslines and can be used together with other statusline plugins like lualine. If it doesn't work with yours, file a bug report.

Requirements

Configuration

This plugin will automatically embed your statusline in tmux with sane defaults. If you want to have more control over where it is placed, disable the autoconfiguration with g:tpipeline_autoembed and embed the statusline manually, here is one example:

" .vimrc
" You can also use Lua for configuration, see :h lua-vim-variables for help
let g:tpipeline_autoembed = 0
# .tmux.conf
set -g focus-events on
set -g status-style bg=default
set -g status-left '#(cat #{socket_path}-\#{session_id}-vimbridge)'
set -g status-left-length 90
set -g status-right '#(cat #{socket_path}-\#{session_id}-vimbridge-R)'
set -g status-right-length 90
set -g status-justify centre

By default vim-tpipeline will copy your standard vim statusline. If you want to use a different statusline just for tmux, you can set it manually:

" tpipeline comes bundled with its own custom minimal statusline
let g:tpipeline_statusline = '%!tpipeline#stl#line()'
" You can also use standard statusline syntax, see :help stl
let g:tpipeline_statusline = '%f'

There are many more options available to accomodate for every specific usecase. Check them out in the comprehensive help file using :help tpipeline-configure.

FAQ

But why?

Usually there is plenty of empty space available in your tmux statusline, hence you make much better use of your space if you put your vim statusline there. After all you don't want to have your carefully handcrafted vim config end up as a bad Internet Explorer meme, do you? meme_shitpost

Can I use the default tpipeline statusline outside of tmux as well?

Yes, use set stl=%!tpipeline#stl#line() in your ~/.vimrc. In fact this plugin uses Vim's autoload mechanism to lazily load features, i.e. if you don't use tmux, you can still use the statusline inside vim without loading unnecessary features.

Focus events are not working for me in tmux

Besides putting set -g focus-events on in your tmux config, you also need to have the XT-capability available, which you can test by issuing the tput XT command. If the capability is not present inside tmux, then there are three ways to fix the issue:

How do I stop the centered window list from flickering when changing panes?

Since tmux version 3.2 you can use absolute-centre instead of centre:

-set -g status-justify centre
+set -g status-justify absolute-centre

Why should I use this plugin over onestatus?