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 1031525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T13:56:33+00:00 2026-05-16T13:56:33+00:00

I have a windows directory ( U:\S ) that contains files that must not

  • 0

I have a windows directory (U:\S) that contains files that must not be
changed. Their read-only bit cannot be set, so they must remain writeable.

As I have to look into some of the file’s content rather regurarly with VIM, I want to make sure that I don’t accidentally change the file’s conent.

So, I put the following line into my .vimrc conifugration file:

autocmd InsertEnter u:/s/* call confirm("File should not be changed")

which seemed to work fine.

But then, I have also directory named U:\supportTerminal that contains files
that I have to change. When I edit a file within that directory, the file pattern u:/s/* for some reason matches and my warning pops up.

I tried playing around with some pattern, but I found none that only matches within u:\s but not within u:\supportTerminal

So, how could I go about what I want?

  • 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-16T13:56:34+00:00Added an answer on May 16, 2026 at 1:56 pm

    That makes for a bug, which you should report to vim-dev at vim.org. In linux I don’t have this behaviour: it matches nicely.

    As a temporary workaround,

    :au BufRead u:/s/* set readonly
    :au! BufRead u:/supportTerminal/* 
    

    should first make the general rule and then remove the one dir as an exception. Not sure whether this works in Windows GVim properly. Should this fail, other hack would be:

    :au BufRead u:/supportTerminal/* set noreadonly
    

    PS: As mentioned in the comments above, setting vim’s own setting readonly works better to prevent accidental edits. User can’t :write files with RO flag on, but it can be circumvented by setting noreadonly if needed.

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

Sidebar

Related Questions

I am running windows server 2003. I have a directory that contains hundreds of
Windows 2003/IIS 6... I have a virtual directory on a web site that closely
I have a directory of many files in Windows Vista. I'd like in a
I have a directory of ZIP files (created on a Windows machine). I can
I use Tomcat 7 on Windows XP. I have a directory with static files
I have a Windows service that is retrieving a few selected files from a
I have a network storage device that contains a few hundred thousand mp3 files,
I have developed a windows application, which will read updated data from .jrn files(In
I have a Visual Studio 2010 Solution that contains three projects: A Windows Service
I have a windows batch file, which outputs directory path, e.g.: @echo c:\windows I

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.