12

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

3 Answers 3

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

Sign up to request clarification or add additional context in comments.

2 Comments

I don't think you need all the separators |, you can do it all in one set with set tabstop=4 softtabstop=4 shifwitdth=4 expandtab...
@skeept Thanks! I updated my answer (and my vim config) to remove the extra set's.
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.

2 Comments

It this ~/.vim/vimfiles/ftplugin/python.vim or where is the exact location of the file?
You have to put it into ~/.vim/ftplugin/python.vim.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.