autocmds general usage

18 views
Skip to first unread message

Christopher

unread,
Apr 1, 2026, 10:43:09 AM (3 days ago) Apr 1
to vim_use
I have a general question about autocmd, how can I use it without always having invoke it by using ":" then loading the appropriate commands then finally the file to which I want it to apply or must I script it ?



D. Ben Knoble

unread,
Apr 3, 2026, 12:14:34 PM (yesterday) Apr 3
to vim_use
On Wednesday, April 1, 2026 at 10:43:09 AM UTC-4 Christopher wrote:
I have a general question about autocmd, how can I use it without always having invoke it by using ":" then loading the appropriate commands then finally the file to which I want it to apply or must I script it ?

I don't understand the question (what do you mean "use it" without "using ':'", etc.?), but:

The typical practice for autocommands is to put them in your vimrc (~/.vim/vimrc, etc.) or a local plugin (~/.vim/plugin/<name>.vim) so they are established during startup.

Some customizations don't required autocommands, though: if you're customizing the behavior of a particular filetype, then use an ftplugin, indent, or syntax script. (Or your filetype may already have knobs to tweak; see `:help :syn-file-remarks`, `:help ftplugin-docs`, `:help local-additions`, etc. Completing with `:help ft-<filetype><Ctrl-d>` is usually good too.)
Reply all
Reply to author
Forward
0 new messages