I am trying to bind some keys to some certain commands in my .tmux.conf. The commands are as follows

bind-key C-c send-keys -t right \
"import os;clear = lambda: os.system('clear');clear()\;" \; send-keys -t right C-m 

I am getting the following error, when I run tmux.

.tmux.conf:75 Unknown Error \

I am currently running oh-my-zsh on mac-osx, in the background, and I am not sure why am I getting this error.

P.S. My tmux configuration

  • Basically it is throwing an error after "import os;clear = lambda: os.system('clear');clear()\;" at \; – Palash Ahuja Aug 1 '18 at 18:41
  • I have also tried adding C-m at the end like this bind-key C-c send-keys -t right "import os; clear = lambda: os.system('clear'); clear();' C-m . It gives the error Unknown-Command C-m then also. – Palash Ahuja Aug 1 '18 at 18:51
  • Could you give some context as to the problem you're trying to solve? Clear the screen? That looks like python... how exactly is python invoked? – Tom Hale May 13 '19 at 5:00

I have found a solution, but I just don't like it though

bind-key C-c run-shell "tmux send-keys -t right \"import os;clear=lambda: 
os.system('clear'); clear()\"; 
tmux send-keys -t right C-m;"

For some reason I don't know why is this not working

bind-key C-c send-keys -t right "import os;clear=lambda: 
os.system('clear'); clear();" C-M

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.