11

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) ?

David542
  • 104,438
  • 178
  • 489
  • 842

3 Answers3

12

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

Justin Warkentin
  • 9,856
  • 4
  • 35
  • 35
6

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.

Cat Plus Plus
  • 125,936
  • 27
  • 200
  • 224
0

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

Burhan Khalid
  • 169,990
  • 18
  • 245
  • 284