有没有vim自动导入python库的插件?

发布于 2024-09-25 14:48:55 字数 1539 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

十秒萌定你 2024-10-02 14:48:55

ropevim。它也可以在 pypi 上使用

自动导入(添加缺少的导入)和组织导入(重新排序导入)功能运行良好,但有时有点侵入性(它将在您的项目中创建一个 .ropeproject 文件夹)。 Rope 代码补全也非常好,所以我使用带有 tab 的标准代码补全,当它不够时,我使用 ctrl-space 来使用 Ropevim 自动补全。

以下是我与 Ropevim 的一些映射:

" Rope AutoImport and OrganizeImport
nnoremap <C-S-o> :RopeOrganizeImports<CR>0<CR><CR>
nnoremap <C-S-i> :RopeAutoImport<CR>

" Rope AutoComplete
let ropevim_vim_completion = 1
let ropevim_extended_complete = 1
let g:ropevim_autoimport_modules = ["os.*","traceback","django.*","lxml.etree","lxml.*"]
imap <c-space> <C-R>=RopeCodeAssistInsertMode()<CR>

" Rope Menu
menu Python.Create\ Package :RopeCreatePackage<CR>
menu Python.Create\ Module :RopeCreateModule<CR>

There is ropevim. It is available on pypi as well

The autoimport (adds missing imports) and organizeimport (reorder imports) features work well, but it is a little invasive at times (it will create a .ropeproject folder in your project). Rope code completion is also quite good so I use standard code completion with tab, and when it's not enough, I use ctrl-space to use ropevim autocompletion.

Here are some of my mappings with ropevim:

" Rope AutoImport and OrganizeImport
nnoremap <C-S-o> :RopeOrganizeImports<CR>0<CR><CR>
nnoremap <C-S-i> :RopeAutoImport<CR>

" Rope AutoComplete
let ropevim_vim_completion = 1
let ropevim_extended_complete = 1
let g:ropevim_autoimport_modules = ["os.*","traceback","django.*","lxml.etree","lxml.*"]
imap <c-space> <C-R>=RopeCodeAssistInsertMode()<CR>

" Rope Menu
menu Python.Create\ Package :RopeCreatePackage<CR>
menu Python.Create\ Module :RopeCreateModule<CR>
小伙你站住 2024-10-02 14:48:55

您可以安装一个名为 mr.igor 的命令行工具。 pypi 页面上有将其连接到 vim 的说明:

http://pypi.python.org /pypi/mr.igor

There is a command line tool called mr.igor that you could install. There are instructions for hooking it up to vim on the pypi page:

http://pypi.python.org/pypi/mr.igor

裂开嘴轻声笑有多痛 2024-10-02 14:48:55

我正在使用 https://github.com/mgedmin/python-imports.vim 与古腾标记一起。对我来说足够好了(比没有好)。

I'm using https://github.com/mgedmin/python-imports.vim together with gutentags. Good enough for me (and better than nothing).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文