Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,31 @@ Set `disable_insert_on_commit = true` in your call to [`setup`](#configuration)

## Events

Neogit emits a `NeogitStatusRefreshed` event whenever the status gets reloaded.
Neogit emits the following events:

You can listen to the event using the following code:
| Event | Description |
|-------------------------|----------------------------------|
| `NeogitStatusRefreshed` | Status has been reloaded |
| `NeogitCommitComplete` | Commit has been created |
| `NeogitPushComplete` | Push has completed |


You can listen to the events using the following code:

```vim
autocmd User NeogitStatusRefreshed echom "Hello World!"
```

Further information can be found under `:h autocmd`.
Or, if you prefer to configure autocommands via Lua:

```lua
local group = vim.api.nvim_create_augroup('MyCustomNeogitEvents', { clear = true })
vim.api.nvim_create_autocmd('User', {
pattern = 'NeogitPushComplete',
group = group,
callback = require('neogit').close,
})
```

## Magit-style Keybindings

Expand Down
1 change: 1 addition & 0 deletions lua/neogit/popups/commit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ local function do_commit(popup, data, cmd, skip_gen)
if result.code == 0 then
a.uv.fs_unlink(commit_file)
status.refresh(true)
vim.cmd([[do <nomodeline> User NeogitCommitComplete]])
end
end

Expand Down
1 change: 1 addition & 0 deletions lua/neogit/popups/push.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ local function push_to(popup, name, remote, branch)
logger.error("Pushed to " .. name)
notif.create("Pushed to " .. name)
status.refresh(true)
vim.cmd([[do <nomodeline> User NeogitPushComplete]])
else
logger.error("Failed to push to " .. name)
end
Expand Down