Tmux not using my Powerline characters - tmux

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.

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

tmux attach and current working directory

I have as on single command "new" in my $HOME/.tmux.conf so I can call tmux attach as a command automatically using ssh. Recently (I believe since version 2.7) I am seeing a strange effect that if I use "tmux attach" and I do not have a session running a new session is started as expected (as I have the new command in my .tmux.conf) but the current working directory is "." if I use echo $PWD. If I use tmux without arguments to create a new session anyways I get a normal $PWD, in my case it is $HOME as I always call tmux right after logging in.
This wreaks havoc with a few shell scripts, for example the mvim script is not able to open any files in macvim any longer. If I use "cd $HOME" after using tmux attach for the first time when it created a new default session it works OK. Does anybody have any clue on how to fix that without issuing "cd $HOME"?
I just found that tmux version 2.8 fixes the problem.

Why isn't my ZSH shell not changing the prompt?

I was using bash before switching to zsh.
On my ~/.zsh I have export PS1="\w ~ " but it is not making those changes to reflect the prompt. I want my prompt to show something like Documents/Rails_App/views ~
I have opened a new tab and closed re-opened the app.
The first level prompt of Zsh can be set in with either PROMPT, prompt or PS1.
Zsh uses other escapes than Bash. Most notably do they start with % not \. The equivalent to Bash's \w would be %~.
So just putting setting the following line in your ~/.zshrc should do the trick:
PROMPT='%~ ~'
Note: There is (usually) no need to export PROMPT in Zsh - or Bash for that matter.
If it does not work for you, it most likely has to do with Oh-My-Zsh as it already provides its own settings for PROMPT. So you have to make sure that you set PROMPT after Oh-My-Zsh has been sourced.
If you used the template that came with Oh-My-Zsh it should be after this line:
source $ZSH/oh-my-zsh.sh
On Debian distro.
After installing zsh from standard source apt install zsh comment #prompt adam1 inside .zshrc file and reload settings source ~/.zshrc.
Now add custom prompt: PROMPT='Greetings %n '
Image: zsh custom prompt
Use _PROMPT in zsh:
export _PROMPT='%d ~ '

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