Linking a filetype to a syntax file of a different nameCustom syntax file for FIX data doesn't workCan vim syntax regions be made to touch/overlap?Change default syntax highlighting schemeHow can I conditionally include a syntax file from another syntax file?Can I apply one file's filetype to another, without actually opening the first file?Syntax highlight region / keyword overlapAdjust syntax highlighting for region included with syn-include?Do syntax patterns let you use very magic or not?Set formatoptions for a specific fileSyntax highlight Markdown formulas using LaTeX highlighting

Why is the ladder of the LM always in the dark side of the LM?

Print the last, middle and first character of your code

What to do with a rabbit in a survival situation?

Integer Lists of Noah

Managing and organizing the massively increased number of classes after switching to SOLID?

What steps should I take to lawfully visit the United States as a tourist immediately after visiting on a B-1 visa?

Is "De qui parles-tu" (for example) as formal as it is in English, or is it normal for the French to casually say that

Why was hardware diversification an asset for the IBM PC ecosystem?

Using `PlotLegends` with a `ColorFunction`

Should disabled buttons give feedback when clicked?

This one's for Matthew:

What is this little owl-like bird?

Why did Harry Potter get a bedroom?

Why return a static pointer instead of an out parameter?

Adding labels to a matrix

How do native German speakers usually express skepticism (using even) about a premise?

Is it possible to create a craft with specific bones, like the bones of a forgotten beast?

Switching interface VLAN ID Mid-Production

How do you move up one folder in Finder?

Why isn't pressure filtration popular compared to vacuum filtration?

Is English unusual in having no second person plural form?

Employers keep telling me my college isn't good enough - is there any way to fix this?

Why weren't bootable game disks ever common on the IBM PC?

How do we handle pauses in a dialogue?



Linking a filetype to a syntax file of a different name


Custom syntax file for FIX data doesn't workCan vim syntax regions be made to touch/overlap?Change default syntax highlighting schemeHow can I conditionally include a syntax file from another syntax file?Can I apply one file's filetype to another, without actually opening the first file?Syntax highlight region / keyword overlapAdjust syntax highlighting for region included with syn-include?Do syntax patterns let you use very magic or not?Set formatoptions for a specific fileSyntax highlight Markdown formulas using LaTeX highlighting






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want to reuse the existing “mail” syntax definitions for this other filetype?



What I’ve tried



  • I tried writing setlocal syntax=mail in the ftplugin/usenet.vim file but this seemed to be ignored—running :set syntax? in a file with the “usenet” filetype just produced usenet.



  • I also tried copying the mail.vim syntax file from $VIMRUNTIME/syntax into ~/.vim/syntax, renaming it to usenet.vim, and changing the line



    let b:current_syntax = "mail"


    to



    let b:current_syntax = "usenet"


    This worked, but if a future version of Vim improves the mail.vim file then I would have to go through this process again (and it’s unlikely that I would even notice such a change in the first place). What I want, semantically, is to highlight “usenet” files as if they were “mail” files, which seems like it should be possible.











