Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
14
rated 0 times [  14] [ 0]  / answers: 1 / hits: 4725  / 3 Years ago, mon, may 31, 2021, 2:06:36

There is a gedit plugin called Modelines and the plugin is described as




Emacs, Kate and Vim-style modelines support for gedit.




What are modelines? And how do they work in gedit?


More From » gedit

 Answers
0

Modelines allow you to set preferences on a file-by-file basis, and allow you to mimic some of the preference-setting options of a few other popular editors (Vim, Emacs, and Kate).



For example, if you have your gedit preferences set to use 4 spaces per indentation, you can use modelines to override this and set only 2 spaces per indentation on that particular file.



Actually creating modelines in your documents is another matter, though. It can be rather complex (look at the documentation for the Kate modelines), and is generally suited to people who are intimately familiar with their editors of choice. This is why the gedit documentation links out to the various manuals for Vim, Emacs, and Kate, rather than describing their modelines in detail within the documentation.



Here is a sample vim-style modeline in a python file. Let's call it test.py. The line at the end turns on the modelines, sets the tab spaces at 24 spaces (clearly a bad python coding practice, but done just for effect here), and turns off the expanded tabs feature.



print "hello"
print "say what?"

# ex:set ts=24 noet:


Give it a try in gedit and let me know if it works for you. The vim modeline options are documented fairly well here. If you would like to wade through the Emacs documentation to find their modeline options, you are welcome to do so. :)


[#43760] Monday, May 31, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bunsistent

Total Points: 198
Total Questions: 108
Total Answers: 121

Location: Monaco
Member since Sun, Jan 16, 2022
2 Years ago
;