-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimdoc.diff
More file actions
227 lines (211 loc) · 9.57 KB
/
vimdoc.diff
File metadata and controls
227 lines (211 loc) · 9.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 219737f2d..e8b9518e5 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -231,6 +231,7 @@ garbagecollect([{atexit}]) none free memory, breaking cyclic
get({list}, {idx} [, {def}]) any get item {idx} from {list} or {def}
get({dict}, {key} [, {def}]) any get item {key} from {dict} or {def}
get({func}, {what}) any get property of funcref/partial {func}
+getbgcolor() List get background colour as [r, g, b]
getbufinfo([{buf}]) List information about buffers
getbufline({buf}, {lnum} [, {end}])
List lines {lnum} to {end} of buffer {buf}
@@ -4034,6 +4035,25 @@ getbufvar({buf}, {varname} [, {def}]) *getbufvar()*
Return type: any, depending on {varname}
+getbgcolor() *getbgcolor()*
+ Returns a |List| describing the current background colour
+ as [red, green, blue], each component in the range 0..255.
+
+ In the GUI (or with 'termguicolors' set) the value comes
+ from the |hl-Normal| highlight group's background. In a
+ terminal it comes from the OSC 11 response (also available
+ as |v:termrbgresp|).
+ Returns [] when no value is available, e.g. before the
+ terminal has answered the OSC 11 query, or when |hl-Normal|
+ has no background colour set.
+
+ Useful when manually crafting RGB image data and you want
+ to flatten alpha onto the same colour the terminal will
+ actually display behind the image.
+
+ Return type: list<any>
+
+
getcellpixels() *getcellpixels()*
Returns a |List| of terminal cell pixel size.
List format is [xpixel, ypixel].
@@ -13280,6 +13300,13 @@ hangul_input Compiled with Hangul input support. |hangul|
hpux HP-UX version of Vim.
hurd GNU/Hurd version of Vim
iconv Can use iconv() for conversion.
+image Compiled with the popup window "image" attribute.
+ See |popup-image|.
+image_cairo Compiled with the Cairo image backend (GTK GUI).
+image_gdi Compiled with the GDI image backend (Windows GUI).
+image_kitty Compiled with the kitty graphics protocol image backend
+ (terminal).
+image_sixel Compiled with the DEC sixel image backend (terminal).
insert_expand Compiled with support for CTRL-X expansion commands in
Insert mode. (always true)
job Compiled with support for |channel| and |job|
diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index 2e9124477..a06924b99 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -1,4 +1,4 @@
-*popup.txt* For Vim version 9.2. Last change: 2026 May 17
+*popup.txt* For Vim version 9.2. Last change: 2026 Jun 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -23,6 +23,7 @@ Displaying text in a popup window. *popup* *popup-window* *popupwin*
Popup scrollbar |popup-scrollbar|
Popup opacity |popup-opacity|
Popup mask |popup-mask|
+ Popup image |popup-image|
4. Examples |popup-examples|
@@ -798,6 +799,18 @@ The second argument of |popup_create()| is a dictionary with options:
underlying text, making it partially transparent.
Requires 'termguicolors' to be set.
Also see |popup-opacity|.
+ image Dictionary describing a raw RGB or RGBA pixel buffer
+ to render inside the popup. When set the popup
+ auto-sizes its cell box from the image's pixel
+ dimensions, so "minwidth" / "minheight" / "maxwidth" /
+ "maxheight" do not need to be set by hand. Keys:
+ data |Blob| of bytes; length must equal
+ width*height*3 (RGB) or width*height*4
+ (RGBA).
+ width image width in pixels.
+ height image height in pixels.
+ Use an empty dictionary to remove a previously set
+ image. See |popup-image|.
padding List with numbers, defining the padding
above/right/below/left of the popup (similar to CSS).
An empty list uses a padding of 1 all around. The
@@ -1155,6 +1168,76 @@ For example, to make the last 10 columns of the last line transparent:
To make the four corners transparent:
[[1, 1, 1, 1], [-1, -1, 1, 1], [1, 1, -1, -1], [-1, -1, -1, -1]]
+POPUP IMAGE *popup-image*
+
+A popup window can render an image instead of (or on top of) text by passing
+an "image" dictionary to |popup_create()| or |popup_setoptions()|. The
+caller supplies an already-decoded raw pixel buffer and Vim emits it through
+whichever backend is available at runtime:
+
+ sixel DEC sixel DCS sequence on a sixel-capable terminal.
+ |+image_sixel|. Detected automatically; the buffer is also
+ cropped one cell above the screen edge to avoid sixel-induced
+ terminal scrolling.
+ kitty kitty graphics protocol APC sequence on terminals that support
+ it (kitty, ghostty, WezTerm, Konsole, ...). |+image_kitty|.
+ Detected by actively querying the terminal.
+ GDI StretchDIBits onto the GUI canvas on the MS-Windows GUI.
+ |+image_gdi|.
+ Cairo composite onto a cairo_image_surface_t on the GTK GUI
+ (covers GTK 2 and GTK 3). |+image_cairo|.
+
+Vim itself does NOT link against libpng, libjpeg, libwebp or any image
+decoder. Format decoding is left to the caller, who can pipe the file
+through any external tool (GraphicsMagick, ImageMagick, ffmpeg, a custom
+converter, ...) and pass the resulting bytes via a |Blob|.
+
+The "image" dictionary accepts:
+ data |Blob| of bytes. Length must equal width*height*3 for RGB,
+ or width*height*4 for RGBA. RGBA buffers are alpha-composited
+ over the popup's background.
+ width image width in pixels.
+ height image height in pixels.
+
+The popup's cell box is derived from the pixel dimensions and the terminal /
+GUI cell metrics, so the caller does not normally have to set "minwidth" /
+"minheight" / "maxwidth" / "maxheight".
+
+For RGBA buffers that need to blend cleanly into the editor's actual
+backdrop the script can call |getbgcolor()| to obtain the current background
+colour as [r, g, b] and pre-composite anti-aliased edges against it.
+
+Minimal RGB example - a 4x4 red square popped at the cursor: >
+ let pixels = repeat([0xff, 0x00, 0x00], 4 * 4)->list2blob()
+ call popup_create('', #{
+ \ image: #{ data: pixels, width: 4, height: 4 },
+ \ line: 'cursor+1', col: 'cursor',
+ \ })
+
+Real-world example - pipe a PNG through GraphicsMagick and pop the resulting
+raw RGB bytes: >
+ let png = 'cat.png'
+ let dim = split(system('gm identify -format "%w %h" '
+ \ .. shellescape(png)))
+ let [w, h] = [str2nr(dim[0]), str2nr(dim[1])]
+ call system('gm convert ' .. shellescape(png)
+ \ .. ' -depth 8 rgb:/tmp/cat.rgb')
+ let blob = readblob('/tmp/cat.rgb')
+ call popup_create('', #{
+ \ image: #{ data: blob, width: w, height: h },
+ \ line: 1, col: 1, border: [], padding: [0, 0, 0, 0],
+ \ })
+
+The image can be replaced at runtime via |popup_setoptions()|. When the new
+buffer has the same width and height as the current one the pixels are
+swapped in place, which is fast enough to drive frame-by-frame animation
+from a |timer|. |popup_getoptions()| returns the same dictionary back; the
+"data" entry is a fresh blob copy independent of the popup's internal
+buffer.
+
+To remove a previously set image pass an empty dictionary: >
+ call popup_setoptions(winid, #{image: {}})
+
==============================================================================
4. Examples *popup-examples*
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 560f01c70..cb816a0cb 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 9.2. Last change: 2026 Apr 28
+*usr_41.txt* For Vim version 9.2. Last change: 2026 Jun 09
VIM USER MANUAL by Bram Moolenaar
@@ -1203,6 +1203,7 @@ Interactive: *interactive-functions*
inputrestore() restore typeahead
GUI: *gui-functions*
+ getbgcolor() get current background colour as [r, g, b]
getfontname() get name of current font being used
getwinpos() position of the Vim window
getwinposx() X position of the Vim window
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 34815811f..cc3ef1075 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -1,4 +1,4 @@
-*various.txt* For Vim version 9.2. Last change: 2026 Jun 07
+*various.txt* For Vim version 9.2. Last change: 2026 Jun 09
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -423,6 +423,11 @@ N *+gettext* message translations |multi-lang|
m *+hangul_input* Hangul input support |hangul|
*+iconv* Compiled with the |iconv()| function
*+iconv/dyn* Likewise |iconv-dynamic| |/dyn|
+H *+image* popup window image attribute, see |popup-image|
+H *+image_cairo* |+image| Cairo backend (GTK GUI)
+H *+image_gdi* |+image| GDI backend (Windows GUI)
+H *+image_kitty* |+image| kitty graphics protocol backend (terminal)
+H *+image_sixel* |+image| DEC sixel backend (terminal)
T *+insert_expand* |insert_expand| Insert mode completion
m *+ipv6* Support for IPv6 networking |channel|
m *+job* starting and stopping jobs |job|
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index b0c95e50f..937bf4f21 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -52600,6 +52600,8 @@ Popups ~
- Support for clipping textproperty popups |popup-clipwindow|.
- Completion popup menu can be scrolled with the mouse or using keys
|popupmenu-keys|.
+- Support for loading images in popups using the cairo, GDI, kitty, or sixel
+ backend |popup-image|.
Diff mode ~
---------
@@ -52685,6 +52687,7 @@ Various syntax, indent and other plugins were added.
Functions: ~
|ch_listen()| listen on {address}
+|getbgcolor()| return background color as RGB value
|tabpanel_getinfo()| get current state of the |tabpanel|
|tabpanel_scroll()| scroll the |tabpanel|