-1

For a specific file I need some dedicate configurations.

So, I put this in the top of the file:

% vim: noremap a <ESC>l<ESC>

I get the following error message:

"test" 2L, 30B
Error detected while processing modelines:
line    1:
E518: Unknown option: a
Press ENTER or type command to continue

So, how can I force remap command for specific file in the vim: preamble mechanism?

1
  • There is no "remap command".
    – romainl
    Commented May 3, 2023 at 7:19

1 Answer 1

2

You can't. You are probably thinking of modelines, but those allow you to only specify specific options when starting to edit that particular file (and only if the modeline and modelineexpr options are set and even then not only all options, since those could be considered a security risk).

But in any case, it only allows you to set some specific options and nothing more. You cannot create autocommands, map keys or run ex commands. If you really want that, you would need to create a BufEnter autocommand (e.g. in your vimrc file) and specify your mapping there. (Make sure to use buffer-local options and mappings in any case).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.