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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:24:54+00:00 2026-06-04T20:24:54+00:00

I opened vim without loading anything: vim -V -u NONE And typed one line:

  • 0

I opened vim without loading anything:

vim -V -u NONE

And typed one line:

<?xml?>

After running:

:unlet did_load_filetypes
:filetype on

I check the file type of current buffer:

:set ft?

It print filetype=


If I type

:unlet did_load_filetypes
:filetype detect

then :set ft? will print filetype=xml.


In the vim doc:

Detail: The ":filetype on" command will load one of these files:                                    
                Amiga       $VIMRUNTIME/filetype.vim                                                
                Mac         $VIMRUNTIME:filetype.vim                                                
                MS-DOS      $VIMRUNTIME\filetype.vim                                                
                RiscOS      Vim:Filetype                                                            
                Unix        $VIMRUNTIME/filetype.vim                                                
                VMS         $VIMRUNTIME/filetype.vim                                                
        This file is a Vim script that defines autocommands for the                                 
        BufNewFile and BufRead events.  If the file type is not found by the                        
        name, the file $VIMRUNTIME/scripts.vim is used to detect it from the                        
        contents of the file.   

What’s differences between :filetype on and :filetype detect?
Thanks for your help.

  • 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-04T20:24:55+00:00Added an answer on June 4, 2026 at 8:24 pm

    From the manual:

    To detect the file type again:
        :filetype detect
    Use this if you started with an empty file and typed text that makes it
    possible to detect the file type.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I opened a files in vim using gf command.which opened a file that the
I opened the files using :e or gf (Esc mode) commands in vim. when
I opened Eclipse IDE with the Run As Administrator one day to do updates
I would like explorer opened up on a certain folder, after the deployment has
Scenario: I have opened Vim and pasted some text. I open a second tab
when I run hg commit , vim editor is opened and shows HG: Enter
Is there any way to make the status line in Vim spanning across multiple
As I open new tabs in vi/vim(7.2), if the opened files are in different
I want csv file to be opened in vim in the same way it
I've been using Vim along with WinWalker, a Buffer manager. There's one big feature

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.