Enable Python feature in vim editor

41 views
Skip to first unread message

kaushal

unread,
Nov 22, 2021, 12:06:00 PM11/22/21
to vim_use
Hi,

I am using vim editor to write python scripts. Is there a way to enable syntax, help and indentation of python script?

Thanks in advance. I look forward to hearing from you. 

Best Regards,

Kaushal

Shlomi Fish

unread,
Nov 23, 2021, 3:33:26 AM11/23/21
to kaushal, vim...@googlegroups.com
Hi Kaushal!

See: https://henry.precheur.org/vim/python.html

--

Shlomi Fish https://www.shlomifish.org/
List of Graphics Apps - https://shlom.in/graphics

Alan: Hello, Miss Mandrake. I’m Alan. [she shakes his hand.]
John: John. [shakes his hand.]
Alan: We’re mighty vampires.
Selina: [Amusingly] Selina Mandrake, mighty pirate.

Please reply to list if it's a mailing list post - https://shlom.in/reply .

Steve Martin

unread,
Nov 23, 2021, 6:06:09 AM11/23/21
to vim_use
I'd give one warning. The scripts pointed to by Shlomi were written back in 2006. The newest versions of Vim have a new indent/python.vim script created just a couple of years ago by the Vim authors. If you are using the latest version of Vim (8.0+) then you should make sure you have all of the scripts that come with Vim installed and it should give you very good handling of Python files out of the box.

Shlomi Fish

unread,
Nov 23, 2021, 6:41:12 AM11/23/21
to Steve Martin, vim...@googlegroups.com
Hi Steve!

On Tue, 23 Nov 2021 02:24:11 -0800 (PST)
Steve Martin <smart...@gmail.com> wrote:

> I'd give one warning. The scripts pointed to by Shlomi were written back in
> 2006. The newest versions of Vim have a new indent/python.vim script
> created just a couple of years ago by the Vim authors. If you are using the
> latest version of Vim (8.0+) then you should make sure you have all of the
> scripts that come with Vim installed and it should give you very good
> handling of Python files out of the box.
>

The built-in scripts do a worse job, esp. with handling '='/'==', from my
experience.

> On Tuesday, November 23, 2021 at 1:33:26 AM UTC-7 Shlomi Fish wrote:
>
> > On Mon, 22 Nov 2021 09:06:00 -0800 (PST)
> > kaushal <kaushal...@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > I am using vim editor to write python scripts. Is there a way to enable
> > > syntax, help and indentation of python script?
> > >
> > > Thanks in advance. I look forward to hearing from you.
> > >
> > > Best Regards,
> > >
> > > Kaushal
> > >
> >
> > Hi Kaushal!
> >
> > See: https://henry.precheur.org/vim/python.html
> >
> > --
> >
> > Shlomi Fish https://www.shlomifish.org/
> > List of Graphics Apps - https://shlom.in/graphics
> >
> > Alan: Hello, Miss Mandrake. I’m Alan. [she shakes his hand.]
> > John: John. [shakes his hand.]
> > Alan: We’re mighty vampires.
> > Selina: [Amusingly] Selina Mandrake, mighty pirate.
> >
> > Please reply to list if it's a mailing list post - https://shlom.in/reply
> > .
> >
>



--

Shlomi Fish https://www.shlomifish.org/
Star Trek: “We, the Living Dead” - https://shlom.in/st-wtld

Flock aims to be the browser for the social web, but I found it to be the
completely anti-social browser.

Eike Rathke

unread,
Nov 23, 2021, 6:46:42 AM11/23/21
to vim...@googlegroups.com
Hi,

On Monday, 2021-11-22 09:06:00 -0800, kaushal wrote:

> I am using vim editor to write python scripts. Is there a way to enable
> syntax, help and indentation of python script?

Maybe your installation just lacks some things?
I have

find /usr/share/vim/ -name '*python*'

(Fedora, vim-common package)
/usr/share/vim/vim82/autoload/pythoncomplete.vim
/usr/share/vim/vim82/autoload/python3complete.vim
/usr/share/vim/vim82/syntax/python.vim
/usr/share/vim/vim82/ftplugin/python.vim
/usr/share/vim/vim82/indent/python.vim

or

(Debian, vim-runtime package)
/usr/share/vim/vim81/ftplugin/python.vim
/usr/share/vim/vim81/autoload/pythoncomplete.vim
/usr/share/vim/vim81/autoload/python3complete.vim
/usr/share/vim/vim81/syntax/python.vim
/usr/share/vim/vim81/indent/python.vim

and syntax highlighting and indentation work.

If on Windows, find out where these are installed and maybe adjust your
$VIM or eve $VIMRUNTIME paths. See :h $VIM and :h $VIMRUNTIME

Eike

--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/
signature.asc

Eike Rathke

unread,
Nov 23, 2021, 6:47:28 AM11/23/21
to vim...@googlegroups.com
Hi,

On Tuesday, 2021-11-23 10:33:15 +0200, Shlomi Fish wrote:

> See: https://henry.precheur.org/vim/python.html

Seriously? A post from 2008?
signature.asc
Reply all
Reply to author
Forward
0 new messages