Created
September 16, 2016 07:52
-
-
Save anishsane/5125b87ea4cddb43985496abd26a43e7 to your computer and use it in GitHub Desktop.
This patch adds a new highlight group 'QuickFixCurrentLine' for current selection in quickfix window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author: Anish sane | |
# | |
# My SO profile: http://stackoverflow.com/users/793796/anishsane | |
# | |
# Description: | |
# | |
# By default vim highlight the current selection with 'Search' highlight rules. | |
# It's hard-coded in the vim source code. | |
# Because of this, it's difficult to search for something within the quick fix window. | |
# | |
# This patch adds a new highlight group 'QuickFixCurrentLine' for this case. | |
# | |
# Original stack-overflow question: http://stackoverflow.com/questions/13220073/vim-highlight-quickfix-selected-line-with-color-different-than-search | |
# | |
diff -uNrp vim8.orig/src/option.c vim8/src/option.c | |
--- vim8.orig/src/option.c 2016-09-16 12:56:38.166086055 +0530 | |
+++ vim8/src/option.c 2016-09-16 12:45:29.002079982 +0530 | |
@@ -471,9 +471,9 @@ struct vimoption | |
#if defined(FEAT_DIFF) || defined(FEAT_FOLDING) || defined(FEAT_SPELL) \ | |
|| defined(FEAT_WINDOWS) || defined(FEAT_CLIPBOARD) \ | |
|| defined(FEAT_INS_EXPAND) || defined(FEAT_SYN_HL) || defined(FEAT_CONCEAL) | |
-# 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" | |
+# 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:QuickFixCurrentLine" | |
#else | |
-# 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" | |
+# 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,q:QuickFixCurrentLine" | |
#endif | |
/* | |
diff -uNrp vim8.orig/src/quickfix.c vim8/src/quickfix.c | |
--- vim8.orig/src/quickfix.c 2016-09-16 12:56:38.210086056 +0530 | |
+++ vim8/src/quickfix.c 2016-09-16 12:06:10.042058570 +0530 | |
@@ -2508,7 +2508,7 @@ qf_list(exarg_T *eap) | |
vim_snprintf((char *)IObuff, IOSIZE, "%2d %s", | |
i, (char *)fname); | |
msg_outtrans_attr(IObuff, i == qi->qf_lists[qi->qf_curlist].qf_index | |
- ? hl_attr(HLF_L) : hl_attr(HLF_D)); | |
+ ? hl_attr(HLF_QFC) : hl_attr(HLF_D)); | |
if (qfp->qf_lnum == 0) | |
IObuff[0] = NUL; | |
else if (qfp->qf_col == 0) | |
diff -uNrp vim8.orig/src/screen.c vim8/src/screen.c | |
--- vim8.orig/src/screen.c 2016-09-16 12:56:38.214086056 +0530 | |
+++ vim8/src/screen.c 2016-09-16 12:04:32.346057683 +0530 | |
@@ -3324,7 +3324,7 @@ win_line( | |
# if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS) | |
/* Highlight the current line in the quickfix window. */ | |
if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum) | |
- line_attr = hl_attr(HLF_L); | |
+ line_attr = hl_attr(HLF_QFC); | |
# endif | |
if (line_attr != 0) | |
area_highlighting = TRUE; | |
diff -uNrp vim8.orig/src/syntax.c vim8/src/syntax.c | |
--- vim8.orig/src/syntax.c 2016-09-16 12:56:38.218086056 +0530 | |
+++ vim8/src/syntax.c 2016-09-16 12:53:21.438084270 +0530 | |
@@ -6904,6 +6904,8 @@ static char *(highlight_init_light[]) = | |
#ifdef FEAT_GUI | |
"Normal gui=NONE", | |
#endif | |
+ CENT("QuickFixCurrentLine term=reverse ctermbg=Cyan", | |
+ "QuickFixCurrentLine term=reverse ctermbg=Cyan guibg=Cyan"), | |
NULL | |
}; | |
@@ -6989,6 +6991,8 @@ static char *(highlight_init_dark[]) = | |
CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", | |
"Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), | |
#endif | |
+ CENT("QuickFixCurrentLine term=reverse ctermbg=Cyan", | |
+ "QuickFixCurrentLine term=reverse ctermbg=Cyan guibg=Cyan"), | |
#ifdef FEAT_GUI | |
"Normal gui=NONE", | |
#endif | |
diff -uNrp vim8.orig/src/vim.h vim8/src/vim.h | |
--- vim8.orig/src/vim.h 2016-09-16 12:56:38.246086056 +0530 | |
+++ vim8/src/vim.h 2016-09-16 12:30:29.826071820 +0530 | |
@@ -1410,6 +1410,7 @@ typedef enum | |
, HLF_CUC /* 'cursurcolumn' */ | |
, HLF_CUL /* 'cursurline' */ | |
, HLF_MC /* 'colorcolumn' */ | |
+ , HLF_QFC /* 'quickfix window current line' */ | |
, HLF_COUNT /* MUST be the last one */ | |
} hlf_T; | |
@@ -1419,7 +1420,7 @@ typedef enum | |
'n', 'N', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ | |
'f', 'F', 'A', 'C', 'D', 'T', '-', '>', \ | |
'B', 'P', 'R', 'L', \ | |
- '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o'} | |
+ '+', '=', 'x', 'X', '*', '#', '_', '!', '.', 'o', 'q'} | |
/* | |
* Boolean constants |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment