Changing the color of founded char/expression
ItsNilDev opened this issue · 42 comments
As you read the the title , I want to change the color of founded char , its color is now something like light lime, I want to make it orange
Specify the --color
of $FZF_DEFAULT_OPTS
.
This is an option of fzf.
How? I don't understand
See $ man fzf
for options.
Ok I found the color I want with command fzf --color='hl:#F6A616,hl+:#F6A616'
but how can I apply that to fzf-preview?
Check the FZF_DEFAULT_OPTS
environment variable.
It works if you set it in the vim.
I tried to echo it but nothing happened
And I'm using Neovim
I have set it up this way in Neovim and am able to see it working.
Check the environment variables.
let $FZF_DEFAULT_OPTS = '--color=bg+:#1d2021,bg:#1d2021,spinner:#d8a657,hl:#a9b665,fg:#d4be98,header:#928374,info:#89b482,pointer:#7daea3,marker:#d8a657,fg+:#d4be98,prompt:#e78a4e,hl+:#89b482'
I've setup that like this let $FZF_DEFAULT_OPTS = '--color=hl:#F6A616,hl+:#F6A616'
but it seems it didn't change anything
It works in my environment.
I can't reproduce it because I don't have the environment entries in the minimum .vimrc and Issue template.
What do you need to know?
"-----------------Plugins----------------
call plug#begin('~/.config/nvim/plugins')
Plug 'scrooloose/nerdtree'
Plug 'majutsushi/tagbar'
Plug 'luochen1990/rainbow'
Plug 'gruvbox-community/gruvbox'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'yuki-ycino/fzf-preview.vim', { 'branch': 'release', 'do': ':UpdateRemotePlugins' }
Plug 'jiangmiao/auto-pairs'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" --For isntalling telescope
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
call plug#end()
"-----------------Plugins----------------
"----------Etc.-----------
syntax on
filetype plugin indent on
syntax enable
set tags=tags
set number
set nowrap
set relativenumber
set noshowmode
set smartindent
set smartcase
let g:airline_theme='base16'
" Stop Tab at 4 Spaces
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
autocmd Filetype css setlocal tabstop=4
let g:fzf_preview_directory_files_command = 'fd'
let $FZF_DEFAULT_OPTS = '--color=hl:#F6A616',hl+:'#F6A616'
" -----------------Bindings------------
nmap <C-L> <Esc>
imap <C-L> <Esc>
cmap <C-L> <Esc>
vmap <C-L> <Esc>
" File Searchers-----
nmap <leader>s :FZF ~ <CR>
nnoremap <Leader>d <cmd>lua require'telescope.builtin'.find_files{}<CR>
nmap <leader>f :CocCommand fzf-preview.DirectoryFiles <CR>
" -----------------Bindings------------
"--------------Theme and Rainbow Settings--------------
colorscheme gruvbox9
set background=dark
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
let g:gruvbox_filetype_hi_groups = 1
"--------------Theme and Rainbow Settings--------------
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" nnoremap <silent> <C-k><C-B> :NERDTreeToggle<CR>
"" nnoremap <silent> <C-K><C-T> :TagbarToggle<CR>
This is my init.vim
When I copy this file, I get an error and cannot read it.
Error detected while processing /root/.config/nvim/init.vim:
line 44:
E15: Invalid expression: '--color=hl:#F6A616',hl+:'#F6A616'
"-----------------Plugins----------------
call plug#begin('~/.config/nvim/plugins')
Plug 'scrooloose/nerdtree'
Plug 'majutsushi/tagbar'
Plug 'luochen1990/rainbow'
Plug 'gruvbox-community/gruvbox'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'yuki-ycino/fzf-preview.vim', { 'branch': 'release', 'do': ':UpdateRemotePlugins' }
Plug 'jiangmiao/auto-pairs'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" --For isntalling telescope
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/telescope.nvim'
Plug 'nvim-treesitter/nvim-treesitter'
call plug#end()
"-----------------Plugins----------------
"----------Etc.-----------
syntax on
filetype plugin indent on
syntax enable
set tags=tags
set number
set nowrap
set relativenumber
set noshowmode
set smartindent
set smartcase
let g:airline_theme='base16'
" Stop Tab at 4 Spaces
set tabstop=4 softtabstop=4
set shiftwidth=4
set expandtab
autocmd Filetype css setlocal tabstop=4
let g:fzf_preview_directory_files_command = 'fd'
let $FZF_DEFAULT_OPTS = "--color=hl:#F6A616',hl+:'#F6A616"
" -----------------Bindings------------
nmap <C-L> <Esc>
imap <C-L> <Esc>
cmap <C-L> <Esc>
vmap <C-L> <Esc>
" File Searchers-----
nmap <leader>s :FZF ~ <CR>
nnoremap <Leader>d <cmd>lua require'telescope.builtin'.find_files{}<CR>
nmap <leader>f :CocCommand fzf-preview.DirectoryFiles <CR>
" -----------------Bindings------------
"--------------Theme and Rainbow Settings--------------
colorscheme gruvbox9
set background=dark
let g:rainbow_active = 1 "set to 0 if you want to enable it later via :RainbowToggle
let g:gruvbox_filetype_hi_groups = 1
"--------------Theme and Rainbow Settings--------------
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" autocmd StdinReadPre * let s:std_in=1
" autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" nnoremap <silent> <C-k><C-B> :NERDTreeToggle<CR>
"" nnoremap <silent> <C-K><C-T> :TagbarToggle<CR>
Sry I just edit that in bad way, this is the actual init.vim
I can confirm that the root directory search and color change works with this Dockerfile.
I'll close this Issue until I can reproduce it.
FROM ubuntu:bionic
# Neovim
RUN apt-get update && apt install -y ninja-build gettext libtool libtool-bin autoconf automake cmake g++ pkg-config unzip git
WORKDIR /usr/local/src
RUN git clone https://github.com/neovim/neovim.git
WORKDIR /usr/local/src/neovim
RUN make && make install
# Node
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt install -y nodejs
# Python
RUN apt install -y python
# bat
RUN curl -LO https://github.com/sharkdp/bat/releases/download/v0.15.4/bat_0.15.4_amd64.deb
RUN dpkg -i bat_0.15.4_amd64.deb
# ripgrep
RUN curl -LO https://github.com/BurntSushi/ripgrep/releases/download/11.0.2/ripgrep_11.0.2_amd64.deb
RUN dpkg -i ripgrep_11.0.2_amd64.deb
# fd
RUN curl -LO https://github.com/sharkdp/fd/releases/download/v8.1.1/fd_8.1.1_amd64.deb
RUN dpkg -i fd_8.1.1_amd64.deb
# vim plugin
RUN sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
RUN mkdir -p /root/.config/nvim
RUN echo "call plug#begin('~/.vim/plugged') \n\
Plug 'junegunn/fzf', {'dir': '~/.fzf', 'do': './install --all'} \n\
Plug 'neoclide/coc.nvim', {'branch': 'release'} \n\
call plug#end() \n\
\n\
let g:coc_global_extensions = ['coc-fzf-preview'] \n\
let g:fzf_preview_directory_files_command = 'fd --type=file .' \n\
let \$FZF_DEFAULT_OPTS = '--color=bg+:#1d2021,bg:#1d2021,spinner:#d8a657,hl:#a9b665,fg:#d4be98,header:#928374,info:#89b482,pointer:#7daea3,marker:#d8a657,fg+:#d4be98,prompt:#e78a4e,hl+:#89b482'" >> /root/.config/nvim/init.vim
RUN nvim +PlugInstall +qa!
RUN touch ~/foo ~/bar ~/baz
ENTRYPOINT ["nvim"]
Since the vimrc is large, please refer to the Dockerfile to create a minimal configuration that reproduces the vimrc.
I'm using an arch based distro, and I'm using the newer version of Neovim which is Neovim Nightly (v0.5)
Please create a Dockerfile for me to recreate that environment.
I don't really know what is DockerFile , But I can re-create the init.vim for you
This is the minimum init.vim
call plug#begin('~/.config/nvim/plugins')
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'yuki-ycino/fzf-preview.vim', { 'branch': 'release', 'do': ':UpdateRemotePlugins' }
call plug#end()
let g:fzf_preview_directory_files_command = 'fd'
let $FZF_DEFAULT_OPTS = "--color=hl:#F6A616',hl+:'#F6A616"
map <leader>f :CocCommand fzf-preview.DirectoryFiles ~ <CR>
As you can see , nothing changes with or without this line let $FZF_DEFAULT_OPTS = "--color=hl:#F6A616',hl+:'#F6A616"
both are same colors . and when I press leader + f nothing loads up map <leader>f :CocCommand fzf-preview.DirectoryFiles ~ <CR>
You are writing the wrong configuration.
Fixed.
call plug#begin('~/.config/nvim/plugins')
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'yuki-ycino/fzf-preview.vim', { 'branch': 'release', 'do': ':UpdateRemotePlugins' }
call plug#end()
let g:fzf_preview_directory_files_command = 'fd --type=file .'
let $FZF_DEFAULT_OPTS = '--color=hl:#F6A616,hl+:#F6A616'
map <leader>f :CocCommand fzf-preview.DirectoryFiles <CR>
Search and highlighting is working.
Thanks but highlighting is still same
hl is the color setting for the matching character.
In the image, the color of the bar has been changed appropriately.
I found the problem, I can highlight things, when I turn on set termguicolors
but everything will be bad colored, and I don't like it
Set the fzf color yourself.
I've enabled termguicolors and set the fzf color.
When I turn on termguicolors
it will change everythings not only fzf
The color code setting is not related to fzf-preview, so you have to do it yourself.
I'm not talking about fzf
When you say "change it yourself" I'm thinking of $FZF_DEFAULT_OPS which can't change everything
If you don't use termguicolors, you can set the color of cterm.
This is a specification of fzf.
But There is another plugin that can highlight it like Telescope
How he did that?
So there is way
I don't know the specifics of telescope.
If you want to set it up, make a PR.
What is PR?
Pull Request
I'm really noob to do that, also I'm new to git stuff
It doesn't matter to me.
If a PR is created, I will consider merging it.