tmux homebrew C-B prefix not working on macosx - tmux

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+% ,...

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.

Cursor keys dont work in vim when running zsh on wsl through cmder or conemu

I'm running ubuntu 1804 on windows using the WSL. Everything is set up fine and works correctly. I've also installed ZSH and oh-my-zsh, again this is all good and everything looks like its working fine. Everything except the arrow keys whilst using vim or man pages or some other command line tools.
The up and down keys work on the command line when scrolling through history and also for select commands like nano. Also if I boot into bash rather than zsh the arrow keys do work in vim and man pages, in fact they work everywhere.
If i boot into bash, then switch to zsh on the command line manually the arrow keys then work everywhere.
So my cmder config for zsh
c:/_distros/ubuntu1804/ubuntu1804.exe -c zsh -cur_console:pm
and for bash
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pm:/mnt
The one for bash uses the conemu-cyg-64.exe program that comes from conemu which is a symbiont of POSIX enabled pty and WinAPI full-featured terminal.
Apparently you can use this tool with zsh but i cant manage to make it work i get the error
{PID:10592} failed to run shell (2): No such file or directory
{PID:10592} shell: `/usr/bin/zsh` `-l` `-i`
{PID:10592} dir: `/cygdrive/c/Program Files/cmder`
ConEmuC: Root process was alive less than 10 sec, ExitCode=0.
Press Enter or Esc to close console...
and this is the task in cmder
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe /usr/bin/zsh -l -i -cur_console:pm:/mnt
So I think that if i can boot into zsh using conemu-cyg-64 that the cursor keys will probably work in commands like vim and the man pages. Any help or advice getting that working would be brilliant.
EDIT:
On my ubuntu install zsh is installed at /usr/bin/zsh, but there is no file or folder /cygdrive/c/Program Files/cmder
Many thanks to #Maximus for pointing me in the right direction. The answer was right under my nose at the bash on windows page of conemu. A small change to the command i was using before. the zsh needs to go on the end rather than before the --wsl.
The correct task to ensure that cursor keys work on all apps in the terminal is:
set "PATH=%ConEmuBaseDirShort%\wsl;%PATH%" & %ConEmuBaseDirShort%\conemu-cyg-64.exe --wsl -cur_console:pnm:/mnt -t zsh -l

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"

Keybindings send the wrong escape sequences

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 )

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