A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/37a86a2f964b5d6f9dbfae8b78acaa3a71f981bb below:

include event in get_autocmds (#17553) · neovim/neovim@37a86a2 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+13

-1

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+13

-1

lines changed Original file line number Diff line number Diff line change

@@ -197,6 +197,10 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)

197 197

"pattern",

198 198

STRING_OBJ(cstr_to_string((char *)ap->pat)));

199 199 200 +

PUT(autocmd_info,

201 +

"event",

202 +

STRING_OBJ(cstr_to_string((char *)event_nr2name(event))));

203 + 200 204

PUT(autocmd_info, "once", BOOLEAN_OBJ(ac->once));

201 205 202 206

if (ap->buflocal_nr) {

Original file line number Diff line number Diff line change

@@ -598,7 +598,7 @@ event_T event_name2nr(const char_u *start, char_u **end)

598 598

/// @param[in] event Event to return name for.

599 599

///

600 600

/// @return Event name, static string. Returns "Unknown" for unknown events.

601 -

static const char *event_nr2name(event_T event)

601 +

const char *event_nr2name(event_T event)

602 602

FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_CONST

603 603

{

604 604

int i;

Original file line number Diff line number Diff line change

@@ -217,6 +217,14 @@ describe('autocmd api', function()

217 217

eq(1, #new_aus)

218 218

eq(first, new_aus[1])

219 219

end)

220 + 221 +

it('should return event name', function()

222 +

command [[au! InsertEnter]]

223 +

command [[au InsertEnter * :echo "1"]]

224 + 225 +

local aus = meths.get_autocmds { event = "InsertEnter" }

226 +

eq({ { buflocal = false, command = ':echo "1"', event = "InsertEnter", once = false, pattern = "*" } }, aus)

227 +

end)

220 228

end)

221 229 222 230

describe('groups', function()

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4