How do you turn off syntax highlighting for new vim windows without a filename or file type?












0















After I installed the 'artesanal' theme for vim and turned syntax highlighting on, every vim window has syntax highlighting including brand new empty windows [No Name], without a name or file type. I'm wondering if any of you know how to keep syntax highlighting on for every file with an extension but have it disabled for any file without a name or file extension.
Example of syntax highlighting on no file extension










share|improve this question





























    0















    After I installed the 'artesanal' theme for vim and turned syntax highlighting on, every vim window has syntax highlighting including brand new empty windows [No Name], without a name or file type. I'm wondering if any of you know how to keep syntax highlighting on for every file with an extension but have it disabled for any file without a name or file extension.
    Example of syntax highlighting on no file extension










    share|improve this question



























      0












      0








      0








      After I installed the 'artesanal' theme for vim and turned syntax highlighting on, every vim window has syntax highlighting including brand new empty windows [No Name], without a name or file type. I'm wondering if any of you know how to keep syntax highlighting on for every file with an extension but have it disabled for any file without a name or file extension.
      Example of syntax highlighting on no file extension










      share|improve this question
















      After I installed the 'artesanal' theme for vim and turned syntax highlighting on, every vim window has syntax highlighting including brand new empty windows [No Name], without a name or file type. I'm wondering if any of you know how to keep syntax highlighting on for every file with an extension but have it disabled for any file without a name or file extension.
      Example of syntax highlighting on no file extension







      vim vim-syntax-highlighting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 8:16









      Micha Wiedenmann

      10.3k1364104




      10.3k1364104










      asked Nov 23 '18 at 5:01









      kurokashirokurokashiro

      32




      32
























          2 Answers
          2






          active

          oldest

          votes


















          1














          This should not happen. I don't know artesanal (and "theme" is an undefined term inside Vim; it has colorschemes, filetype plugins, and syntax scripts; I hope it's not a full Vim "distribution" like spf-13 and Janus, which lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult)).



          It looks like a syntax is active even for plain files. Usually, the syntax is determined by the filetype, so check :verbose setlocal filetype? first. If this returns a value, you need to look into the detection of :help filetypes.



          If this is empty, it could also be that something sets 'syntax' directly. You can check in the same way: :verbose setlocal syntax?.



          Now, if that also is empty, and :syntax list doesn't show something, the highlighting could also come from :match or :call matchadd() commands; :call clearmatches() would remove this then. (And you still would need to find the source that defines those matches.)






          share|improve this answer
























          • ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

            – kurokashiro
            Nov 23 '18 at 7:56













          • Ah, great that you were able to figure it out!

            – Ingo Karkat
            Nov 23 '18 at 8:17



















          0














          You can check to see if a filetype has been set



          if &filetype != ""
          syntax enable
          endif





          share|improve this answer
























          • I tried it but python and js files also trigger the if statement

            – kurokashiro
            Nov 23 '18 at 7:33











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f53440881%2fhow-do-you-turn-off-syntax-highlighting-for-new-vim-windows-without-a-filename-o%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









          1














          This should not happen. I don't know artesanal (and "theme" is an undefined term inside Vim; it has colorschemes, filetype plugins, and syntax scripts; I hope it's not a full Vim "distribution" like spf-13 and Janus, which lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult)).



          It looks like a syntax is active even for plain files. Usually, the syntax is determined by the filetype, so check :verbose setlocal filetype? first. If this returns a value, you need to look into the detection of :help filetypes.



          If this is empty, it could also be that something sets 'syntax' directly. You can check in the same way: :verbose setlocal syntax?.



          Now, if that also is empty, and :syntax list doesn't show something, the highlighting could also come from :match or :call matchadd() commands; :call clearmatches() would remove this then. (And you still would need to find the source that defines those matches.)






          share|improve this answer
























          • ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

            – kurokashiro
            Nov 23 '18 at 7:56













          • Ah, great that you were able to figure it out!

            – Ingo Karkat
            Nov 23 '18 at 8:17
















          1














          This should not happen. I don't know artesanal (and "theme" is an undefined term inside Vim; it has colorschemes, filetype plugins, and syntax scripts; I hope it's not a full Vim "distribution" like spf-13 and Janus, which lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult)).



          It looks like a syntax is active even for plain files. Usually, the syntax is determined by the filetype, so check :verbose setlocal filetype? first. If this returns a value, you need to look into the detection of :help filetypes.



          If this is empty, it could also be that something sets 'syntax' directly. You can check in the same way: :verbose setlocal syntax?.



          Now, if that also is empty, and :syntax list doesn't show something, the highlighting could also come from :match or :call matchadd() commands; :call clearmatches() would remove this then. (And you still would need to find the source that defines those matches.)






          share|improve this answer
























          • ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

            – kurokashiro
            Nov 23 '18 at 7:56













          • Ah, great that you were able to figure it out!

            – Ingo Karkat
            Nov 23 '18 at 8:17














          1












          1








          1







          This should not happen. I don't know artesanal (and "theme" is an undefined term inside Vim; it has colorschemes, filetype plugins, and syntax scripts; I hope it's not a full Vim "distribution" like spf-13 and Janus, which lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult)).



          It looks like a syntax is active even for plain files. Usually, the syntax is determined by the filetype, so check :verbose setlocal filetype? first. If this returns a value, you need to look into the detection of :help filetypes.



          If this is empty, it could also be that something sets 'syntax' directly. You can check in the same way: :verbose setlocal syntax?.



          Now, if that also is empty, and :syntax list doesn't show something, the highlighting could also come from :match or :call matchadd() commands; :call clearmatches() would remove this then. (And you still would need to find the source that defines those matches.)






          share|improve this answer













          This should not happen. I don't know artesanal (and "theme" is an undefined term inside Vim; it has colorschemes, filetype plugins, and syntax scripts; I hope it's not a full Vim "distribution" like spf-13 and Janus, which lure you with a quick install and out-of-the-box settings, but you pay the price with increased complexity (you need to understand both Vim's runtime loading scheme and the arbitrary conventions of the distribution) and inflexibility (the distribution may make some things easier, but other things very difficult)).



          It looks like a syntax is active even for plain files. Usually, the syntax is determined by the filetype, so check :verbose setlocal filetype? first. If this returns a value, you need to look into the detection of :help filetypes.



          If this is empty, it could also be that something sets 'syntax' directly. You can check in the same way: :verbose setlocal syntax?.



          Now, if that also is empty, and :syntax list doesn't show something, the highlighting could also come from :match or :call matchadd() commands; :call clearmatches() would remove this then. (And you still would need to find the source that defines those matches.)







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 7:41









          Ingo KarkatIngo Karkat

          131k14148198




          131k14148198













          • ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

            – kurokashiro
            Nov 23 '18 at 7:56













          • Ah, great that you were able to figure it out!

            – Ingo Karkat
            Nov 23 '18 at 8:17



















          • ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

            – kurokashiro
            Nov 23 '18 at 7:56













          • Ah, great that you were able to figure it out!

            – Ingo Karkat
            Nov 23 '18 at 8:17

















          ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

          – kurokashiro
          Nov 23 '18 at 7:56







          ':verbose setlocal filetype?' got it fixed, there was something changing the file type to a javascript file which was why it was getting syntax highlighting.

          – kurokashiro
          Nov 23 '18 at 7:56















          Ah, great that you were able to figure it out!

          – Ingo Karkat
          Nov 23 '18 at 8:17





          Ah, great that you were able to figure it out!

          – Ingo Karkat
          Nov 23 '18 at 8:17













          0














          You can check to see if a filetype has been set



          if &filetype != ""
          syntax enable
          endif





          share|improve this answer
























          • I tried it but python and js files also trigger the if statement

            – kurokashiro
            Nov 23 '18 at 7:33
















          0














          You can check to see if a filetype has been set



          if &filetype != ""
          syntax enable
          endif





          share|improve this answer
























          • I tried it but python and js files also trigger the if statement

            – kurokashiro
            Nov 23 '18 at 7:33














          0












          0








          0







          You can check to see if a filetype has been set



          if &filetype != ""
          syntax enable
          endif





          share|improve this answer













          You can check to see if a filetype has been set



          if &filetype != ""
          syntax enable
          endif






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 6:37









          ConnerConner

          23.3k84568




          23.3k84568













          • I tried it but python and js files also trigger the if statement

            – kurokashiro
            Nov 23 '18 at 7:33



















          • I tried it but python and js files also trigger the if statement

            – kurokashiro
            Nov 23 '18 at 7:33

















          I tried it but python and js files also trigger the if statement

          – kurokashiro
          Nov 23 '18 at 7:33





          I tried it but python and js files also trigger the if statement

          – kurokashiro
          Nov 23 '18 at 7:33


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • 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%2fstackoverflow.com%2fquestions%2f53440881%2fhow-do-you-turn-off-syntax-highlighting-for-new-vim-windows-without-a-filename-o%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

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'