Is it possible to have a single line in a file that acts as both a vim modeline and an emacs local variables line? If so, what would the syntax look like?
I realize that I can do it with two lines: by putting the emacs local-variable line as the 1st line of the file, and the vim modeline as the 2nd line (or 3rd, 4th, or 5th, if the modelines
is unchanged from its default value); for example, for the case of an HTML file, like this:
<!-- -*- mode: Text; fill-column: 100 -*- -->
<!-- vim: set textwidth=100 : -->
But I’m wondering if I can put both on the same single line and still have vim and emacs parse them as expected—and if so, what the syntax would be.
Yes, it’s possible; you can do something like this:
<!-- -*- mode: Text; fill-column: 100 -*- vim: set textwidth=100 :-->
…and then if you open that file in emacs and check the value of fill-column
, you’ll see that it's been set to 100
as expected; and open it in vim and check the value of textwidth
and you’ll see that it’s been set to 100
as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With