Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

WIP: autocommands #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

WIP: autocommands #97

wants to merge 1 commit into from

Conversation

nanotee
Copy link
Owner

@nanotee nanotee commented Feb 4, 2022

No description provided.

@clason
Copy link

clason commented Apr 17, 2022

Done now, and API bike-shedding is over as well. Here the documentation should be good, too, and require very little expanding on.

@clason
Copy link

clason commented Apr 21, 2022

But apparently there's some confusion about user autocommands -- people seem not to be aware that these are just standard autocommands with User as the event and Whatever as the pattern (instead often believe that User is some special keyword and Whatever is the event).

Maybe having such an autocommand as one of the examples would be helpful.

@Jarmos-san
Copy link

Jarmos-san commented Jun 12, 2022

Is this PR being worked on? If not I can share a PR with a way of creating Autocommands using the latest Neovim v0.7 API.

For a heads up, here's an example of what it could look like:

local augroup_name = vim.api.nvim_create_augroup(
    "AutogroupName", 
    { clear = true }
)

vim.api.nvim_create_autocommand(
    "BufWritePost",
    {
        command = echo "Recent changes saved!",
        group = augroup_name,
        pattern = "*"
    }
)

For more information on the Autocommand API, refer to :h api-autocmd

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants