Being a staunch VIM advocate, and R user, I've grown to really enjoy the vim-tmux interplay in Vim-R-plugin. I've been having trouble finding a python version of this. Do none exist?
I've noted a similar question which shows Rstudio equivalents for Python, but I'm looking for something like this, that lives in vim....
Edit: In particular, I'm looking for something that
Bonus points if:
Another approach is using the screen vim plugin. I like that a little better because it avoids the config step. So here is what you do:
screen vim plugin.vimrc (see what I added below).py file, hit <LocalLeader>p and you are good to go. Note that you don't have to open TMUX before you open the .py file.This is what I added (based on https://github.com/akhilsbehl/configs/blob/master/vimrc):
" use tmux for splitting screen
let g:ScreenImpl = "Tmux"
" default width of tmux shell pane
let g:ScreenShellWidth = 82
" open an ipython shell (! for vertical split)
autocmd FileType python map <LocalLeader>p IPython!<CR>
" close whichever shell is running
autocmd FileType python map <LocalLeader>q :ScreenQuit<CR>
" send commands
" line
autocmd FileType python map <LocalLeader>r V:ScreenSend<CR>0j
" block
autocmd FileType python map <LocalLeader>b {jv}:ScreenSend<CR>}
" selection
autocmd FileType python map <LocalLeader>v :ScreenSend<CR>`>}0j
" convenience
autocmd FileType python map <LocalLeader>gw :call g:ScreenShellSend('!pwd')<CR>
autocmd FileType python map <LocalLeader>L :call g:ScreenShellSend('!clear')<CR>
autocmd FileType python map <LocalLeader>t :call g:ScreenShellSend('%%time')<CR>
autocmd FileType python map <LocalLeader>tt :call g:ScreenShellSend('%%timeit')<CR>
autocmd FileType python map <LocalLeader>db :call g:ScreenShellSend('%%debug')<CR>
autocmd FileType python map <LocalLeader>pr :call g:ScreenShellSend('%%prun')<CR>
" get ipython help for word under cursor
function GetHelp()
let w = expand("<cword>") . "??"
:call g:ScreenShellSend(w)
endfunction
autocmd FileType python map <LocalLeader>h :call GetHelp()<CR>
" get `dir` help for word under cursor
function GetDir()
let w = "dir(" . expand("<cword>") . ")"
:call g:ScreenShellSend(w)
endfunction
autocmd FileType python map <LocalLeader>d :call GetDir()<CR>
" get `len` for word under cursor
function GetLen()
let w = "len(" . expand("<cword>") . ")"
:call g:ScreenShellSend(w)
endfunction
autocmd FileType python map <LocalLeader>l :call GetLen()<CR>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With