Reputation: 103
How can I have vim commands at the top of a file, like the shebang convention? An example is best:
#/usr/bin/env python3
#v set textwidth=70
print("Hello")
In this example, Vim would look for a comment starting with #v
, and execute the following command.
TL;DR: how can I make Vim run specific commands by opening a file, not linked to a file type, and not by adding lines to my init.vim
? Plugins are also an option.
Upvotes: 1
Views: 632
Reputation: 196826
You are looking for:
:help modeline
Note that adding self-serving modelines to files in a shared project is generally seen as pollution and frowned upon.
Upvotes: 4