如何让python.vim与vim一起使用?

时间:2023-01-21 07:27:21

I am playing around with vim and I heard that python.vim has some nifty settings for python.

我正在玩vim,我听说python.vim有一些漂亮的python设置。

Link to python.vim http://www.vim.org/scripts/script.php?script_id=790

链接到python.vim http://www.vim.org/scripts/script.php?script_id=790

Q1: How do I integrate python.vim with vim? Q2: Because I am not familiar with vim, if I use something like python.vim will it have a crazy effect on non-python files or will the settings just apply to python files?

Q1:如何将python.vim与vim集成? Q2:因为我不熟悉vim,如果我使用类似python.vim的东西,它会对非python文件产生疯狂影响,还是设置只适用于python文件?


Update:

I already places the file in the appropriate directory as instructed by the link I posted. It doesn't appear to be working with vim. Do I have to source it some how from vim? From outside of vim? I feel like I have tried both and neither are working.

我已经按照我发布的链接的指示将文件放在适当的目录中。它似乎与vim无关。我是否必须从vim中获取一些信息?从vim的外面?我觉得我已经尝试了两种,但都没有工作。

Also the directory the ~/.vim/syntax/ folder did not exist. I had to create it.

还有〜/ .vim / syntax /文件夹不存在的目录。我不得不创造它。

FYI - I'm doing this on a MAC.

仅供参考 - 我在MAC上这样做。

2 个解决方案

#1


4  

Q1:

Follow the installation details in the python.vim files description

按照python.vim文件描述中的安装细节进行操作

"install details Place python.vim file in ~/.vim/syntax/ folder."

“安装详细信息将python.vim文件放在〜/ .vim / syntax /文件夹中。”

Q2:

python.vim is a filetype plugin so it will only work when you are editing .py files.

python.vim是一个文件类型插件,所以只有在编辑.py文件时才能使用它。

Regarding your update:

关于你的更新:

Try issuing the command:

尝试发出命令:

:syntax on

This will turn on syntax highlighting. If you want this to always be on you can add it to ~/.vimrc

这将打开语法突出显示。如果您希望始终打开它,可以将其添加到〜/ .vimrc

In addition to this you may need to add this to your .vimrc as well:

除此之外,您可能还需要将此添加到.vimrc中:

filetype plugin on

#2


0  

install details

Place python.vim file in ~/.vim/syntax/ folder.

将python.vim文件放在〜/ .vim / syntax /文件夹中。

Quoted from http://www.vim.org/scripts/script.php?script_id=790

引自http://www.vim.org/scripts/script.php?script_id=790

And it only applies to .py files.

它只适用于.py文件。

#1


4  

Q1:

Follow the installation details in the python.vim files description

按照python.vim文件描述中的安装细节进行操作

"install details Place python.vim file in ~/.vim/syntax/ folder."

“安装详细信息将python.vim文件放在〜/ .vim / syntax /文件夹中。”

Q2:

python.vim is a filetype plugin so it will only work when you are editing .py files.

python.vim是一个文件类型插件,所以只有在编辑.py文件时才能使用它。

Regarding your update:

关于你的更新:

Try issuing the command:

尝试发出命令:

:syntax on

This will turn on syntax highlighting. If you want this to always be on you can add it to ~/.vimrc

这将打开语法突出显示。如果您希望始终打开它,可以将其添加到〜/ .vimrc

In addition to this you may need to add this to your .vimrc as well:

除此之外,您可能还需要将此添加到.vimrc中:

filetype plugin on

#2


0  

install details

Place python.vim file in ~/.vim/syntax/ folder.

将python.vim文件放在〜/ .vim / syntax /文件夹中。

Quoted from http://www.vim.org/scripts/script.php?script_id=790

引自http://www.vim.org/scripts/script.php?script_id=790

And it only applies to .py files.

它只适用于.py文件。