Skip to main content
API module

events API

All 6 public APIs exported from the events module, with declarations, documentation, and source-backed examples.

Generated from typings/index.d.ts @ 555f5ceon

events

events.pumAlignTop

Latest pum position, is true when pum positioned above current line.

Source

API signature

events.pumAlignTop: boolean
Returns
boolean
Declaration
typings/index.d.ts:8226
events

events.insertMode

Insert mode detected by latest events.

Source

API signature

events.insertMode: boolean
Returns
boolean
Declaration
typings/index.d.ts:8230
events

events.pumvisible

Popup menu is visible.

Source

API signature

events.pumvisible: boolean
Returns
boolean
Declaration
typings/index.d.ts:8235
events

events.race

Wait for any of event in events to fire, resolve undefined when timeout or CancellationToken requested.

Source

API signature

events.race(events: AllEvents[], timeoutOrToken?: number | CancellationToken): Promise<{ name: AllEvents, args: unknown[] } | undefined>

Parameters

ParameterTypeDescription
eventsAllEvents[]

Event names to wait.

timeoutOrToken?number | CancellationToken

Timeout in miniseconds or CancellationToken.

Returns
Promise<{ name: AllEvents, args: unknown[] } | undefined>

A disposable that unregisters this provider when being disposed.

Declaration
typings/index.d.ts:8243
events

events.on

Attach handler to buffer events.

Source

