My weapon-of-choice in Linux CLI is vim. However, out-of-the-box it acts very stubbornly when editing files with modeline. The nice modelines seem to have zero effect. WTF!?
To my amazement, it appears that modelines are turned off as a default. It can be verified with a simple echo command from vim:
:echo &modeline
will yield 0 as an answer. So step 1 is to enable them in ~/.vimrc, if the file does not exist, create it. If it does exist, make sure that it contains following:
set modeline
Then confirm that echo will display 1 to indicate that modeline is enforced. What a great idea to not enable them! Nice going suckers!
To create your own modeline, put something like this into your file:
# vim: tabstop=4 shiftwidth=4 softtabstop=4 expandtab:
It reads:
- tabstop=4
- The width of a TAB is set to 4. Still it is a \t. It is just that vim will interpret it to be having width of 4.
- shiftwidth=4
- Indents will have a width of 4
- softtabstop=4
- Sets the number of columns for a TAB
- expandtab