jpalardy / vim-slime

A vim plugin to give you some slime. (Emacs)
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/
MIT License
1.83k stars 223 forks source link

How to send <Ctrl-C> via tmux? #389

Closed sieste closed 10 months ago

sieste commented 11 months ago

I want to be able to clear the current line or quit a running process in a tmux pane by sending the \<ctrl-c> shortcut from vim. Is that possible? I tried :SlimeSend1 <C-c> but it just sends the string "\<C-c>".

sieste commented 11 months ago

I figured it out with a bit of help from chatGPT. In my init.vim I added the line

nmap <silent> <c-c><c-x> ^Q^C<CR>

where ^Q is a special character entered in vim by typing Ctrl+q Ctrl+q in insert mode, and the ^C is entered with Ctrl+q Ctrl+c. Now the combination Ctrl-c Ctrl-x clears the current line or terminates a running process in the tmux pane. Apparently in some terminal emulators you have to use Ctrl-v instead of Ctrl-q to insert the key combinations.

jpalardy commented 11 months ago

If that helps, here's how I've configured some special sequences.