如何使用 Nvim 跳转到 Python 中导入的类文件?

问题描述 投票:0回答:1

当我在 VS Code 中按下 ctrl 并左键单击时,我会跳转打开定义导入类的文件,如果我单击导入的类函数或属性,也会执行相同的操作。

如何在 Vim 中模仿此功能?

真的很方便!

示例:

from gymnasium import spaces

lidar_space = spaces.Box(low=0.0, high=20.0, shape=(360,), dtype=np.float32)

ctrl 左键单击 VS Code 中的“Box”将打开一个文件,显示 Box 的定义位置。

python class visual-studio-code vim neovim
1个回答
0
投票

要像 VS Code 一样跳转到 Vim 中类或函数的定义,请安装

ctags
,使用
ctags -R .
生成标签文件,安装“ctrlp.vim”和“tagbar”插件,配置您的
vimrc
,并使用
<F8>
切换标签栏,使用
<Ctrl+]>
跳转到符号的定义。

© www.soinside.com 2019 - 2024. All rights reserved.