From cbb5134874ec0bf2a7b6a701f4e1a844f5303067 Mon Sep 17 00:00:00 2001
From: Junegunn Choi <junegunn.c@gmail.com>
Date: Sun, 22 Jan 2017 14:40:30 +0900
Subject: [PATCH] [vim] Use 24-bit colors if termguicolors is set

---
 plugin/fzf.vim | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugin/fzf.vim b/plugin/fzf.vim
index 4064a559..75597baa 100644
--- a/plugin/fzf.vim
+++ b/plugin/fzf.vim
@@ -167,9 +167,12 @@ function! s:common_sink(action, lines) abort
 endfunction
 
 function! s:get_color(attr, ...)
+  let gui = has('termguicolors') && &termguicolors
+  let fam = gui ? 'gui' : 'cterm'
+  let pat = gui ? '^#[a-f0-9]\+' : '^[0-9]\+$'
   for group in a:000
-    let code = synIDattr(synIDtrans(hlID(group)), a:attr, 'cterm')
-    if code =~ '^[0-9]\+$'
+    let code = synIDattr(synIDtrans(hlID(group)), a:attr, fam)
+    if code =~? pat
       return code
     endif
   endfor
-- 
GitLab