Terminal specific tmux colors - tmux

I use tmux mainly on two different terminal emulators (st and konsole) and on the tty. I would like to customize the statusbar colors according to the terminal that I'm using. I know that there is a way to do it, but I'm not familiar with tmux config.

If they have different TERM you can use the client_termtype format, something like:
#{?#{m:st*,#{client_termtype}},#[bg=red]st,#[bg=blue]konsole}

Related

How to map Ctrl+Shift+<key> in Neovim + Tmux in Alacritty

I use neovim with tmux in alacritty and I'm currently tring to create keymaps to the combinations <C-S-h> and <C-S-l> (<S-h> and <S-l> are already mapped), but I can't get it to work when running tmux.
I've already followed this tutorial, but it only works outside of tmux. Is there some extra tmux configuration that I need to do in order to make this work?
I had the same behavior as you and got it to work both inside and outside tmux by changing the '5u' in chars to '6u' (7u and up did not work).

Is it possible to keep the output of less on the screen after quitting?

I'm using oh-my-zsh which pipes the output of some functions like git diff and git log into less, whilst this is great for reading the output in the terminal. If I need to refer back to it it isn't possible after quitting with :q
Is there an option to preserve the current view on the file in my terminal after quitting?
Secondly, If there is an option where would I need to edit my oh-my-zsh config to ensure anything piped to less passes this option?
To prevent less from clearing the screen on exit you can start it with the option -X:
less -X FILE
If you want to pass this option automatically to every instance of less, you can set the LESS environment variable accordingly in your ~/.zshrc:
export LESS="-X"
Note:
If your shell has syntax coloring enabled, the -X option will cause your less output to display those color change escape sequences as inline ESC text.
This can be fixed by also passing the raw-control-chars display option, -r. For example:
export LESS="-Xr"
This also includes instances where less is started by another program, for example man. If you want to disable this option for a single command, you can just prepend LESS=. For example
LESS= man less
For Git specifically, this can be handled with the following
git config --global color.ui true
git config --global core.pager 'less -Xr'

complete command's parameters with oh-my-zsh

Is there a way to make zsh complete parameters of commands (just like the fish shell do). For example, when I type ls -- and use TAB it will pop up a list of all ls parameters.
I know that I can use fish shell for this, and I know that fish shell is amazing, but there is a lot of missing functionalities in the fish shell. That's why I am looking to bring this parameter completion in zsh.
Try with single hyphen, like ls -. All built in commands are working fine. Btw for custom oh-my-zsh plugin autocompletion, it depends on plugin configuration.
oh-my-zsh has over 200 plugins for different commands. But unfortunately the auto completions are all hand made. So there will be never auto complete function for every command.

why the split line of tmux within putty shows different(xxxxx, qqqqqq)in these tow cases?

Why the split line of tmux within PuTTY shows different(xxxxx, qqqqqq)in these tow cases?
If I do not set PuTTY any thing(the default "Use font encoding"), the split line of pane shows like following:
But it can't show Chinese word correctly, so I set PuTTY's Window -> Translation -> Remote character set to UTF-8. Then the split line of pane become to like that:
Using “xxx qqqq” seems very ugly.
BTW: echo $LANG shows “zh_CN.UTF-8”
So, in this case, How to show Chinese word correctly with the first split line?
I had the same problem with Putty with character set set to UTF-8.
Launching tmux with -u option did the trick (tmux -u)
I was having the same issue except I was not trying to display Chinese characters. For the ugly line break ( xxxx qqqq), take a look at Tmux borders displayed as x q instead of lines?. For me, there are two version of tmux installed and switching to the newer version solves the problem. You may want to upgrade your tmux. Hope it helps.

Help with 'Terminator' config, or any tool that can do the same functionality

During developing a project I had to open multiple tabs in gnome-terminal, some of them as just output streams, others for the shell prompt.
Is their a way to automate this task.
Like running a script that automatically opens multiple terminals and run certain commands on each of them, and these terminals are displayed vertically or horizontally rather than in tabs ( or different windows ) like grid-display or something.
'Terminator' does exactly what I want, but I just can't configure it to work like what I want.
I don't get the 'Layout' thing
Here's part of my 'config' file:
[layouts]
[[default]]
[[[child1]]]
type = Terminal
parent = window0
position = left
[[[child2]]]
type = Terminal
parent = window0
position = left
[[[window0]]]
type = Window
parent = ""
When I run terminator, an error is printed out saying that I there's an incorrect number of children, and then 'terminator' appears normally with a single terminal.
I don't know what I'm doing wrong here, I would appreciate any help with 'Terminator' or with any tool that has the same functionality.
Thanks.
I think you have to try terminator a ruby gem that will help you to mange automation config files.
Terminitor automates your development workflow setup. Less time setting up, more time getting things done.
Also, an alternative is teamocil
Teamocil is a tool used to automatically create windows and splits in tmux with Ruby and YAML. Like tmuxinator, but with splits, not just windows.
Did you consider using 'screen' ? there is a 'split' command.
"CTRL+a, S" (Capital S) to create a new tab
"CTRL+a, Tab" to Switch to this tab
"CTRL+a, c" to create a new screen in this tab
Well, I suggest you to forget terminator (coming from a looong time terminator user) and learn to use a terminal multiplexer like tmux. There's a gem called tmuxinator that lets you configure sessions with YAML, so it's really, really easy.
For tmux I suggest you to start with the book «tmux: Productive Mouse-Free Development» from Brian Hoogan.
I have been working on a shell script to do exactly what you need
https://github.com/vahidhedayati/terminator-win-splitter
chmod to 755
./termcon.sh -h
./termcon.sh -c {connects to existing layouts - press enter and it will list your existing layouts }
./termcon.sh -f filename.txt {connects to servers listing within filename.txt and stores layout }
./termcon.sh -l prod ta ce cex {LISTS auto discovered nodes for ce cex in production env which have tomcat or apache in naming } }
./termcon.sh -a prod ta ce cex {Connects to auto discovered nodes for ce cex in production env which have tomcat or apache in naming and stores layout}
I am still working on windows split, it is quite complex but for now it does a 4 window split with no issues, when it is working and i emailed again it will just be a case of
./termcon.sh -w 8 -a prod ta ce cex
./termcon.sh -w 8 -f file.txt
I would also recommend if calling via a file then to name files according to server naming convention since once a layout is stored it won't overwrite it

Resources