Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
37f2d8f7
Unverified
Commit
37f2d8f7
authored
8 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
[vim] Respect g:fzf_colors
Close #711
parent
400e443a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+3
-2
3 additions, 2 deletions
README.md
plugin/fzf.vim
+19
-1
19 additions, 1 deletion
plugin/fzf.vim
test/fzf.vader
+4
-0
4 additions, 0 deletions
test/fzf.vader
with
26 additions
and
3 deletions
README.md
+
3
−
2
View file @
37f2d8f7
...
...
@@ -319,7 +319,7 @@ Note that the environment variables `FZF_DEFAULT_COMMAND` and
`FZF_DEFAULT_OPTS`
also apply here. Refer to
[
the wiki page
][
fzf-config
]
for
customization.
[
fzf-config
]:
https://github.com/junegunn/fzf/wiki/Configuring-
FZF-command-(vim)
[
fzf-config
]:
https://github.com/junegunn/fzf/wiki/Configuring-
Vim-plugin
#### `fzf#run`
...
...
@@ -347,7 +347,8 @@ page](https://github.com/junegunn/fzf/wiki/Examples-(vim)).
`fzf#wrap([name string,] [opts dict,] [fullscreen boolean])`
is a helper
function that decorates the options dictionary so that it understands
`g:fzf_layout`
,
`g:fzf_action`
, and
`g:fzf_history_dir`
like
`:FZF`
.
`g:fzf_layout`
,
`g:fzf_action`
,
`g:fzf_colors`
, and
`g:fzf_history_dir`
like
`:FZF`
.
```
vim
command
!
-
bang MyStuff
...
...
This diff is collapsed.
Click to expand it.
plugin/fzf.vim
+
19
−
1
View file @
37f2d8f7
...
...
@@ -159,6 +159,22 @@ function! s:common_sink(action, lines) abort
endtry
endfunction
function
!
s:get_color
(
attr
,
...)
for
group
in
a:000
let
code
=
synIDattr
(
synIDtrans
(
hlID
(
group
)),
a:attr
,
'cterm'
)
if
code
=~
'^[0-9]\+$'
return
code
endif
endfor
return
''
endfunction
function
!
s:defaults
()
let
rules
=
copy
(
get
(
g
:,
'fzf_colors'
,
{}))
let
colors
=
join
(
map
(
items
(
filter
(
map
(
rules
,
'call("s:get_color", v:val)'
),
'!empty(v:val)'
)),
'join(v:val, ":")'
),
','
)
return
empty
(
colors
)
?
''
:
(
'--color='
.
colors
)
endfunction
" [name string,] [opts dict,] [fullscreen boolean]
function
!
fzf#
wrap
(...)
let
args
=
[
''
,
{},
0
]
...
...
@@ -190,8 +206,10 @@ function! fzf#wrap(...)
endif
endif
" Colors: g:fzf_colors
let
opts
.
options
=
s:defaults
()
.
' '
.
get
(
opts
,
'options'
,
''
)
" History: g:fzf_history_dir
let
opts
.
options
=
get
(
opts
,
'options'
,
''
)
if
len
(
name
)
&&
len
(
get
(
g
:,
'fzf_history_dir'
,
''
))
let
dir
=
expand
(
g:fzf_history_dir
)
if
!
isdirectory
(
dir
)
...
...
This diff is collapsed.
Click to expand it.
test/fzf.vader
+
4
−
0
View file @
37f2d8f7
...
...
@@ -143,6 +143,10 @@ Execute (fzf#wrap):
Assert opts.options =~ '--history /tmp/foobar'
Assert opts.options =~ '--color light'
let g:fzf_colors = { 'fg': ['fg', 'Error'] }
let opts = fzf#wrap({})
Assert opts.options =~ '^--color=fg:'
Execute (Cleanup):
unlet g:dir
Restore
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment