tmux can not display vertical line when split vertical panel - putty

Environment:
Terminal Client
pietty 0.4.0(beta 14) (which is forked from putty)
putty 0.63
OS & tmux version
CentOS 6.5, tmux-1.6-3.el6.x86_64
ArchLinux, tmux 1.9_a-1
Strange behavior:
Split a vertical panel.
It won't display a vertical line between left and right panels.
When I click on right panels.
It display a vertical line.
Is there any method to let it always display vertical line?
My tmux.conf
set -g utf8
setw -g utf8 on
set-option -g mode-mouse on
set-option -g mouse-resize-pane on
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
# I've tried the following three settings, all failed.
set -g default-terminal "screen-256color"
#set -g terminal-overrides 'xterm*:smcup#:rmcup#'
#set -g default-terminal "linux"
And the TERM and locale variables inside tmux
$ echo $TERM
screen-256color
$ locale
LANG=en_US.utf8
LC_CTYPE=zh_TW.utf8

In putty/pietty, Turn off the option change settings/Window/Translation/Treat CJK ambiguous characters as wide

From the tmux man page:
The TERM environment variable must be set to ''screen'' for all programs run-ning
inside tmux. New windows will automatically have ''TERM=screen'' added
to their environment, but care must be taken not to reset this in shell
start-up files.
Maybe try changing this and see if it helps?
I've seen other users usually set this in their .tmux.conf so they also get color support:
set -g default-terminal 'screen-256color'

Related

tmux does not inherit $SHELL variable from shell launching tmux

After updating my /etc/shell file and typing a csh -s /usr/local/bin/zsh afterwards, I decided to quit and relaunch tmux with hope it will take account of my new $SHELL environment variable. Unfortunately, tmux still shows the old /bin/zsh after typing echo $SHELL.
How to tell tmux to inherit the $SHELL variable of the shell that launched it?
set-option -g default-shell "$SHELL_PATH"
in ~/.tmux.conf or /etc/tmux.conf. Works on arch.
You can reload the config file with : source-file e.g.
<C-b>: source-file ~/.tmux.conf
You would need to do it for every tmux instance. Otherwise you may restart
tmux with killall tmux; tmux
these commands will change the path of shell in tmux

Tmux will not stop auto-renaming windows

