【问题标题】:How to set neovim to run a qt-console如何设置 neovim 运行 qt-console
【发布时间】:2021-04-30 19:30:19
【问题描述】:

我正在尝试为 python 编程配置 neovim。我找到了this article,关于如何将 qt-console 连接到以 neovim 作为编辑器的 python 脚本,我可以要求的一切。

我按照步骤操作,我的init.vim 看起来像这样

call plug#begin()
Plug 'bfredl/nvim-ipy'
call plug#end()

command! -nargs=0 RunQtConsole
\call jobstart("jupyter qtconsole --JupyterWidget.include_other_output=True")

let g:ipy_celldef = '^##' " regex for cell start and end

nmap <silent> <leader>jqt :RunQtConsole<Enter>
nmap <silent> <leader>jk :IPython<Space>--existing<Space>--no-window<Enter>
nmap <silent> <leader>jc <Plug>(IPy-RunCell)
nmap <silent> <leader>ja <Plug>(IPy-RunAll)

另外,我的ftplugin/python.vim 看起来像这样

setlocal tabstop=4
setlocal shiftwidth=4
setlocal expandtab
setlocal autoindent

但使用&lt;leader&gt;jqt 会出现以下错误

E492: not an editor command:jobstart("jupyter qtconsole --JupyterWidget.include_other_output=True")

我的猜测是这是因为RunQtConsole 假设您已经激活并设置了安装 jupyter 的环境。所以我尝试在 python 环境中启动 nvim,但结果是一样的。

后来,我尝试从 nvim 终端(然后是 RunQtCOnsole)执行环境激活,但不知道如何执行此操作。

我不确定我错过了什么。

【问题讨论】:

    标签: python jupyter conda neovim


    【解决方案1】:

    尝试将所有内容放在一行中:

    command! -nargs=0 RunQtConsole call jobstart("jupyter qtconsole --JupyterWidget.include_other_output=True")
    

    或者,如果您想使用单独的行,请在 \ 之后添加一个空格:

    command! -nargs=0 RunQtConsole
      \ call jobstart("jupyter qtconsole --JupyterWidget.include_other_output=True")
    
    

    【讨论】:

    • 有了这个命令,新推出的QtConsole就会获得焦点。如何修改此命令以让我的终端保持焦点?
    • 这里也一样,有人知道怎么修改吗?
    • 我也遇到了同样的问题。这似乎是第一个选择 - 对我有用。
    猜你喜欢
    • 2021-11-13
    • 2019-09-29
    • 1970-01-01
    • 2023-02-15
    • 1970-01-01
    • 2022-01-25
    • 2022-12-05
    • 1970-01-01
    • 2023-03-16
    相关资源
    最近更新 更多