1

Possible Duplicate:
Vim: apply settings on files in directory

vim can be configured with settings like tab size and expanding tabs to spaces based on filetype.

I want to configure editing settings for vim for the source files in my product but I don't want to set a modeline in each source file, and I don't want to rely on many per-developer settings in ~/.vimrc.

I want to put settings in one or two files in the top-level folder of my product source tree and have at most very simple per-developer settings in ~/.vimrc so that their vim sessions will look for the project configuration whenever they are editing a source file in that project.

I don't want the top-level folder to be preconfigured in ~/.vimrc because I would like to check out the product source tree to more than one location at any time without reconfiguring ~/.vimrc so I expect it really would have to be found by iterating through the parent folders from the location of the source file being edited. Once the config file is found I'd expect it to be interpreted like ~/.vimrc or a modeline.

Is there a solution like that?

Community
  • 1
  • 1
codeshot
  • 1,183
  • 1
  • 9
  • 20

1 Answers1

2

In a right side column, you may see the related question: Vim: apply settings on files in directory that actually answers totally your question.

Note: by experience, once found the file shall not be interpreted like a .vimrc, but almost like a ft-plugin. Most settings shall be buffer local. The only settings that have to be global are for plugins that don't correctly handle project-specific settings (unfortunately, there are plenty).

Community
  • 1
  • 1
Luc Hermitte
  • 31,979
  • 7
  • 69
  • 83
  • Why don’t you vote for closing then? – ZyX Oct 04 '12 at 04:29
  • I guess it's because of the "like the .vimrc" that needed to be addressed as well. I did hesitate ^^' – Luc Hermitte Oct 04 '12 at 08:54
  • I don't totally need "like the .vimrc" as long as typical settings can be copied and pasted from .vimrc examples into the project settings file. – codeshot Oct 04 '12 at 22:27
  • This isn't a duplicate as described. The pre-existing question doesn't contain clear steps to solve what I'm asking. The starting point for the answer here is actually hidden in the other question but the user that posted it wanted to do it without a plugin. No answer for my problem is described clearly. Please dedupe this so I can post a clear answer for anybody else that needs to know how. It starts with this link, but also needs steps for somebody who's not experienced with vim. http://www.vim.org/scripts/script.php?script_id=1860 – codeshot Oct 05 '12 at 22:47
  • I quite agree with your point. However, my answers here, and there do address your question: a local_vimrc plugin (I gave a link to mine) + what it shall contain. Someday I'll write a clean documentation about how to use it. At this time, I only have an example of use available on-line (https://github.com/LucHermitte/Rasende/blob/master/_vimrc_local.vim) – Luc Hermitte Oct 09 '12 at 22:58