How do you turn off syntax highlighting for new vim windows without a filename or file type?
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.
vim vim-syntax-highlighting
add a comment |
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.
vim vim-syntax-highlighting
add a comment |
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.
vim vim-syntax-highlighting
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.
vim vim-syntax-highlighting
vim vim-syntax-highlighting
edited Nov 23 '18 at 8:16
Micha Wiedenmann
10.3k1364104
10.3k1364104
asked Nov 23 '18 at 5:01
kurokashirokurokashiro
32
32
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.)
':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
add a comment |
You can check to see if a filetype has been set
if &filetype != ""
syntax enable
endif
I tried it but python and js files also trigger the if statement
– kurokashiro
Nov 23 '18 at 7:33
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.)
':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
add a comment |
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.)
':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
add a comment |
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.)
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.)
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
add a comment |
':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
add a comment |
You can check to see if a filetype has been set
if &filetype != ""
syntax enable
endif
I tried it but python and js files also trigger the if statement
– kurokashiro
Nov 23 '18 at 7:33
add a comment |
You can check to see if a filetype has been set
if &filetype != ""
syntax enable
endif
I tried it but python and js files also trigger the if statement
– kurokashiro
Nov 23 '18 at 7:33
add a comment |
You can check to see if a filetype has been set
if &filetype != ""
syntax enable
endif
You can check to see if a filetype has been set
if &filetype != ""
syntax enable
endif
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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