Tmux current pane indicator when focus regained - tmux

I'm trying to create a visual indicator of which pane is currently focused in tmux when my terminal (iterm2, OSX) window gains focus. I have found that iterm2 sends a focus gained escape sequence (^[[I) so now I am trying to find how I can capture that and fire the prefix q command which shows pane numbers with the active pane in red.
Any ideas on how to capture the escape sequence in tmux OR in iterm2?

I have a partial solution to my issue which takes a different approach. Since I usually have vim and one terminal pane open, dimming vim when it is not focussed is a good indicator which pane is active. In order to achieve this I have modified the vim-diminactive plugin to react to focus events (https://github.com/blueyed/vim-diminactive/pull/8), this requires the Vitality.vim plugin as well as enabling (focus-events) in tmux options.
In order to completely solve my issue I am working on changing the background colour of terminal panes when they lose focus. I use zsh so I can capture the focus event with bindkey (I have verified this works) to issue a background colour change escape code to iterm2, however this seems to have no effect in tmux.

Related

how to disable the scroll function when I use the tmux?

Tmux uses the scroll to find the history commands which bothers me too much.
How to disable this function? I have tried to use "set mouse on", but it gives me another problem. I just want to disable my mouse all the time, with the scroll leaves its original usage.
Tmux no longer has multiple options for mouse mode, there is just mouse on or off (assuming a recent version of tmux).
If you want to use the mouse, including the scroll wheel, for anything except scrolling history, mouse mode must be on (set -g mouse on). Turning on the mouse should not prevent you from not using your mouse to accomplish things; the default tmux key functionality remains.

tmux use mouse only to resize panes

In new versions of tmux, I know that I can use set -g mouse on to enable mouse support in order to be able to resize panes with the mouse.
But it also enable a feature that I do not want which is using copy mode when I select text in the terminal. In that way I am no more able to copy text in the system clipboard in order to paste it outside of tmux.
My question is: is there a way to enable resizing panes with the mouse, which very handy, without having to enable mouse support for other things?
Because there in no answer, I will try to answer myself:
Apparently there is no way to do this, since when a mouse event is intercepted by tmux, it cannot be forwarded to the system. I say this but it is pure deduction, I have no knowledge about that.
As an alternative, there is a way to prevent tmux to intercept the mouse, by holding a key like "fn" on Mac OS.

How do you 'jump to definition' in a fresh install of LightTable, without setting your hair on fire

I tried ctrl- which was suggested somewhere online, but that makes the font smaller. (ctrl+ though does not undo that, so I had to restart LightTable to get back to normal).
Pressing ctrl enter I can manage to write and use "jump to definition", but obviously I will not be going through that every time....
If this should have helped, it is rather confusing what the period and comma here mean:
So do the built-in default keyboard shortcuts allow that, and how do they allow increasing font size?
Hit cmd/ctrl + enter
in the pane that this brought in: type "jump to" to see the command "jump to...", plus its keyboard shortcut. you can select the command from there but that would suck if it were the only way to invoke commands, so observer the keyboard binding you get there: (in the blue circles below)
notice that keys are separated by dashes in the display of the keyboard shortcut, so do not actually enter a dash because it is not part of the command and you will be doing crazy stuff if you assume otherwise
same thing for finding out how to zoom: enter "zoom" in that pane
unset you hair on fire
Courtesy of #rundis from the gitter channel...

Tmux and copy mode with release mouse button

I'm using tmux for the first time as a replacement for iterm (mostly because of the split panels function) and it works great. Now, i have a question about the copy-text behaviour.
It's possible to configure tmux, so i can select text with the left button (in copy mode) and it's automatically copied (to the clipboard) when i release the left button? (same as in irc clients)
Tmux’s select behavior will depend on your mouse settings. If mode-mouse is off, Tmux should stay out of the way. But, by default, it may be set to “on”. Then it will use its own “paste buffer”. To bypass that, you can hold down shift while selecting and pasting. (This works on Linuxes, but probably on Mac, too; not sure what OS you’re on.)

Is it possible to add tab-like functionality to tmux panes?

I generally use tmux with 3-4 panes open. One of these panes is rarely used, so I'd be happy to hide it away somewhere. I suppose I could do this in a new window, but I'd rather hide it "behind" an existing pane.
For example, I'd like to keep rails server running in the background because I rarely need to refer to it, so guard occupies that pane instead. When I need to look at the rails server output, I'll switch to the guard pane and then "tab" over to the rails server.
At least, that's the ideal situation, but I can't figure out how to achieve it.
Tmux currently does not provide the functionality of 'hiding' panes.
For now, the closest tmux comes to hiding panes is the 'pane zoom' functionality. It is toggled with prefix + z. When 'on', the pane is resized to 100% of the window and all the other panes are hidden. Setting the pane zoom to 'off' unhides the hidden panes.
That said, I think the 'zoom' functionality is not ideal for your use case. Other have pointed it out: just using a new window that doesn't get in your way might do the trick and is a simple solution.
You should be able to do this using break-pane and join-pane - see this question on Unix&Linux.
i am not sure what is in your mind of the concept "tab"; however, from what you want, a window is more than enough.
Imagine you have a "tab" in tmux, then, you more or less have to switch to that tab in order to see the output, so, the operation is exactly the same with window of tmux.
Normally, I type <c-x> c to have a new window, and then go back to the main workspace (the previous window) with <c-x> p and open my vim there to work. I might have multiple panes on my main workspace with tmux pane (not with vim pane, cos i need to have the terminal always to navigate). Then after I change things, save, just type another <c-x> p to go to the server and see what happen there
(note that I bind <c-b> to <c-x>)

Resources