Skip to content

Commit 474b981

Browse files
girishjichrisbra
authored andcommitted
patch 9.1.1835: completion: not possible to style popup borders globally
Problem: not possible to style popup borders globally Solution: Add the 'pumborder' option (Girish Palya) This commit introduces a new global option, 'pumborder' ('pb'), that allows users to define borders and optional decorations for the completion popup menu. ``` Defines a border and optional decorations for the popup menu in completion. The value is a comma-separated list of keywords. Border styles (at most one): "single"singleuse thin box-drawing characters "double"doubleuse double-line box-drawing characters "round"rounduse rounded corners "ascii"asciiuse ASCII characters (-, |, +) "custom:XXXXXXXX" use eight characters given after "custom:", in order: top, right, bottom, left, topleft, topright, botright, botleft Additional flags: "margin"marginadds one-cell spacing inside the left and right border "shadow"shadowdraws a shadow at the right and bottom edges Highlight groups: |hl-PmenuBorder|hl-PmenuBorderused for the border characters |hl-PmenuShadow|hl-PmenuShadowused for the shadow Examples: > :set pumborder=single :set pumborder=double,margin,shadow :set pumborder=custom:─│─│┌┐┘└,shadow Border styles using box-drawing characters ("single", "double", "round") are only available when |'encoding'| is "utf-8" and |'ambiwidth'| is "single". "margin" requires a border style. See also: |ins-completion-menu|. ``` fixes: vim/vim#18441 (comment) closes: #18486 closes: #17091 Signed-off-by: Girish Palya <[email protected]> Signed-off-by: Christian Brabandt <[email protected]>
1 parent 2c09368 commit 474b981

File tree

76 files changed

+1127
-95
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1127
-95
lines changed

ci/hlgroups.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Pmenu
3333
PmenuSbar
3434
PmenuSel
3535
PmenuThumb
36+
PmenuShadow
3637
Question
3738
Scrollbar
3839
Search

runtime/doc/options.txt

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4683,7 +4683,8 @@ A jump table for the options with a short description can be found at |Q_op|.
46834683
=:PmenuSel, k:PmenuMatch,<:PmenuMatchSel,
46844684
[:PmenuKind,]:PmenuKindSel,
46854685
{:PmenuExtra,}:PmenuExtraSel,
4686-
x:PmenuSbar,X:PmenuThumb,*:TabLine,
4686+
x:PmenuSbar,X:PmenuThumb,j:PmenuBorder,
4687+
H:PmenuShadow,*:TabLine,
46874688
#:TabLineSel,_:TabLineFill,!:CursorColumn,
46884689
.:CursorLine,o:ColorColumn,q:QuickFixLine,
46894690
z:StatusLineTerm,Z:StatusLineTermNC,
@@ -4750,6 +4751,8 @@ A jump table for the options with a short description can be found at |Q_op|.
47504751
|hl-PmenuThumb| X popup menu scrollbar thumb
47514752
|hl-PmenuMatch| k popup menu matched text
47524753
|hl-PmenuMatchSel| < popup menu matched text in selected line
4754+
|hl-PmenuBorder| j popup menu border characters
4755+
|hl-PmenuShadow| H popup menu shadow
47534756
|hl-PreInsert| I text inserted when "preinsert" is in 'completeopt'
47544757

47554758
The display modes are:
@@ -6787,6 +6790,40 @@ A jump table for the options with a short description can be found at |Q_op|.
67876790
global
67886791
When on a ":" prompt is used in Ex mode.
67896792

6793+
*'pumborder'* *'pb'*
6794+
'pumborder' 'pb' string (default "")
6795+
global
6796+
Defines a border and optional decorations for the popup menu in
6797+
completion. The value is a comma-separated list of keywords.
6798+
6799+
Border styles (at most one):
6800+
"single" use thin box-drawing characters
6801+
"double" use double-line box-drawing characters
6802+
"round" use rounded corners
6803+
"ascii" use ASCII characters (-, |, +)
6804+
"custom:X;X;X;X;X;X;X;X"
6805+
use eight characters separated by semicolons, in the
6806+
order: top, right, bottom, left,
6807+
topleft, topright, botright, botleft
6808+
6809+
Additional flags:
6810+
"margin" adds one-cell spacing inside the left and right border
6811+
"shadow" draws a shadow at the right and bottom edges
6812+
6813+
Highlight groups:
6814+
|hl-PmenuBorder| used for the border characters
6815+
|hl-PmenuShadow| used for the shadow
6816+
6817+
Examples: >
6818+
:set pumborder=single
6819+
:set pumborder=double,margin,shadow
6820+
:set pumborder=custom:─;│;─;│;┌;┐;┘;└,shadow
6821+
<
6822+
Border styles using box-drawing characters ("single", "double",
6823+
"round") are only available when |'encoding'| is "utf-8" and
6824+
|'ambiwidth'| is "single". "margin" requires a border style.
6825+
See also: |ins-completion-menu|.
6826+
67906827
*'pumheight'* *'ph'*
67916828
'pumheight' 'ph' number (default 0)
67926829
global