A problem I have with Tmux - in the .tmux.conf file I have told him not to rename windows after I set their names but it seems that it is not "respecting my authority" :).
My system:
OSX El Capitan
Tmux 2.1 (installed via Brew)
Zshell
Here is my ~/.tmux.conf content (I apologise it's quite long):
# set correct term
set -g default-terminal screen-256color
# set prefix key to ctrl+a
#unbind C-b
set -g prefix C-a
# reload config without killing server
bind R source-file /users/edchigliak/.tmux.conf
# enable wm window titles
set -g set-titles on
# disable auto renaming
set -g automatic-rename off
# border colour
set -g pane-border-fg blue
set -g pane-border-bg default
set -g pane-active-border-fg blue
set -g pane-active-border-bg default
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
# initialize sessions
bind S source-file ~/.tmux.conf
bind I source-file ~/.tmux.conf
# environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# statusbar --------------------------------------------------------------
set -g window-status-format "#I:#W"
set -g window-status-current-format "#I:#W"
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g status-interval 1
set -g status-justify centre # center align window list
# default statusbar colors
# wm window title string (uses statusbar variables)
set -g set-titles-string "tmux:#I [ #W ]"
# initialize sessions
bind S source-file ~/.tmux.conf
bind I source-file ~/.tmux.conf
# environment
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
# statusbar --------------------------------------------------------------
set -g window-status-format "#I:#W"
set -g window-status-current-format "#I:#W"
set -g status-keys vi
bind-key -t vi-edit Up history-up
bind-key -t vi-edit Down history-down
set -g status-interval 1
set -g status-justify centre # center align window list
# default statusbar colors
set -g status-fg white
set -g status-bg default
# default window title colors
set-window-option -g window-status-fg black
set-window-option -g window-status-bg default
set-window-option -g window-status-attr dim
# active window title colors
set-window-option -g window-status-current-fg white
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-attr dim
# command/message line colors
set -g message-fg white
set -g message-bg black
set -g message-attr bright
# Statusbar starting in X or not
# if '[ -n "$DISPLAY" ]' 'source-file ~/.tmux/inx'
# if '[ -z "$DISPLAY" ]' 'source-file ~/.tmux/xless'
If I try:
~ > echo $TERM
I get the correct:
screen-256color
which makes me believe that it is sourcing the right .conf file. Also, control key bindings DO change from Ctrl+b to Ctrl+a. However, window names that I change via Ctrl + a and then ,simply will not stay put.
Any ideas what is going on? Thanks!
A likely cause for this is, that zsh is configured to update the window title when starting a program or issuing the prompt. This is done by using the terminal escape sequence \ek<TEXT>\e\\ where <TEXT> is the window title.
To prevent this you have two options:
Disallow window renaming in the tmux configuration.
Just add
set allow-rename off
to your ~/.tmux.conf. This prevents any program from changing the window title by using the aforementioned terminal escape sequence.
Track down the setting in your zsh configuration and disable it.
If you are using oh-my-zsh, it should be enough to set
DISABLE_AUTO_TITLE="true"
in your ~/.zshrc (or just uncomment it, if you are using the default .zshrc template from oh-my-zsh).
If you use your own configuration or some other configuration framework, you should be able to track it down by searching for \ek (do not forget to quote the backslash if your search tool requires it).
For people running bash and landing on this result, the thing that sets the title is the PROMPT_COMMAND environmental variable, which some shared system annoyingly set. You can do that with unset PROMPT_COMMAND (e.g. in your .bashrc)
For this to work for me I had to add this line to ~/.tmux.conf
set-window-option -g allow-rename off

How to reload .com.apple.iokit.graphics underscan without restarting?

I'm looking into making a script that automatically turns off underscan when my Plex Home Theater.app is running.
So far I have found the file containing the setting at /var/db/.com.apple.iokit.graphics.
Then I tried changing the underscan value in the settings file with PlistBuddy:
# underscan 100%
sudo /usr/libexec/PlistBuddy /private/var/db/.com.apple.iokit.graphics -c 'Set "IOService\:/AppleACPIPlatformExpert/PCI0#0/AppleACPIPCI/IGPU#2/AppleIntelFramebuffer#2/display0/AppleDisplay-3dcb-e51:pscn" 8800'
# underscan off
sudo /usr/libexec/PlistBuddy /private/var/db/.com.apple.iokit.graphics -c 'Set "IOService\:/AppleACPIPlatformExpert/PCI0#0/AppleACPIPCI/IGPU#2/AppleIntelFramebuffer#2/display0/AppleDisplay-3dcb-e51:pscn" 10000'
But changing the file alone didn't apply the new underscan setting, so I tried restarting to see if the setting would take effect – it did.
So does anyone know how to change the underscan setting without restarting?
Thanks.

bash-completion (from Homebrew) not completing variables on OSX

I use bash completion all the time to save typing. However there is an oddity I am unable to figure out how to fix on OSX.
If I install bash-completion using Homebrew (brew install bash-completion) and set it up in .bashrc, the tab key will no longer complete environment variables. Without this installed, environment variable completion works as expected.
For example, I have shortcuts for all my SSH accounts for clients... instead of typing ssh myuser#somecrazydomain.com I can just type ssh $SSHCRAZY which is much easier to remember.
Expected behavior: In the built-in bash in OSX I can type ssh $SSHC and hit tab and it completes to the full command as expected. This is what I want.
Observed behavior: In bash using the homebrew bash-completion additions, hitting tab has no effect for environment variables.
Note: All other extensions added by the bash-completion project are desired (git command completion, etc). I don't want to uninstall it, I just want it to also work with environment variables.
Thanks in advance for any help!
You might consider using an SSH config file (~/.ssh/config) to set up your SSH shortcuts instead of using environment variables. You could put into that file:
Host crazy
HostName somecrazydomain.com
User myuser
Then you can just type ssh crazy.
I guess bash-completion must have defined completion rule for ssh. So try add the -o bashdefault option in your .bashrc. For example, if complete -p ssh output like this:
# complete -p ssh
complete -F _func ssh
#
then you can add this to your .bashrc (or .bash_profile):
complete -F _func -o bashdefault ssh
or
eval "$(complete -p ssh | sed 's/ssh$/-o bashdefault ssh/')"

How to stop making tmux auto setting RBENV_VERSION

tmux is auto setting RBENV_VERSION when I start tmux...
Anyone know how to stop it?
Because it auto sets it, I need to do
$ export RBENV_VERSION
to unset it and make .ruby-version work. Thx.
tmux itself will never set (or unset) RBENV_VERSION of its own accord. You have some bit of configuration that is causing this.
My guess is that RBENV_VERSION was set when you started your tmux server and that is is now part of the tmux “global environment” (the base environment inherited by all the processes started by tmux). You can check this
tmux show-environment -g | grep RBENV
If it is present there, you can delete it with this command:
tmux set-environment -gu RBENV_VERSION
If you often find yourself starting tmux when RBENV_VERSION is already set (and you do not want it sent “inside” tmux), then you can add the above command to your ~/.tmux.conf file to make sure that it is cleared every time you start a server.
Another possibility is that it is part of your tmux “session environment”; this environment is “layered” atop the global environment to form the environment that is inherited by the processes started for new windows and panes in a session. You can check it with this command (run it inside the session, or add -t sessname to specify a session):
tmux show-environment | grep RBENV
If this is present, you can unset it in a similar way:
tmux set-environment -u RBENV_VERSION
Finally, if the variable is not present in either the global or session environments, then it is probably coming from something in your shell initialization files. By default, tmux starts login shells, so be sure to check the corresponding bits of shell configuration (e.g. .bash_profile, .bash_login, .profile, etc.) as well as any other bits of initialization.

Resources