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;
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 theftplugin/usenet.vim
file but this seemed to be ignored—running:set syntax?
in a file with the “usenet” filetype just producedusenet
.I also tried copying the
mail.vim
syntax file from$VIMRUNTIME/syntax
into~/.vim/syntax
, renaming it tousenet.vim
, and changing the linelet 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
add a comment |
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 theftplugin/usenet.vim
file but this seemed to be ignored—running:set syntax?
in a file with the “usenet” filetype just producedusenet
.I also tried copying the
mail.vim
syntax file from$VIMRUNTIME/syntax
into~/.vim/syntax
, renaming it tousenet.vim
, and changing the linelet 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
add a comment |
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 theftplugin/usenet.vim
file but this seemed to be ignored—running:set syntax?
in a file with the “usenet” filetype just producedusenet
.I also tried copying the
mail.vim
syntax file from$VIMRUNTIME/syntax
into~/.vim/syntax
, renaming it tousenet.vim
, and changing the linelet 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
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 theftplugin/usenet.vim
file but this seemed to be ignored—running:set syntax?
in a file with the “usenet” filetype just producedusenet
.I also tried copying the
mail.vim
syntax file from$VIMRUNTIME/syntax
into~/.vim/syntax
, renaming it tousenet.vim
, and changing the linelet 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
syntax-highlighting filetype
edited 9 hours ago
bdesham
asked 10 hours ago
bdeshambdesham
8079 silver badges13 bronze badges
8079 silver badges13 bronze badges
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
.
add a comment |
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
.
add a comment |
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
);
);
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%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
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered 7 hours ago
filbrandenfilbranden
7852 silver badges12 bronze badges
7852 silver badges12 bronze badges
add a comment |
add a comment |
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
.
add a comment |
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
.
add a comment |
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
.
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
.
answered 4 hours ago
dedowsdidedowsdi
2,0261 gold badge4 silver badges15 bronze badges
2,0261 gold badge4 silver badges15 bronze badges
add a comment |
add a comment |
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.
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%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
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