runtime/doc/syntax.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6024,6 +6024,11 @@ PmenuMatch Popup menu: Matched text in normal item. Applied in
60246024
*hl-PmenuMatchSel*
60256025
PmenuMatchSel Popup menu: Matched text in selected item. Applied in
60266026
combination with |hl-PmenuSel|.
6027+
*hl-PmenuBorder*
6028+
PmenuBorder Popup menu: Border characters.
6029+
Linked to |hl-Pmenu| by default.
6030+
*hl-PmenuShadow*
6031+
PmenuShadow Popup menu: Used for shadow.
60276032
*hl-ComplMatchIns*
60286033
ComplMatchIns Matched text of the currently inserted completion.
60296034
*hl-PreInsert*

runtime/doc/tags

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,7 @@ $quote eval.txt /*$quote*
858858
'patchexpr' options.txt /*'patchexpr'*
859859
'patchmode' options.txt /*'patchmode'*
860860
'path' options.txt /*'path'*
861+
'pb' options.txt /*'pb'*
861862
'pdev' options.txt /*'pdev'*
862863
'penc' options.txt /*'penc'*
863864
'perldll' options.txt /*'perldll'*
@@ -887,6 +888,7 @@ $quote eval.txt /*$quote*
887888
'printoptions' options.txt /*'printoptions'*
888889
'prompt' options.txt /*'prompt'*
889890
'pt' options.txt /*'pt'*
891+
'pumborder' options.txt /*'pumborder'*
890892
'pumheight' options.txt /*'pumheight'*
891893
'pummaxwidth' options.txt /*'pummaxwidth'*
892894
'pumwidth' options.txt /*'pumwidth'*
@@ -8384,6 +8386,7 @@ hl-MsgArea syntax.txt /*hl-MsgArea*
83848386
hl-NonText syntax.txt /*hl-NonText*
83858387
hl-Normal syntax.txt /*hl-Normal*
83868388
hl-Pmenu syntax.txt /*hl-Pmenu*
8389+
hl-PmenuBorder syntax.txt /*hl-PmenuBorder*
83878390
hl-PmenuExtra syntax.txt /*hl-PmenuExtra*
83888391
hl-PmenuExtraSel syntax.txt /*hl-PmenuExtraSel*
83898392
hl-PmenuKind syntax.txt /*hl-PmenuKind*
@@ -8392,6 +8395,7 @@ hl-PmenuMatch syntax.txt /*hl-PmenuMatch*
83928395
hl-PmenuMatchSel syntax.txt /*hl-PmenuMatchSel*
83938396
hl-PmenuSbar syntax.txt /*hl-PmenuSbar*
83948397
hl-PmenuSel syntax.txt /*hl-PmenuSel*
8398+
hl-PmenuShadow syntax.txt /*hl-PmenuShadow*
83958399
hl-PmenuThumb syntax.txt /*hl-PmenuThumb*
83968400
hl-PopupNotification syntax.txt /*hl-PopupNotification*
83978401
hl-PopupSelected syntax.txt /*hl-PopupSelected*

runtime/doc/version9.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41838,9 +41838,11 @@ Highlighting: ~
4183841838
|hl-ComplMatchIns| matched text of the currently inserted completion
4183941839
|hl-DiffTextAdd| added text within a changed line
4184041840
|hl-MsgArea| highlighting of the Command-line and messages area
41841+
|hl-PmenuBorder| Popup menu: highlighting of popup border characters
4184141842
|hl-PmenuMatch| Popup menu: highlighting of matched text
4184241843
|hl-PmenuMatchSel| Popup menu: highlighting of matched text in selected
4184341844
line
41845+
|hl-PmenuShadow| Popup menu: highlighting of the popup shadow
4184441846
|hl-PreInsert| highlighting for completion preinserted text
4184541847
|hl-TabPanel| |tabpanel|: not active tab page label
4184641848
|hl-TabPanelFill| |tabpanel|: filler space
@@ -41880,6 +41882,7 @@ Options: ~
4188041882
'lhistory' Size of the location list stack |quickfix-stack|
4188141883
'maxsearchcount' Set the maximum number for search-stat |shm-S|
4188241884
'messagesopt' configure |:messages| and |hit-enter| prompt
41885+
'pumborder' define popup border and decorations
4188341886
'pummaxwidth' maximum width for the completion popup menu
4188441887
'showtabpanel' When to show the |tabpanel|
4188541888
'tabclose' Which tab page to focus after closing a tab page

runtime/optwin.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
" These commands create the option window.
22
"
33
" Maintainer: The Vim Project <https://github.com/vim/vim>
4-
" Last Change: 2025 Sep 30
4+
" Last Change: 2025 Oct 07
55
" Former Maintainer: Bram Moolenaar <[email protected]>
66

77
" If there already is an option window, jump to that one.
@@ -900,6 +900,8 @@ if has("insert_expand")
900900
call <SID>OptionG("pw", &pw)
901901
call <SID>AddOption("pummaxwidth", gettext("maximum width of the popup menu"))
902902
call <SID>OptionG("pmw", &pmw)
903+
call <SID>AddOption("pumborder", gettext("popup border style"))
904+
call <SID>OptionG("pb", &pb)
903905
call <SID>AddOption("completefunc", gettext("user defined function for Insert mode completion"))
904906
call append("$", "\t" .. s:local_to_buffer)
905907
call <SID>OptionL("cfu")

0 commit comments

Comments
 (0)