Project specific editor settings
Everyone knows the problem that seemingly each project uses its own code style. So here is my solution for that problem:
$ cat ~/.vim/after/ftplugin/c.vim
if filereadable('.project.vim')
source .project.vim
else
set sw=2 sta et
endif
Maybe you had some better ideas already - I'd like to read about them.
- Yes I should use something reasonable like Anjuta...
- Modelines are easy to forget and need changes to the existing code.
Thank you! I've been wondering about this problem myself for a while now.
One thing, though: if you have a project with multiple subdirectories of source code, it would be nice to have a single project file at the top level, rather than a vim project file in every directory.
Why on earth do you think you should be using Anjuta? Personally I don't think I'd ever give up vim, it's so much more efficient to use than other editors ...
you should be able to put a .vimrc in the root of you project tree and it should be sourced automatically, right?
I agree on using Vim, I always try new IDEs and Editors, as soon as they get released.
Once you get used to the modal editing Vim offers, everything else seems redundant.
With all those plugins available I don't ever miss an IDE.
Although I prefer NERDTree over Project.vim
I've read that Anjuta is getting a Vim extension soon, so go Anjuta!
If you're on the Mac too, give MacVim a try, we'll be getting GUI plugins soon :D
fraggle: vim loads that ".project.vim" file from the current working directory (:help pwd). For me this usually is the project's top-level folder.
Anjuta? Well, more modern?
For Emacs, I use this: https://launchpad.net/pgrok/ . It does both mode-specific and general files, looking them up in the same directory as the file being opened or a directory higher up in the tree.
Nice - something like this would be really useful for many projects.
Do you see a way how to use the same file from kate and gedit and others? That would be awesome! Otherwise, I doubt many projects would allow for ten different .project.<someones favorite editor> files in their tree :-)
fraggle: you may find the following VIM script useful:
http://www.vim.org/scripts/script.php?sc...
I tend to put project-specific vim stuff into my ~/.vimrc:
autocmd BufRead,BufNewFile * if expand('%:p') =~ 'projectname' | setlocal foo bar baz | endif
I primarily use Python, which has only one popular style guide (PEP-8), so I don't have many project-specific customizations.
Your method is clever and should scale better if you work on multiple projects.