@@ -170,6 +170,49 @@ func BufferMark(buffer Buffer, name string) [2]int {
170
170
name (nvim_buf_get_mark )
171
171
}
172
172
173
+ // BufferExtmarkByID returns position for a given extmark id.
174
+ func BufferExtmarkByID (buffer Buffer , nsID int , id int ) []int {
175
+ name (nvim_buf_get_extmark_by_id )
176
+ }
177
+
178
+ // BufferExtmarks gets extmarks in "traversal order" from a charwise region defined by
179
+ // buffer positions (inclusive, 0-indexed).
180
+ //
181
+ // Region can be given as (row,col) tuples, or valid extmark ids (whose
182
+ // positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
183
+ // respectively, thus the following are equivalent:
184
+ //
185
+ // BufferExtmarks(0, myNS, 0, -1, {})
186
+ // BufferExtmarks(0, myNS, [0,0], [-1,-1], {})
187
+ //
188
+ // If `end` is less than `start`, traversal works backwards. (Useful
189
+ // with `limit`, to get the first marks prior to a given position.)
190
+ //
191
+ // The `opts` is additional options. Supports the key:
192
+ // limit: (int) Maximum number of marks to return.
193
+ func BufferExtmarks (buffer Buffer , nsID int , start interface {}, end interface {}, opt map [string ]interface {}) []ExtMarks {
194
+ name (nvim_buf_get_extmarks )
195
+ }
196
+
197
+ // SetBufferExtmark creates or updates an extmark.
198
+ //
199
+ // To create a new extmark, pass id=0. The extmark id will be returned.
200
+ // To move an existing mark, pass its id.
201
+ //
202
+ // It is also allowed to create a new mark by passing in a previously unused
203
+ // id, but the caller must then keep track of existing and unused ids itself.
204
+ // (Useful over RPC, to avoid waiting for the return value.)
205
+ //
206
+ // Currently opts arg not used.
207
+ func SetBufferExtmark (buffer Buffer , nsID int , extmarkID int , line int , col int , opts map [string ]interface {}) int {
208
+ name (nvim_buf_set_extmark )
209
+ }
210
+
211
+ // DeleteBufferExtmark removes an extmark.
212
+ func DeleteBufferExtmark (buffer Buffer , nsID int , extmarkID int ) bool {
213
+ name (nvim_buf_del_extmark )
214
+ }
215
+
173
216
// AddBufferHighlight adds a highlight to buffer and returns the source id of
174
217
// the highlight.
175
218
//
@@ -242,6 +285,20 @@ func SetBufferVirtualText(buffer Buffer, nsID int, line int, chunks []VirtualTex
242
285
name (nvim_buf_set_virtual_text )
243
286
}
244
287
288
+ // BufferVirtualText gets the virtual text (annotation) for a buffer line.
289
+ //
290
+ // The virtual text is returned as list of lists, whereas the inner lists have
291
+ // either one or two elements. The first element is the actual text, the
292
+ // optional second element is the highlight group.
293
+ //
294
+ // The format is exactly the same as given to SetBufferVirtualText.
295
+ //
296
+ // If there is no virtual text associated with the given line, an empty list
297
+ // is returned.
298
+ func BufferVirtualText (buffer Buffer , lnum int ) []VirtualTextChunk {
299
+ name (nvim_buf_get_virtual_text )
300
+ }
301
+
245
302
// TabpageWindows returns the windows in a tabpage.
246
303
func TabpageWindows (tabpage Tabpage ) []Window {
247
304
name (nvim_tabpage_list_wins )
@@ -318,6 +375,19 @@ func TryResizeUIGrid(grid, width, height int) {
318
375
name (nvim_ui_try_resize_grid )
319
376
}
320
377
378
+ // SetPumHeight tells Nvim the number of elements displaying in the popumenu, to decide
379
+ // <PageUp> and <PageDown> movement.
380
+ //
381
+ // height is popupmenu height, must be greater than zero.
382
+ func SetPumHeight (height int ) {
383
+ name (nvim_ui_pum_set_height )
384
+ }
385
+
386
+ // Exec executes Vimscript (multiline block of Ex-commands), like anonymous source.
387
+ func Exec (src string , output bool ) string {
388
+ name (nvim_exec )
389
+ }
390
+
321
391
// Command executes a single ex command.
322
392
func Command (cmd string ) {
323
393
name (nvim_command )
@@ -328,6 +398,11 @@ func HLByID(id int, rgb bool) *HLAttrs {
328
398
name (nvim_get_hl_by_id )
329
399
}
330
400
401
+ // HLIDByName gets a highlight group by name.
402
+ func HLIDByName (name string ) int {
403
+ name (nvim_get_hl_id_by_name )
404
+ }
405
+
331
406
// HLByName gets a highlight definition by name.
332
407
func HLByName (name string , rgb bool ) * HLAttrs {
333
408
name (nvim_get_hl_by_name )
@@ -375,8 +450,11 @@ func ReplaceTermcodes(str string, fromPart bool, doLT bool, special bool) string
375
450
}
376
451
377
452
// CommandOutput executes a single ex command and returns the output.
453
+ //
454
+ // Deprecated: Use Exec() instead.
378
455
func CommandOutput (cmd string ) string {
379
456
name (nvim_command_output )
457
+ deprecatedSince (7 )
380
458
}
381
459
382
460
// Eval evaluates the expression expr using the Vim internal expression
@@ -570,6 +648,49 @@ func Namespaces() map[string]int {
570
648
name (nvim_get_namespaces )
571
649
}
572
650
651
+ // Paste pastes at cursor, in any mode.
652
+ //
653
+ // Invokes the `vim.paste` handler, which handles each mode appropriately.
654
+ // Sets redo/undo. Faster than Input(). Lines break at LF ("\n").
655
+ //
656
+ // Errors ('nomodifiable', `vim.paste()` failure, …) are reflected in `err`
657
+ // but do not affect the return value (which is strictly decided by
658
+ // `vim.paste()`). On error, subsequent calls are ignored ("drained") until
659
+ // the next paste is initiated (phase 1 or -1).
660
+ //
661
+ // data
662
+ // multiline input. May be binary (containing NUL bytes).
663
+ // crlf
664
+ // also break lines at CR and CRLF.
665
+ // phase
666
+ // -1 is paste in a single call (i.e. without streaming).
667
+ //
668
+ // To "stream" a paste, call Paste sequentially with these `phase` values:
669
+ // 1: starts the paste (exactly once)
670
+ // 2: continues the paste (zero or more times)
671
+ // 3: ends the paste (exactly once)
672
+ func Paste (data string , crlf bool , phase int ) bool {
673
+ name (nvim_paste )
674
+ }
675
+
676
+ // Put puts text at cursor, in any mode.
677
+ //
678
+ // Compare :put and p which are always linewise.
679
+ //
680
+ // lines is readfile() style list of lines.
681
+ //
682
+ // type is edit behavior: any getregtype() result, or:
683
+ // "b": blockwise-visual mode (may include width, e.g. "b3")
684
+ // "c": characterwise mode
685
+ // "l": linewise mode
686
+ // "" : guess by contents, see setreg()
687
+ // after is insert after cursor (like `p`), or before (like `P`).
688
+ //
689
+ // follow is place cursor at end of inserted text.
690
+ func Put (lines []string , typ string , after bool , follow bool ) {
691
+ name (nvim_put )
692
+ }
693
+
573
694
// Subscribe subscribes to a Nvim event.
574
695
func Subscribe (event string ) {
575
696
name (nvim_subscribe )
@@ -588,6 +709,24 @@ func ColorMap() map[string]int {
588
709
name (nvim_get_color_map )
589
710
}
590
711
712
+ // Context gets a map of the current editor state.
713
+ // This API still under development.
714
+ //
715
+ // The `opts` is optional parameters.
716
+ //
717
+ // types
718
+ // List of context-types to gather: "regs", "jumps", "bufs", "gvars", "funcs", "sfuncs".
719
+ // empty for all context.
720
+ func Context (opts map [string ][]string ) map [string ]interface {} {
721
+ name (nvim_get_context )
722
+ }
723
+
724
+ // LoadContext sets the current editor state from the given context map.
725
+ // This API still under development.
726
+ func LoadContext (dict map [string ]interface {}) interface {} {
727
+ name (nvim_load_context )
728
+ }
729
+
591
730
// Mode gets Nvim's current mode.
592
731
func Mode () Mode {
593
732
name (nvim_get_mode )
0 commit comments