On Tuesday, August 7, 2012 8:00:58 AM UTC-5, Ansuman Bebarta wrote:
> Hi 
> 
> 
> 
> I work with python.
> 
> 
> 
> I want to use 4 space indentation personally for python files created by me
> 
> (not associated with project). I know I can achieve this by:
> 
> set ts=4 sts=4 sw=4 expandtab.
> 
> 
> 
> Now the twist is that I am having a project folder always at
> 
> D:\Projects\MyProject . The python file in the project has used 3 space
> 
> indentation. 
> 
> 
> 
> How can I provide a local setting for my project files?
> 
> 
> 
> Please help. Any suggestions and inputs will be appreciated.
> 
> 
> 
> Thanks
> 
> Ansuman
> 
> 
> 
> 
> 

You have a few options.

First, 
http://vim.wikia.com/wiki/Source_vimrc_and_use_tags_in_a_parent_directory has a 
list of scripts that do per-directory .vimrc handling.

Second, you could set up your .vimrc according to your desired project 
settings, and override the project settings with a modeline for any python 
files you create outside the project.

Finally, you could set up a BufRead,BufNewFile autocmd matching files in the 
D:\Projects\MyProject directory which sets the project-specific settings, to 
override another autocmd (before it) matching all files which sets up your 
desired settings for other files. For example (untested):

augroup PYTHON_PROJECT_SETTINGS
  au!
  autocmd BufRead,BufNewFile * setl ts=4 sts=4 sw=4 expandtab
  autocmd BufRead,BufNewFile D:\Projects\MyProject\* setl ts=3 sts=3 sw=3
augroup END

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to