首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用于vim的python插件,如vim-r-plugin

用于vim的python插件,如vim-r-plugin
EN

Stack Overflow用户
提问于 2015-08-22 12:36:09
回答 3查看 827关注 0票数 3

作为一个坚定的VIM拥护者和R用户,我已经真正地享受了vim在Vim-R-插件中的相互作用。我一直很难找到这个版本的python。不存在吗?

我注意到了一个类似的问题,它显示了Python的Rstudio等效项,但我正在寻找这样的东西,它生活在.

编辑:特别是,我要找的东西

  • 有语法高亮
  • 有代码完成
  • 将允许我将代码从vim选项卡发送到python REPL。

下列情况下的奖金:

  • 它有一个对象浏览器(用于检查会话的变量)
  • 在vim选项卡中打开文档。
EN

回答 3

Stack Overflow用户

发布于 2016-01-25 14:47:06

另一种方法是使用screen vim插件。我更喜欢这一点,因为它避免了配置步骤。所以你要做的是:

  1. 安装screen vim插件
  2. .vimrc中创建一些方便的命令(参见下面添加的内容)
  3. 打开.py文件,点击<LocalLeader>p就可以了。请注意,您不必在打开TMUX文件之前打开.py

这就是我添加的内容(基于https://github.com/akhilsbehl/configs/blob/master/vimrc):

代码语言:javascript
复制
" 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>
票数 1
EN

Stack Overflow用户

发布于 2017-10-21 12:59:49

我相信它的功能并不像你所希望的那样全面,但是我刚刚发布了这个插件。

https://github.com/iago-lito/intim

  • 它围绕tmux会话,如sbstn所提供的。
  • 它还提供语法突出显示。
  • vim缓冲区中的帮助
  • 没有检查python对象,而是“热键”,它可以非常快地发送有关自定义python项的请求。

尝试一下,并毫不犹豫地在repo上提交您的第一个bug报告/特性请求:)

票数 1
EN

Stack Overflow用户

发布于 2016-01-20 11:14:36

到目前为止我发现的最好的是https://github.com/jpalardy/vim-slime

如何使用vim-slime

  1. 启动tmux
  2. 分成两个窗格
  3. 在一个窗格中使用vim打开脚本
  4. 切换到其他窗格
  5. 使用echo $TMUX_PANE获取tmux窗格的名称(需要7)
  6. 开放ipython
  7. :SlimeConfig中运行vim,保持套接字名称"default"并输入目标窗格,例如%14
  8. 使用C-c - C-c将代码从vim发送到ipython
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32156208

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档