Fatemeh
Fatemeh

Reputation: 63

How to Customize vim for scripting in Python 3 ?

I am new to vim and I want to use it for scripting Python3. anyone knows how to customize vim for editing Python 3 scripts? (mainly for indentations, coloring and tab suggestions... )

Thanks

Upvotes: 0

Views: 1282

Answers (2)

FDinoff
FDinoff

Reputation: 31419

You should put customized settings in to ~/.vim/ftplugin/python.vim This will be sourced when vim sees a file with a filetype python.

To make sure the settings only affect the current buffer use setlocal.

To make sure that mappings only affect the current buffer use noremap <buffer>

Just make sure to have filetype plugin indent on in ~/.vimrc

Upvotes: 1

user2062950
user2062950

Reputation:

Python wiki suggests putting the following in your ~/.vimrc:

syntax on
filetype indent plugin on
set tabstop=8
set expandtab
set shiftwidth=4
set softtabstop=4

Edit: the above does have the side-effect of using the tab settings in all files edited with vim. Other approaches are discussed in the wiki as well.

There's also the python.vim script for syntax highlighting and such.

Upvotes: 2

Related Questions