tmuxline.vim icon indicating copy to clipboard operation
tmuxline.vim copied to clipboard

No indication that Prefix was pressed

Open amiryal opened this issue 10 years ago • 6 comments

Hi,

Sorry, I don’t know enough about vimscripts and tmux configuration to submit a patch myself. I noticed during the brief period I was using the Powerline tmux theme, that the background colour of the session name changes when the Prefix is pressed and waiting for a shortcut key. Would that be easy to implement in tmuxline.vim?

amiryal avatar Dec 07 '14 21:12 amiryal

I didn't know about this feature of tmux. I'll do some research.

I guess it will be simple to add such feature once I know the details about it.

edkolev avatar Dec 15 '14 08:12 edkolev

Found it! In tmux 1.9a, the variable client_prefix is 1 if prefix key has been pressed. More ideas: visualise all window_*_flag variables, or simply use #F if it pleases the eye enough.

amiryal avatar Dec 15 '14 08:12 amiryal

I'll check it out.

Powerline seems to got this functionality here https://github.com/powerline/powerline/pull/863

I'll try to come up with a version which would not break under older tmux versions

edkolev avatar Dec 15 '14 21:12 edkolev

I used tmuxline.vim as a starting point then heavily customized my theme. I was able to add prefix support as follows:

set -g status-left "#{?client_prefix,#[fg=colour235]#[bg=colour12]#[bold] PREFIX#[nobold] #{session_name}@#{host} #[fg=colour12]#[bg=colour239]▶,#[fg=colour235]#[bg=colour246] #{session_name}@#{host} #[fg=colour246]#[bg=colour239]▶}"
set -ga status-left "#[fg=colour246,bg=colour239] #{pane_title} #[fg=colour239,bg=colour237,nobold,nounderscore,noitalics]▶"
set -ga status-left "#[fg=colour246]#[bg=colour237] "

set -g status-right "#[fg=colour237,bg=colour237,nobold,nounderscore,noitalics]◀#[fg=colour246,bg=colour237] #(tmux-mail)#{cpu_percentage}#{cpu_icon} "
set -ga status-right "#[fg=colour239,bg=colour237,nobold,nounderscore,noitalics]◀#[fg=colour246,bg=colour239]#{battery_percentage}#{battery_icon} #{battery_remain} #(tmux-wifi)#{online_status}#[fg=colour246,bg=colour239] #[nobold]#[nounderscore]#[noitalics]"
set -ga status-right "#{?client_prefix,#[fg=colour12]#[bg=colour239]◀#[fg=colour235]#[bg=colour12] %H:%M %a %d-%b %Z ,#[fg=colour246]#[bg=colour239]◀#[fg=colour235]#[bg=colour246] %H:%M %a %d-%b %Z }"

The results match my airline + gruvbox vim theme nicely: No prefix (vim normal mode): https://gyazo.com/809890dd1b87fe6c9e48bfca5e028ddf Prefix (vim insert mode): https://gyazo.com/de186db4e46c36d6a06add3c246a7dce

Note that I break my statusline settings into multiple parts for easier readability with set status-left -ga. Effectively the same as one long status-left/right command.

adrianluff avatar Aug 01 '16 16:08 adrianluff

I added this to my snapshot: I created a snapshot with vim-airline, and another one with airline_visual the alternative colors im using inside the ?client_prefix are the colors used by airline_visual (with my current theme, mind you)

set-option -g status-left "#[fg=colour232,bg=colour154,bold]#{?client_prefix,#[fg=colour232]#[bg=colour214],} #S:#I.#P #[fg=colour154,bg=colour235,nobold,nounderscore,noitalics]#{?client_prefix,#[fg=colour214]#[bg=colour234],}"

normal visual

RedGreatApe avatar Oct 28 '16 10:10 RedGreatApe

Hi edkolev,

How has the work on this feature been going? It has been a while since this thread was posted.

phongvcao avatar Jun 10 '19 22:06 phongvcao