Why vim does not recognize new runlevel7 in inittab

init.drc.drunlevel

Mainly for test purpose, I wish to modify /etc/inittab and add a new runlevel to my system (/etc/rc7.d). I have not save my modification yet, because I'm confused by Vim behavior. Indeed, the editor seems to not recognized the new runlevel as… a new runlevel (like rc 2,3,4 and so on). Here is a screen capture :

<code>Vim</code> screen capture

As you can see, Vim hi-lights in red the number seven and it "lowlights" the address of the config file from yellow to standard green (like thing which are not particular recognized). I'm wondering why does Vim don't act with the new runlevel as it was a standard one?

Best Answer

It looks like Vim is smart enough to give you a clue as to what the problem is! That's interesting.

The problem is that there is no such runlevel as 7. The valid run levels are s (or S), 0, 1, 2, 3, 4, 5, and 6. According to the manpage of my copy of init there also exist also pseudo-runlevels a, b, and c though I have never heard of those before.

EDIT: It seems that runlevels 7 through 9 do actually exist, but they are undocumented. I read the init source code under Debian wheezy to confirm it's true! Thanks for pointing that out.

So it turns out that what you are trying to do should actually work. But it's no surprise that Vim doesn't know about it since it's... well... undocumented. I would add also that it might not be very portable.

Related Question