10

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
  • 101,766
  • 154
  • 423
  • 727

3 Answers3

11

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,116
  • 4
  • 35
  • 33
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
  • 119,938
  • 26
  • 191
  • 218
0

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

Burhan Khalid
  • 161,711
  • 18
  • 231
  • 272