Keybindings send the wrong escape sequences - zsh

I use tmux with zsh, and all keybindings are broken. Example: Ctrl-p sends ^P. I tried to add setw -g xterm-keys on in my .tmux.conf but that didn't solve the problem. I also tried to source the .tmux.conf file manually and to set the option directly from within tmux but that didn't do the trick either.
I could rebind all keys to their respective actions from ZSH (which I tried for Ctrl-r and it worked), but that's tedious...
I installed tmux (version 1.9_a-1) and zsh (version 5.0.5) using pacman in ArchLinux.
Is that a known bug? How can I solve the problem please?

I kind of managed to fix the problem by aliasing tmux to EDITOR= VISUAL= tmux (thanks to this comment: How to force emacs-style status-keys in tmux?). But I still do not understand why I should do this. This seems like a bug...

I use the following two options in my ~/.tmuxrc and don't play any games with neither EDITOR nor VISUAL. That way I don't have to rely on the defaults but tell tmux explicitly which key emulation I want.
set -g mode-keys emacs
set -g status-keys emacs

Stumbled upon the same issue. The problem is zsh; it's trying to be smart the same way as tmux.
My solution is to set the key binding to emacs while keeping EDITOR=vim.
export EDITOR='vim'
bindkey -e
References:
http://zshwiki.org/home/zle/bindkeys
Why isn't Control-R working (anymore)?
You are probably in vi-Mode, because you have set $EDITOR or $VISUAL to something starting with
'vi'.
http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Keymaps
If one of the VISUAL or EDITOR environment variables contain the
string ‘vi’ when the shell starts up then it will be ‘viins’,
otherwise it will be ‘emacs’.
The mode-keys and status-keys options of tmux are for its own (copy/scroll mode and its command prompt )

Related

Tmux split window command not working after brew upgrade

I wanted to run 'brew update' but run 'brew upgrade'.
After that, my tmux stop working on some functionalities.
For example, I cannot split windows. I have already tried using shortcut (Prefix-%), terminal command (tmux split-window), or tmux command (Prefix-:split-window). Sometimes the terminal divides the window for a fraction of time and then the new pane fades out. Sometimes nothing happens.
If tmux is detached, I can attach with tmux attach but some other commands are not working. For example, if I run tmux new-session -As "foo", it returns the string [exit] and if I inspect the return (echo $?), it returns 0.
I have already tried to run tmux without any configuration in case my tmux.conf have some problems. But when I run tmux -f /dev/null, it returns the string [exit] and if I inspect the return (echo $?), it returns 0.
The problem is that I am not sure if the problem is with tmux itself (it was upgraded to 3.2a - and I did not remember which version it was before) or if the problem is with another program or with the fact I am running with Mac M1 processor, that causes me problems in a bunch of situations.
I have already tried to downgrade tmux but there are not many materials on how to do that I the ones that I tried did not work. So I give up, especially because I was not sure if this would solve the problem.
In summary, I need some help at least to know how to best debug the problem.
Thanks!
I had the exact same problem and could fix it by just restarting my tmux session. Dettaching and reattaching is not enough.

Tmux not using my Powerline characters

I have been trying to update tmux and add Powerline character support in it. I am currently using oh-my-zsh with 'agnoster' theme and powerline characters and prompt are getting displayed as they should but when i start tmux session, those character on prompt disappears and _ is replaced with them.What can i do to rectify it.
My tmux.conf
Using ubuntu 16.04
Output of echo $TERM is screen-256color.
Not using tmux-powerline as it's no longer maintained.
I have also tried reinstalling Powerline.
Instead of source "/usr/local/lib/python2.7/dist-packages/powerline/bindings/tmux/powerline.conf" you should use run 'powerline-config tmux setup', which should do all the automagic for you without explicily naming paths. You can give it a try by simply executing it in your shell after starting tmux.

tmux homebrew C-B prefix not working on macosx

I am new to tmux. I use screen for remote session. After reading a few tutorials online I am very surprise. So I want to give it a try as tmux is easier to use and more customizable for me as a developer.
I am on macosx sierra and install tmux via homebrew but after creating a session I used C-B prefix command for example C-B % to split but it did not work.
Can anyone tell me how to debug this or is there any setting for this to work?
ps: I also try a few combination cmd+b+% ,...

Start 'tmux' before Vim. The X Window system is required to run R in an external terminal

I am using a previous version of Vim-R-Plugin and pretty comfortable about its settings. Recently I upgraded the Linux system and got message never before "Start 'tmux' before Vim. The X Window system is required to run R in an external terminal.". The issue is, if I start tmux manually, the vim background were also changed weirdly and further ,rc will start a R console in a split window rather than a new window. Does somebody know the reasons and how to fix it?
This is due to styles and handling of tmux 'emulated terminal'.
At first try to simply run
tmux -2
If it does not help try add in ~/.tmux.conf:
set -g default-terminal "screen-256color"

Can't plot in R from tmux

I'm able to plot() in R from a regular terminal, but I can't do so from a tmux pseudo-tty. png() works fine but I can't write to the monitor.
UPDATE: Sorry, there's no error message. R merely fails to "print" to the monitor.
UPDATE 2: ctrl+b :showenv returns
DISPLAY=:0
SSH_AGENT_PID=1786
-SSH_ASKPASS
SSH_AUTH_SOCK=/tmp/ssh-ebteUtjL1719/agent.1719
-SSH_CONNECTION
WINDOWID=18928777
XAUTHORITY=/home/me/.Xauthority
fix in R
Sys.getenv('DISPLAY')
Sys.setenv("DISPLAY"=":0.0")
X11()
qplot(...)
.Devices
device.list()
should do it.
fix in tmux
You can also type Ctrl+b, :setenv DISPLAY :0.0 to change it from tmux rather than from R.
Why does this happen?
It might have to do with where you open the tmux (virtual terminal versus GNOME terminal) when you initially run the command tmux to initiate the session manager.
It's good to echo $DISPLAY in the terminal and Sys.getenv("DISPLAY") in R. See stuff like https://unix.stackexchange.com/questions/31283/error-in-r-unable-to-open-connection-to-x11
You can also run capabilities() in R and if capabilities()$X11 == FALSE then that's what to work on fixing.
I messed around for a while and then was able to do X11(); qplot( my.ggplot ). Check ?X11 for a little more information too.
It would help if you included the error message, but it sounds like your DISPLAY environment variable isn't set properly inside tmux. Issue echo $DISPLAY from outside your tmux session, and make sure DISPLAY is set to the same thing inside tmux.
You can use the update-environment command in tmux to configure tmux so that it automatically updates particular tmux environment variables with their values from the external environment. See the tmux manpage for details, or search the web for "tmux update-environment" for various other pages that describe this feature.

Resources