Skip to content

Commit 2102035

Browse files
committed
patch 8.0.0641: cannot set a separate highlighting for the quickfix line
Problem: Cannot set a separate highlighting for the current line in the quickfix window. Solution: Add QuickFixLine. (anishsane, closes #1755)
1 parent 8306406 commit 2102035

File tree

8 files changed

+26
-9
lines changed

8 files changed

+26
-9
lines changed

runtime/doc/options.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*options.txt* For Vim version 8.0. Last change: 2017 Jun 04
1+
*options.txt* For Vim version 8.0. Last change: 2017 Jun 13
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -3522,6 +3522,9 @@ A jump table for the options with a short description can be found at |Q_op|.
35223522
:s///gg subst. all subst. one
35233523

35243524
NOTE: This option is reset when 'compatible' is set.
3525+
DEPRECATED: Setting this option may break plugins that are not aware
3526+
of this option. Also, many users get confused that adding the /g flag
3527+
has the opposite effect of that it normally does.
35253528

35263529
*'grepformat'* *'gfm'*
35273530
'grepformat' 'gfm' string (default "%f:%l:%m,%f:%l%m,%f %l%m")
@@ -4037,7 +4040,9 @@ A jump table for the options with a short description can be found at |Q_op|.
40374040
D:DiffDelete,T:DiffText,>:SignColumn,
40384041
B:SpellBad,P:SpellCap,R:SpellRare,
40394042
L:SpellLocal,-:Conceal,+:Pmenu,=:PmenuSel,
4040-
x:PmenuSbar,X:PmenuThumb")
4043+
x:PmenuSbar,X:PmenuThumb,*:TabLine,
4044+
#:TabLineSel,_:TabLineFill,!:CursorColumn,
4045+
.:CursorLine,o:ColorColumn,q:QuickFixLine")
40414046
global
40424047
{not in Vi}
40434048
This option can be used to set highlighting mode for various

runtime/doc/quickfix.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*quickfix.txt* For Vim version 8.0. Last change: 2017 Mar 06
1+
*quickfix.txt* For Vim version 8.0. Last change: 2017 Jun 13
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -472,7 +472,11 @@ keep its height, ignoring 'winheight' and 'equalalways'. You can change the
472472
height manually (e.g., by dragging the status line above it with the mouse).
473473

474474
In the quickfix window, each line is one error. The line number is equal to
475-
the error number. You can use ":.cc" to jump to the error under the cursor.
475+
the error number. The current entry is highlighted with the QuickFixLine
476+
highlighting. You can change it to your liking, e.g.: >
477+
:hi QuickFixLine ctermbg=Yellow guibg=Yellow
478+
479+
You can use ":.cc" to jump to the error under the cursor.
476480
Hitting the <Enter> key or double-clicking the mouse on a line has the same
477481
effect. The file containing the error is opened in the window above the
478482
quickfix window. If there already is a window for that file, it is used

src/option.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,9 @@ struct vimoption
476476
/* Make the string as short as possible when compiling with few features. */
477477
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \
478478
|| defined(FEAT_WINDOWS) || defined(FEAT_CLIPBOARD) \
479-
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) || defined(FEAT_CONCEAL)
480-
# define HIGHLIGHT_INIT "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,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn"
479+
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) \
480+
|| defined(FEAT_CONCEAL) || defined(FEAT_QUICKFIX)
481+
# define HIGHLIGHT_INIT "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,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn,q:QuickFixLine"
481482
#else
482483
# 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,S:StatusLineNC,t:Title,v:Visual,w:WarningMsg,W:WildMenu,>:SignColumn,*:TabLine,#:TabLineSel,_:TabLineFill"
483484
#endif

src/quickfix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,7 @@ qf_list(exarg_T *eap)
25752575
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
25762576
i, (char *)fname);
25772577
msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index
2578-
? HL_ATTR(HLF_L) : HL_ATTR(HLF_D));
2578+
? HL_ATTR(HLF_QFL) : HL_ATTR(HLF_D));
25792579
if (qfp->qf_lnum == 0)
25802580
IObuff[0] = NUL;
25812581
else if (qfp->qf_col == 0)

src/screen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3371,7 +3371,7 @@ win_line(
33713371
# if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)
33723372
/* Highlight the current line in the quickfix window. */
33733373
if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum)
3374-
line_attr = HL_ATTR(HLF_L);
3374+
line_attr = HL_ATTR(HLF_QFL);
33753375
# endif
33763376
if (line_attr != 0)
33773377
area_highlighting = TRUE;

src/syntax.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6970,6 +6970,8 @@ static char *(highlight_init_light[]) =
69706970
#ifdef FEAT_GUI
69716971
"Normal gui=NONE",
69726972
#endif
6973+
CENT("QuickFixLine term=reverse ctermbg=Cyan",
6974+
"QuickFixLine term=reverse ctermbg=Cyan guibg=Cyan"),
69736975
NULL
69746976
};
69756977

@@ -7055,6 +7057,8 @@ static char *(highlight_init_dark[]) =
70557057
CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey",
70567058
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"),
70577059
#endif
7060+
CENT("QuickFixLine term=reverse ctermbg=Cyan",
7061+
"QuickFixLine term=reverse ctermbg=Cyan guibg=Cyan"),
70587062
#ifdef FEAT_GUI
70597063
"Normal gui=NONE",
70607064
#endif

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
641,
767769
/**/
768770
640,
769771
/**/

src/vim.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,7 @@ typedef enum
14331433
, HLF_CUC /* 'cursurcolumn' */
14341434
, HLF_CUL /* 'cursurline' */
14351435
, HLF_MC /* 'colorcolumn' */
1436+
, HLF_QFL /* quickfix window line currently selected */
14361437
, HLF_COUNT /* MUST be the last one */
14371438
} hlf_T;
14381439

@@ -1442,7 +1443,7 @@ typedef enum
14421443
'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \
14431444
'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \
14441445
'B', 'P', 'R', 'L', \
1445-
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o'}
1446+
'+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q'}
14461447

14471448
/*
14481449
* Boolean constants

0 commit comments

Comments
 (0)