Overloads (29)

  1. Signature 1
    events.on(event: BufEvents, handler: (bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: BufEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  2. Signature 2
    events.on(event: MoveEvents, handler: (bufnr: number, cursor: [number, number], hasInsert: boolean) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: MoveEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, cursor: [number, number], hasInsert: boolean) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  3. Signature 3
    events.on(event: HoldEvents, handler: (bufnr: number, cursor: [number, number], winid: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: HoldEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, cursor: [number, number], winid: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  4. Signature 4
    events.on(event: InsertChangeEvents, handler: (bufnr: number, info: InsertChange) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: InsertChangeEvents
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, info: InsertChange) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  5. Signature 5
    events.on(event: WindowEvents, handler: (winid: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: WindowEvents
    No parameter description is present in the pinned declaration.
    handler: (winid: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  6. Signature 6
    events.on(event: WindowEvents, handler: (winid: number, bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: WindowEvents
    No parameter description is present in the pinned declaration.
    handler: (winid: number, bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  7. Signature 7
    events.on(event: 'FloatBtnClick', handler: (bufnr: number, index: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'FloatBtnClick'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, index: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  8. Signature 8
    events.on(event: 'PromptKeyPress', handler: (bufnr: number, key: PromptWidowKeys) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'PromptKeyPress'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, key: PromptWidowKeys) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  9. Signature 9
    events.on(event: 'TextChanged', handler: (bufnr: number, changedtick: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TextChanged'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, changedtick: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  10. Signature 10
    events.on(event: 'TaskExit', handler: (id: string, code: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TaskExit'
    No parameter description is present in the pinned declaration.
    handler: (id: string, code: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  11. Signature 11
    events.on(event: 'TaskStderr' | 'TaskStdout', handler: (id: string, lines: string[]) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TaskStderr' | 'TaskStdout'
    No parameter description is present in the pinned declaration.
    handler: (id: string, lines: string[]) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  12. Signature 12
    events.on(event: 'BufReadCmd', handler: (scheme: string, fullpath: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'BufReadCmd'
    No parameter description is present in the pinned declaration.
    handler: (scheme: string, fullpath: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  13. Signature 13
    events.on(event: 'VimResized', handler: (columns: number, lines: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'VimResized'
    No parameter description is present in the pinned declaration.
    handler: (columns: number, lines: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  14. Signature 14
    events.on(event: 'MenuPopupChanged', handler: (event: PopupChangeEvent, cursorline: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'MenuPopupChanged'
    No parameter description is present in the pinned declaration.
    handler: (event: PopupChangeEvent, cursorline: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  15. Signature 15
    events.on(event: 'CompleteDone', handler: (item: VimCompleteItem & CompleteDoneItem | CompletionItem & CompleteDoneItem | {}) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'CompleteDone'
    No parameter description is present in the pinned declaration.
    handler: (item: VimCompleteItem & CompleteDoneItem | CompletionItem & CompleteDoneItem | {}) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  16. Signature 16
    events.on(event: 'CompleteStart', handler: (option: CompleteOption) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'CompleteStart'
    No parameter description is present in the pinned declaration.
    handler: (option: CompleteOption) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  17. Signature 17
    events.on(event: 'InsertCharPre', handler: (character: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'InsertCharPre'
    No parameter description is present in the pinned declaration.
    handler: (character: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  18. Signature 18
    events.on(event: 'FileType', handler: (filetype: string, bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'FileType'
    No parameter description is present in the pinned declaration.
    handler: (filetype: string, bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  19. Signature 19
    events.on(event: 'BufWinEnter' | 'BufWinLeave', handler: (bufnr: number, winid: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'BufWinEnter' | 'BufWinLeave'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, winid: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  20. Signature 20
    events.on(event: 'DirChanged', handler: (cwd: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'DirChanged'
    No parameter description is present in the pinned declaration.
    handler: (cwd: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  21. Signature 21
    events.on(event: 'OptionSet' | 'GlobalChange', handler: (option: string, oldVal: OptionValue, newVal: OptionValue) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'OptionSet' | 'GlobalChange'
    No parameter description is present in the pinned declaration.
    handler: (option: string, oldVal: OptionValue, newVal: OptionValue) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  22. Signature 22
    events.on(event: 'InputChar', handler: (session: string, character: string, mode: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'InputChar'
    No parameter description is present in the pinned declaration.
    handler: (session: string, character: string, mode: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  23. Signature 23
    events.on(event: 'PromptInsert', handler: (value: string, bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'PromptInsert'
    No parameter description is present in the pinned declaration.
    handler: (value: string, bufnr: number) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  24. Signature 24
    events.on(event: 'Command', handler: (name: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'Command'
    No parameter description is present in the pinned declaration.
    handler: (name: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  25. Signature 25
    events.on(event: 'WinScrolled', handler: (winid: number, bufnr: number, region: Readonly<[number, number]>) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'WinScrolled'
    No parameter description is present in the pinned declaration.
    handler: (winid: number, bufnr: number, region: Readonly<[number, number]>) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  26. Signature 26
    events.on(event: 'WindowVisible', handler: (event: VisibleEvent) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'WindowVisible'
    No parameter description is present in the pinned declaration.
    handler: (event: VisibleEvent) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  27. Signature 27
    events.on(event: 'TextInsert', handler: (bufnr: number, info: InsertChange, character: string) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: 'TextInsert'
    No parameter description is present in the pinned declaration.
    handler: (bufnr: number, info: InsertChange, character: string) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  28. Signature 28
    events.on(event: EmptyEvents, handler: () => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: EmptyEvents
    No parameter description is present in the pinned declaration.
    handler: () => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable
  29. Signature 29
    events.on(event: AllEvents[], handler: (...args: unknown[]) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable
    event: AllEvents[]
    No parameter description is present in the pinned declaration.
    handler: (...args: unknown[]) => EventResult
    No parameter description is present in the pinned declaration.
    thisArg?: any
    No parameter description is present in the pinned declaration.
    disposables?: Disposable[]
    No parameter description is present in the pinned declaration.
    Returns
    Disposable

API signature

events.on(event: BufEvents, handler: (bufnr: number) => EventResult, thisArg?: any, disposables?: Disposable[]): Disposable

Parameters

ParameterType
eventBufEvents
handler(bufnr: number) => EventResult
thisArg?any
disposables?Disposable[]
Returns
Disposable
Declaration
typings/index.d.ts:8248