Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:04:55+00:00 2026-05-24T21:04:55+00:00

I am new at using vim daily. I am doing my best to setup

  • 0

I am new at using vim daily. I am doing my best to setup an good environment. I work a lot with Django projects. And I want to simulate a project like setup when I edit a file inside a django project.

Let’s asume this directory structure:

/projects
    /django-app1
       manage.py
       settings.py
       .project
    /django-app1
       manage.py
       settings.py
       .project

What I want is place a file called .project that contains vim commands that will execute if I open any file whitin the directory structure

Why? Here is my vimrc https://github.com/mariocesar/dotfiles/blob/master/.vimrc#L151 you can see that I am using a snippet to load the virtualenv if it’s exist on the enviroment variables, it’s very cool but I don’t think is efficient to do that every time I open a file, or even better add some extra paths to sys.path, as I have projects with a site-packages directories.

So:

  • How Can I detect a specific named file, looking down the current directory when open a file with vim?
  • How Can I execute this file as a vim script?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:04:56+00:00Added an answer on May 24, 2026 at 9:04 pm

    There exist several plugins named local_vimrc that fulfil your need. Here is mine.

    BTW, your question is a duplicate of Vim: apply settings on files in directory


    EDIT: Recent implementations of local_vimrc plugins use vim7 capabilities. Somehow, this is equivalent to:

    source <c-r>=findfile('.local_vimrc',expand('<afile>').';')<cr>
    

    (thanks sehe for reminding me of ‘;’)

    “Somehow”, because, many important features are missing:

    • the possibility to source all files found, in the downward order.
    • the optional specification of a root directory pattern (like '$HOME\|/opt/projects/ for instance)
    • external paths like scp://, ftp://, http:// must be handled correctly (I haven’t tested how they’d behave with findfile())
    • it should be possible to force the execution of the local vimrc(s) before a template-expander plugin triggers the expansion of a templare-file (the typical application is the generation of header-gates in C/C++ .h files)

    Hence my preference for the full plugin way, and not just a one-liner that will irritate us from time to time.

    NB: my plugin is very old, it’s pre-vim7. As it works (recursively), I’ve never feel the need to rewrite it with the modern vim7 list manipulations functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using vim daily at work for almost 2 years now, and I've
I'm using the vim project plugin to manage a project, and whenever a new
While using Vim I'll sometimes want to look at a function definition or a
I want to develop C on Windows, but I really like just using vim
I am new to the text editor Vim. I want to use it for
I am working with vim. I created a new cpp file using vim xyz.cpp
When using split windows in VIM, sometimes I create new split of a file
I'm new to vim and I find that I am using the following command
I want to open a file in Vim like in Eclipse using Ctrl +
I'm using this vim plugin for coffeescript and I want to keep all my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.