David542
David542

Reputation: 110462

vim settings for python

I have the following settings file:

# ~/.vimrc
set tabstop=4
set shiftwidth=4
set smarttab
set expandtab
set softtabstop=4
set autoindent

How would I make these settings apply to python only? Also, how would I add python coloring (such as textmate does for each language) ?

Upvotes: 11

Views: 7529

Answers (3)

Justin Warkentin
Justin Warkentin

Reputation: 10239

I have these lines in my config:

filetype plugin indent on
syntax on
au BufNewFile,BufRead *.py set tabstop=4 softtabstop=4 shiftwidth=4 expandtab smarttab autoindent

This may be what you're looking for with the coloring: Improved Python syntax, Blackboard color scheme

Upvotes: 12

Burhan Khalid
Burhan Khalid

Reputation: 174708

In addition to the above, try your hand at vim-janus which adds other goodies to vim.

Upvotes: 0

Cat Plus Plus
Cat Plus Plus

Reputation: 129944

Put them in vimfiles/ftplugin/python.vim (but change set to setlocal) and add filetype plugin on to .vimrc. For syntax highlighting, add syntax on to .vimrc.

Upvotes: 6

Related Questions