share|improve this question






























    1















    I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want to reuse the existing “mail” syntax definitions for this other filetype?



    What I’ve tried



    • I tried writing setlocal syntax=mail in the ftplugin/usenet.vim file but this seemed to be ignored—running :set syntax? in a file with the “usenet” filetype just produced usenet.



    • I also tried copying the mail.vim syntax file from $VIMRUNTIME/syntax into ~/.vim/syntax, renaming it to usenet.vim, and changing the line



      let b:current_syntax = "mail"


      to



      let b:current_syntax = "usenet"


      This worked, but if a future version of Vim improves the mail.vim file then I would have to go through this process again (and it’s unlikely that I would even notice such a change in the first place). What I want, semantically, is to highlight “usenet” files as if they were “mail” files, which seems like it should be possible.











    share|improve this question


























      1












      1








      1








      I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want to reuse the existing “mail” syntax definitions for this other filetype?



      What I’ve tried



      • I tried writing setlocal syntax=mail in the ftplugin/usenet.vim file but this seemed to be ignored—running :set syntax? in a file with the “usenet” filetype just produced usenet.



      • I also tried copying the mail.vim syntax file from $VIMRUNTIME/syntax into ~/.vim/syntax, renaming it to usenet.vim, and changing the line



        let b:current_syntax = "mail"


        to



        let b:current_syntax = "usenet"


        This worked, but if a future version of Vim improves the mail.vim file then I would have to go through this process again (and it’s unlikely that I would even notice such a change in the first place). What I want, semantically, is to highlight “usenet” files as if they were “mail” files, which seems like it should be possible.











      share|improve this question
















      I’ve created a new filetype, “usenet,” for Usenet messages. I would like files with this filetype to be highlighted exactly as if they had the “mail” filetype. Is it possible to tell Vim that I want to reuse the existing “mail” syntax definitions for this other filetype?



      What I’ve tried



      • I tried writing setlocal syntax=mail in the ftplugin/usenet.vim file but this seemed to be ignored—running :set syntax? in a file with the “usenet” filetype just produced usenet.



      • I also tried copying the mail.vim syntax file from $VIMRUNTIME/syntax into ~/.vim/syntax, renaming it to usenet.vim, and changing the line



        let b:current_syntax = "mail"


        to



        let b:current_syntax = "usenet"


        This worked, but if a future version of Vim improves the mail.vim file then I would have to go through this process again (and it’s unlikely that I would even notice such a change in the first place). What I want, semantically, is to highlight “usenet” files as if they were “mail” files, which seems like it should be possible.








      syntax-highlighting filetype






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 9 hours ago







      bdesham

















      asked 10 hours ago









      bdeshambdesham

      8079 silver badges13 bronze badges




      8079 silver badges13 bronze badges




















          2 Answers
          2






          active

          oldest

          votes


















          2














          Create a syntax/usenet.vim with the contents:



          " Quit when a syntax file was already loaded
          if exists("b:current_syntax")
          finish
          endif

          runtime! syntax/mail.vim
          let b:current_syntax = "usenet"


          In short, just source the file you want to inherit syntax from. If you want any customizations for usenet, just make them after you've sourced syntax/mail.vim.






          share|improve this answer






























            2














            You can use multiple filetype names separated with .



            # in your personal filetype.vim
            augroup filetypedetect
            au! BufRead,BufNewFile *.usenet setfiletype mail.usenet
            augroup END


            All mail filetype plugins and syntax files will be applied before usenet filetype plugins and syntax files. All mail related stuff (abbreviations, snippets, balabalas) should work in usenet.






            share|improve this answer

























              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "599"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f20565%2flinking-a-filetype-to-a-syntax-file-of-a-different-name%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              Create a syntax/usenet.vim with the contents:



              " Quit when a syntax file was already loaded
              if exists("b:current_syntax")
              finish
              endif

              runtime! syntax/mail.vim
              let b:current_syntax = "usenet"


              In short, just source the file you want to inherit syntax from. If you want any customizations for usenet, just make them after you've sourced syntax/mail.vim.






              share|improve this answer



























                2














                Create a syntax/usenet.vim with the contents:



                " Quit when a syntax file was already loaded
                if exists("b:current_syntax")
                finish
                endif

                runtime! syntax/mail.vim
                let b:current_syntax = "usenet"


                In short, just source the file you want to inherit syntax from. If you want any customizations for usenet, just make them after you've sourced syntax/mail.vim.






                share|improve this answer

























                  2












                  2








                  2







                  Create a syntax/usenet.vim with the contents:



                  " Quit when a syntax file was already loaded
                  if exists("b:current_syntax")
                  finish
                  endif

                  runtime! syntax/mail.vim
                  let b:current_syntax = "usenet"


                  In short, just source the file you want to inherit syntax from. If you want any customizations for usenet, just make them after you've sourced syntax/mail.vim.






                  share|improve this answer













                  Create a syntax/usenet.vim with the contents:



                  " Quit when a syntax file was already loaded
                  if exists("b:current_syntax")
                  finish
                  endif

                  runtime! syntax/mail.vim
                  let b:current_syntax = "usenet"


                  In short, just source the file you want to inherit syntax from. If you want any customizations for usenet, just make them after you've sourced syntax/mail.vim.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 7 hours ago









                  filbrandenfilbranden

                  7852 silver badges12 bronze badges




                  7852 silver badges12 bronze badges























                      2














                      You can use multiple filetype names separated with .



                      # in your personal filetype.vim
                      augroup filetypedetect
                      au! BufRead,BufNewFile *.usenet setfiletype mail.usenet
                      augroup END


                      All mail filetype plugins and syntax files will be applied before usenet filetype plugins and syntax files. All mail related stuff (abbreviations, snippets, balabalas) should work in usenet.






                      share|improve this answer



























                        2














                        You can use multiple filetype names separated with .



                        # in your personal filetype.vim
                        augroup filetypedetect
                        au! BufRead,BufNewFile *.usenet setfiletype mail.usenet
                        augroup END


                        All mail filetype plugins and syntax files will be applied before usenet filetype plugins and syntax files. All mail related stuff (abbreviations, snippets, balabalas) should work in usenet.






                        share|improve this answer

























                          2












                          2








                          2







                          You can use multiple filetype names separated with .



                          # in your personal filetype.vim
                          augroup filetypedetect
                          au! BufRead,BufNewFile *.usenet setfiletype mail.usenet
                          augroup END


                          All mail filetype plugins and syntax files will be applied before usenet filetype plugins and syntax files. All mail related stuff (abbreviations, snippets, balabalas) should work in usenet.






                          share|improve this answer













                          You can use multiple filetype names separated with .



                          # in your personal filetype.vim
                          augroup filetypedetect
                          au! BufRead,BufNewFile *.usenet setfiletype mail.usenet
                          augroup END


                          All mail filetype plugins and syntax files will be applied before usenet filetype plugins and syntax files. All mail related stuff (abbreviations, snippets, balabalas) should work in usenet.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered 4 hours ago









                          dedowsdidedowsdi

                          2,0261 gold badge4 silver badges15 bronze badges




                          2,0261 gold badge4 silver badges15 bronze badges



























                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Vi and Vim Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fvi.stackexchange.com%2fquestions%2f20565%2flinking-a-filetype-to-a-syntax-file-of-a-different-name%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

                              The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

                              19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу