bash vi mode: What does # -*- mode: ruby -*- # vi: set ft=ruby : mean?
5,876
Those lines are modelines which tell an editor (e.g. emacs or vi) to choose a specific editing mode for a file. An editing mode affects how editor e.g. higlights and indents contents of the file.
You can read more about modelines for emacs (which are called file-local variables) here and modelines for vim here.
Related videos on Youtube
Author by
michaelsnowden
Updated on September 18, 2022Comments
-
michaelsnowden over 1 year
I'm looking through some random code, and at the top of it, it says this:
# -*- mode: ruby -*- # vi: set ft=ruby :
What does this mean?
I know it's a simple question, but I couldn't find it out online because a) I don't even know what language this code is written in, and b) I'm very new to bash and vi.
-
Michał Politowski over 10 yearsThis question doesn't seem to have anything to do with bash.
-
-
romainl over 10 yearsIt's modeline not magical line.
-
Admin over 10 yearsActually it's most often called magical modeline where I come from, just to distinguish it from modeline of emacs which is entirely different thing.
-
romainl over 10 yearsWell, in Vim, it's called "modeline" and in Emacs it's called "file-local variables".
-
Admin over 10 yearsI suggest an edit then.