|
1 | | -*options.txt* For Vim version 9.2. Last change: 2026 Apr 09 |
| 1 | +*options.txt* For Vim version 9.2. Last change: 2026 Apr 11 |
2 | 2 |
|
3 | 3 |
|
4 | 4 | VIM REFERENCE MANUAL by Bram Moolenaar |
@@ -8624,6 +8624,58 @@ A jump table for the options with a short description can be found at |Q_op|. |
8624 | 8624 | @ - Inserts a newline. This only takes effect when the "maxheight" |
8625 | 8625 | value of 'statuslineopt' is greater than 1, or for |tabpanel|. |
8626 | 8626 |
|
| 8627 | + *stl-%[FuncName]* |
| 8628 | + %[ defines clickable regions in the statusline. When the user clicks |
| 8629 | + on a region with the mouse, the specified function is called. The |
| 8630 | + same syntax can also be used in 'tabline'. |
| 8631 | + |
| 8632 | + %[FuncName] Start of a clickable region. "FuncName" is the name |
| 8633 | + of a Vim function to call when the region is clicked. |
| 8634 | + %[] End of the clickable region. If omitted, the region |
| 8635 | + extends to the end of the statusline or to the start |
| 8636 | + of the next clickable region. |
| 8637 | + |
| 8638 | + A {minwid} value can be used to pass an identifier to the callback: |
| 8639 | + %3[FuncName] Starts a clickable region with minwid 3. |
| 8640 | + |
| 8641 | + The function receives a single |Dictionary| argument with these |
| 8642 | + entries: |
| 8643 | + "minwid" The minwid value from %N[Func] (0 if not specified). |
| 8644 | + "nclicks" Number of clicks: 1, 2, or 3. |
| 8645 | + "button" Mouse button: "l" (left), "m" (middle), "r" (right). |
| 8646 | + "mods" Modifier keys: combination of "s" (shift), "c" (ctrl), |
| 8647 | + "a" (alt). Empty string if no modifiers. |
| 8648 | + "winid" |window-ID| of the window whose statusline was clicked, |
| 8649 | + or 0 when the click was in 'tabline'. |
| 8650 | + "area" "statusline" or "tabline". Indicates which option the |
| 8651 | + clicked region belongs to. Useful when a single |
| 8652 | + callback is shared between 'statusline' and 'tabline'. |
| 8653 | + |
| 8654 | + If the function returns non-zero, the statusline is redrawn. |
| 8655 | + Dragging the statusline to resize the window still works even when |
| 8656 | + click handlers are defined. When used in 'tabline', clicks in |
| 8657 | + %[FuncName] regions are dispatched to the callback instead of the |
| 8658 | + default tab-selection behavior. |
| 8659 | + |
| 8660 | + Example: > |
| 8661 | + func! ClickFile(info) |
| 8662 | + if a:info.button ==# 'l' && a:info.nclicks == 2 |
| 8663 | + browse edit |
| 8664 | + endif |
| 8665 | + return 0 |
| 8666 | + endfunc |
| 8667 | + set statusline=%[ClickFile]%f%[]\ %l:%c |
| 8668 | +< This makes the filename in the statusline clickable. Double-clicking |
| 8669 | + it opens the file browser. |
| 8670 | + |
| 8671 | + Use `has('statusline_click')` to check if this feature is available. |
| 8672 | + This is useful for backward compatibility: > |
| 8673 | + if has('statusline_click') |
| 8674 | + set statusline=%[ClickFile]%f%[]\ %l:%c |
| 8675 | + else |
| 8676 | + set statusline=%f\ %l:%c |
| 8677 | + endif |
| 8678 | +< |
8627 | 8679 | When displaying a flag, Vim removes the leading comma, if any, when |
8628 | 8680 | that flag comes right after plaintext. This will make a nice display |
8629 | 8681 | when flags are used like in the examples below. |
|
0 commit comments