Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    The script that defines the :Highlight command is not yet sourced by the time the vimrc file is loaded. Simple way to fix it: put those :Highlight commands into a function and let that be run on an VimEnter autocommand. Commented Apr 4, 2022 at 11:45
  • @ChristianBrabandt I think I get what you're saying in an abstract way (I guess it's similar to how you would define function prototypes in C, to define them at the bottom of the file?), but I'm not sure how to do it in practice. I'm very new to writing my own vimrc code. Could you show a basic example in an answer? It would probably be a good candidate for an accepted answer. Commented Apr 4, 2022 at 12:25
  • You might want to read the :help startup page to get an idea of when code is executed. Then take a look at :help function and :help autocmd for those. Commented Apr 4, 2022 at 14:47