Question

Is there equivalent plugin like modeline_magic from VIM?

So each file could look like e.g.:

/* vim: set tabstop=8:softtabstop=8:shiftwidth=8:noexpandtab */ 
int main(int, char *) {}

and indentation would be passed to other clients?

Was it helpful?

Solution

You can add local (file) variables by having a line formatted as

-*- mode: modename; var: value; ... -*-

at the start of your file. Any number of var: value; pairs can appear in the line. If you're finding that you have too many local variables, you can change the style to

 # Local Variables:  
 # mode: python      
 # comment-column: 0 
 # End:              

Emacs searches for the string "Local Variables", and is smart enough to work out that the prefix and suffix (in this case # and nothing) should be reused for the following lines. This means that if the file is something other than python, you can change the prefix/suffix to match the different comment characters, e.g. /* and */ for ANSI C.

You can read more at the emacs manual.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top