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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:45:51+00:00 2026-06-10T12:45:51+00:00

I’m on a system (linux) that always recognizes cpp files (*.cc) as tcl files.

  • 0

I’m on a system (linux) that always recognizes cpp files (*.cc) as tcl files. I don’t know what file type that is, but I wanted to override it. The correct syntax highlighting is chosen if I manually do :set ft=cpp. However, I’m having troubles setting that automatically and I don’t want to use the modeline option. My own .vimrc doesn’t interfere (same result if I rename it).

From the vim help (:help ftplugin-override)

                                                        *ftplugin-overrule*
If a global filetype plugin does not do exactly what you want, there are three
ways to change this:

1. Add a few settings.
   You must create a new filetype plugin in a directory early in
   'runtimepath'.  For Unix, for example you could use this file: 
        vim ~/.vim/ftplugin/fortran.vim
  You can set those settings and mappings that you would like to add.  Note
   that the global plugin will be loaded after this, it may overrule the 
   settings that you do here.  If this is the case, you need to use one of the 
   following two methods.

I have used this option before on another machine and that worked. I’ve tried

<file> .vim/ftplugin/tcl.vim
set filetype=cpp
"au BufRead,BufNewFile *     set filetype=cpp

The first line correctly sets the filetype (:set ft? returns cpp), but syntax highlighting is not the same as if I said :set ft=cpp. It’s still the tcl syntax highlighting. The second line does nothing.

2. Make a copy of the plugin and change it. 
   You must put the copy in a directory early in 'runtimepath'.  For Unix, for 
   example, you could do this: 
        cp $VIMRUNTIME/ftplugin/fortran.vim ~/.vim/ftplugin/fortran.vim
  Then you can edit the copied file to your liking.  Since the b:did_ftplugin
   variable will be set, the global plugin will not be loaded.
   A disadvantage of this method is that when the distributed plugin gets
   improved, you will have to copy and modify it again.

There seems to be no file in my $VIMRUNTIME directory /usr/share/vim/vim72/ftplugin/ called tcl.vim.

3. Overrule the settings after loading the global plugin.
   You must create a new filetype plugin in a directory from the end of
   'runtimepath'.  For Unix, for example, you could use this file: 
        vim ~/.vim/after/ftplugin/fortran.vim
  In this file you can change just those settings that you want to change.

Has the same effect as 1. Is there anything else I can try? Thanks a lot in advance.

  • 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-10T12:45:52+00:00Added an answer on June 10, 2026 at 12:45 pm

    cpp is the default filetype for *.cc and *.cpp files.

    The tcl filetype is only set for *.tcl, *.tk, *.itcl, *.itk and *.jacl.

    I see no reason why Vim would default to tcl when loading a *.cc file but you could check if theses files are installed:

    /usr/share/vim/vim7x/ftplugin/cpp.vim
    /usr/share/vim/vim7x/indent/cpp.vim
    /usr/share/vim/vim7x/syntax/cpp.vim
    

    and if the correct checks are done in:

    /usr/shhare/vim/vim7x/filetype.vim
    

    Are you the only person working on this machine? Do you use modelines?

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace

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.