Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Add EndOfBuffer hl group for ~ lines after the last line in buffers #1926

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions runtime/doc/options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3784,17 +3784,16 @@ A jump table for the options with a short description can be found at |Q_op|.

*'highlight'* *'hl'*
'highlight' 'hl' string (default (as a single string):
"8:SpecialKey,@:NonText,d:Directory,
e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,
M:ModeMsg,n:LineNr,N:CursorLineNr,
r:Question,s:StatusLine,S:StatusLineNC,
c:VertSplit, t:Title,v:Visual,
w:WarningMsg,W:WildMenu,
f:Folded,F:FoldColumn,A:DiffAdd,
C:DiffChange,D:DiffDelete,T:DiffText,
>:SignColumn,B:SpellBad,P:SpellCap,
R:SpellRare,L:SpellLocal,-:Conceal,
+:Pmenu,=:PmenuSel,
"8:SpecialKey,~:EndOfBuffer,@:NonText,i
d:Directory,e:ErrorMsg,i:IncSearch,
l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,
N:CursorLineNr,r:Question,s:StatusLine,
S:StatusLineNC,c:VertSplit,t:Title,
v:Visual,w:WarningMsg,W:WildMenu,f:Folded,
F:FoldColumn,A:DiffAdd,C:DiffChange,
D:DiffDelete,T:DiffText,>:SignColumn,
B:SpellBad,P:SpellCap,R:SpellRare,
L:SpellLocal,-:Conceal,+:Pmenu,=:PmenuSel,
x:PmenuSbar,X:PmenuThumb")
global
{not in Vi}
Expand All @@ -3803,7 +3802,8 @@ A jump table for the options with a short description can be found at |Q_op|.
first character in a pair gives the occasion, the second the mode to
use for that occasion. The occasions are:
|hl-SpecialKey| 8 Meta and special keys listed with ":map"
|hl-NonText| @ '~' and '@' at the end of the window and
|hl-EndOfBuffer| ~ lines after the last line in the buffer
|hl-NonText| @ '@' at the end of the window and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs a {Nvim} and/or a mention at https://github.com/neovim/neovim/wiki/Differences-from-Vim (probably not here, though, but in syntax.txt at *hl-EndOfBuffer*, sorry). I fear that we'll get to a point where we lose track of what small feature changes such as this Neovim has compared to Vim. Maybe we're already there...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

characters from 'showbreak'
|hl-Directory| d directories in CTRL-D listing and other special
things in listings
Expand Down
11 changes: 7 additions & 4 deletions runtime/doc/syntax.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4761,6 +4761,9 @@ DiffChange diff mode: Changed line |diff.txt|
DiffDelete diff mode: Deleted line |diff.txt|
*hl-DiffText*
DiffText diff mode: Changed text within a changed line |diff.txt|
*hl-EndOfBuffer*
EndOfBuffer filler lines (~) after the end of the buffer.
By default, this is highlighted like |hl-NonText|.
*hl-ErrorMsg*
ErrorMsg error messages on the command line
*hl-VertSplit*
Expand Down Expand Up @@ -4789,10 +4792,10 @@ ModeMsg 'showmode' message (e.g., "-- INSERT --")
*hl-MoreMsg*
MoreMsg |more-prompt|
*hl-NonText*
NonText '~' and '@' at the end of the window, characters from
'showbreak' and other characters that do not really exist in
the text (e.g., ">" displayed when a double-wide character
doesn't fit at the end of the line).
NonText '@' at the end of the window, characters from 'showbreak'
and other characters that do not really exist in the text
(e.g., ">" displayed when a double-wide character doesn't
fit at the end of the line). See also |hl-EndOfBuffer|.
*hl-Normal*
Normal normal text
*hl-Pmenu*
Expand Down
2 changes: 1 addition & 1 deletion runtime/syntax/vim.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePo
syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo

" Default highlighting groups {{{2
syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu
syn match vimHLGroup contained "Conceal"
syn case match

Expand Down
11 changes: 6 additions & 5 deletions src/nvim/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ EXTERN int no_check_timestamps INIT(= 0); /* Don't check timestamps */
typedef enum {
HLF_8 = 0 /* Meta & special keys listed with ":map", text that is
displayed different from what it is */
, HLF_AT /* @ and ~ characters at end of screen, characters that
, HLF_EOB // after the last line in the buffer
, HLF_AT /* @ characters at end of screen, characters that
don't really exist in the text */
, HLF_D /* directories in CTRL-D listing */
, HLF_E /* error messages */
Expand Down Expand Up @@ -451,10 +452,10 @@ typedef enum {

/* The HL_FLAGS must be in the same order as the HLF_ enums!
* When changing this also adjust the default for 'highlight'. */
#define HL_FLAGS {'8', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', 'N', 'r', 's', \
'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', 'A', 'C', 'D', \
'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', 'x', 'X', '*', \
'#', '_', '!', '.', 'o'}
#define HL_FLAGS {'8', '~', '@', 'd', 'e', 'i', 'l', 'm', 'M', 'n', 'N', 'r', \
's', 'S', 'c', 't', 'v', 'V', 'w', 'W', 'f', 'F', 'A', 'C', \
'D', 'T', '-', '>', 'B', 'P', 'R', 'L', '+', '=', 'x', 'X', \
'*', '#', '_', '!', '.', 'o'}

EXTERN int highlight_attr[HLF_COUNT]; /* Highl. attr for each context. */
# define USER_HIGHLIGHT
Expand Down
4 changes: 2 additions & 2 deletions src/nvim/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ typedef struct vimoption {
# define ISP_LATIN1 (char_u *)"@,161-255"

#define HIGHLIGHT_INIT \
"8:SpecialKey,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search," \
"m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine," \
"8:SpecialKey,~:EndOfBuffer,@:NonText,d:Directory,e:ErrorMsg,i:IncSearch," \
"l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,N:CursorLineNr,r:Question,s:StatusLine," \
"S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg," \
"W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete," \
"T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare," \
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ static void win_update(win_T *wp)

/* make sure the rest of the screen is blank */
/* put '~'s on rows that aren't part of the file. */
win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_AT);
win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB);
}

/* Reset the type of redrawing required, the window has been updated. */
Expand Down
1 change: 1 addition & 0 deletions src/nvim/syntax.c
Original file line number Diff line number Diff line change
Expand Up @@ -5781,6 +5781,7 @@ static char *(highlight_init_both[]) =
"StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"),
CENT("StatusLineNC term=reverse cterm=reverse",
"StatusLineNC term=reverse cterm=reverse gui=reverse"),
"default link EndOfBuffer NonText",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was like this in the original patch, it has the same indent as the CENT items, which are at the same structural level.

CENT("VertSplit term=reverse cterm=reverse",
"VertSplit term=reverse cterm=reverse gui=reverse"),
CENT("DiffText term=reverse cterm=bold ctermbg=Red",
Expand Down