narajaon / onestatus

an api to customize tmux from vim
81 stars 1 forks source link

Clear filename and git branch on VimLeave #22

Closed zeitchef closed 3 years ago

zeitchef commented 3 years ago

Since I usually have multiple projects open in tmux at once, I'd like to not pollute my onestatus with filenames and git branches from other tmux windows if possible.

Is there a way to clear the filename and git branch in the status bar on VimLeave?

tusqasi commented 3 years ago

Can you try sourcing the default tmux config on Vimleave?

zeitchef commented 3 years ago

Indeed, this get's me about 95% there:

if !empty($TMUX)
    au BufEnter * :OneStatus
    au VimLeave * call system('tmux source-file ~/.tmux.conf')
    set noshowmode noruler noshowcmd cmdheight=1
    set laststatus=0
endif

The only problem is that for any Vim buffer open in any other tmux session, its information is then wiped out. I guess what I'm after is a per-session solution.

tusqasi commented 3 years ago

One thing I came up with is:

  1. Before onestatus sets tmux configuration save all default option to a file. That is achieved by using this command tmux show -g > tempfile.conf

  2. Now source this file on VimLeave

I am working on the implementation details right now. Let me know if find anything I am doing wrong.

The only problem is that for any Vim buffer open in any other tmux session, its information is then wiped out. I guess what I'm after is a per-session solution.

Note: tmux show -g get incomplete list of option for a complete list use:

tmux show -gw > tempfile.conf
tmux show -w >> tempfile.conf
narajaon commented 3 years ago

Hello, It's actually a good feature request, thanks. I added a new command :OneStatusClean that will allow to clean git branches, file names and cwd from your status bar here.

Now you can just: au VimLeave * :OneStatusClean

And as always, thanks for helping @tusqasi, I was very busy with work lately so I could not maintain this project.

zeitchef commented 3 years ago

@narajaon @tusqasi Thanks for your attention here! I can confirm this is behaving exactly as I expected. Cheers!