Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ctrl-z to suspend vim inside of tmux not working

So, I'm getting into using tmux, coming from GNU screen. Vim is my editor of choice. Often I find it useful to use Ctrl+Z to suspect Vim to get to my shell. I do this in screen easily. There I have my prefix key rebound to Ctrl+Z, so hitting Ctrl+Z+Z sends a SIGSTOP to Vim, and I'm in the shell. A simple "fg" jumps me back, all without leaving screen.

Now, in tmux this does not work for me. I've tried the default Ctrl+B prefix, rebinding to Ctrl+Z and unbinding the z "toggle pane zoom" option in tmux in case that conflicted. The only thing that works is hitting Prefix-Ctrl-Z sends SIGSTOP to tmux, suspending it, but I don't want that. I want the SIGSTOP to go to Vim.

I am on Debian Jessie using i3 as my window manager, and I can't find any conflicting keybindings, so I am open to suggestions on how to get this working.

Thanks.

like image 799
Michael Soulier Avatar asked May 19 '17 16:05

Michael Soulier


1 Answers

From the symptoms, it sounds like you may be missing the last line in ~/.tmux.conf:

unbind C-b
set -g prefix C-z
bind-key z send-prefix

Without it, C-z z doesn't send C-z. This is different than screen, where escape ^ZZ performs all these at once.

like image 124
ephemient Avatar answered Oct 31 '22 19:10

ephemient