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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:40:50+00:00 2026-06-09T15:40:50+00:00

I used to remember that we can add some vim cmd line in the

  • 0

I used to remember that we can add some vim cmd line in the file’s head, and they will be executed when vim open the file.
I tried to add head line like this:

#vim map <F4> :close<CR>

But it did not work.

  • 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-06-09T15:40:51+00:00Added an answer on June 9, 2026 at 3:40 pm

    You can’t add vim cmd line at the file head. If you have

    set modeline modelines=N
    

    where N>0 then lines like

    vim: tw=40
    

    at the start/end of the file (not more then N lines from the start/end) will set option tw (textwidth) to 40. You can write it in a fuller form:

    vim: set textwidth=40
    

    , but it still accepting only options (set here is just ignored). It does not even accept all options (some of them are stated in the doc as “cannot be set from a modeline … for security reasons”). Without plugins you can’t have generic command here. Note that if you find one that allows running :map command I will suggest not using it: it is very unsecure. I’ve seen only those that allow doing :let in modelines.

    By the way,

    1. why not put it into vimrc?
    2. :close command can be typed as <C-w>c in close mode which is much faster then moving hands to <F4>.
    3. Don’t use map without nore for no reason. Plain map makes you think “what will the new mapping I add break” before adding it. *noremap will make all mappings immune to breaking by any other mapping with different {lhs}.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used to have a great Firefox add-on for this and I can't remember
I can't see anything on here but I do remember being told that If
I was working with VB6 last year and I used an Add-on that made
It used to be that when I made changes to my .py file in
I haven't used MiGLayout in a while and I can't remember how to remove
I remember seeing somewhere there ^ operator is used as a pointer operator in
I remember years ago being able to download and install the forums software used
As far as I remember, Visual Studio (both 2008 and 2010) used to have
I used the phonegap website to create an IPA file. Now I want to
I have used Java, C++, .Net. (in that order). When asked about by-value vs.

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.