For python development, I use slime with tmux and the following configuration
let g:slime_target = "tmux"
" configuration for vim in a split tmux window with a REPL in the other pane:
let g:slime_default_config = {"socket_name": "default", "target_pane": "{last}"}
For R I use NvimR which has some nice shortcuts based on the <localleader>
key. I developed some kind of muscle memory to those shortcuts and I sometimes use those shortcuts inside a python file. I managed to create the following two shortcuts and they work fine, I can send the current line or the current paragraph to tmux:
" Similar to NvimR's shortcut send line, but with Slime
autocmd FileType python nmap <LocalLeader>l <Plug>SlimeLineSend
" Shortcut to send the current paragraph with Slime
autocmd FileType python nmap <LocalLeader>p <Plug>SlimeParagraphSend
In vim-slime/plugin/slime.vim, I found that there is a SlimeRegionSend
command. Unfortunately trying to add a shortcut for selected text doesn't work
" Similar to NvimR's send selection, but with with slime
autocmd FileType python nmap <LocalLeader>s <Plug>SlimeRegionSend
My local leader key is ;
(it's under the middle finger below K on a French AZERTY keyboard). Entering my local leader key ;
followed by s, just replaces the selected text, which is the normal behavior of the s
substitute command. I would like instead ;s
to send the current selection to the tmux pane.