itchyny / vim-cursorword

Underlines the word under the cursor
http://www.vim.org/scripts/script.php?script_id=5100
MIT License
611 stars 36 forks source link

Unnecessary white background of cursorword appear when set cursorline #24

Closed imuxin closed 4 years ago

imuxin commented 4 years ago

.vimrc

" set cursorline

Result: disable_cursorline

.vimrc

set cursorline
highlight CursorLine cterm=none ctermfg=None
highlight Visual cterm=bold ctermbg=202 ctermfg=NONE

Result: enable_cursorline

I don't want the white background appear. How could I to hide or make it transparent?

itchyny commented 4 years ago

What's the output of :highlight CursorLine and :highlight CursorWord1?

imuxin commented 4 years ago

I am not clear about the .vimrc status what "highlight xxx" commands are based on. I can show you my entire vimrc file content. You can test on your local environment.

scriptencoding utf-8
set encoding=utf-8
set nocompatible
set termguicolors
syntax enable
syntax on

set cursorline
highlight CursorLine cterm=none ctermfg=None
highlight Visual cterm=bold ctermbg=202 ctermfg=NONE

"+-----------------------+
"| VundleVim.vim configs |
"+-----------------------+

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'

Plugin 'itchyny/vim-cursorword'

" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line
itchyny commented 4 years ago

I can't still reproduce the issue. Please let me know the output of executing :highlight CursorLine and :highlight CursorWord1 from the command line.

itchyny commented 4 years ago

Caused by termguicolors?

imuxin commented 4 years ago

:highlight CursorLine 1


:highlight CursorWord1 2

imuxin commented 4 years ago

Unset termguicolors

:highlight CursorLine 3


:highlight CursorWord1 4

itchyny commented 4 years ago

You don't set the guibg of CursorLine in your vimrc but it seems that it is set lazily somewhere. Adding guibg=Grey40 to highlight CursorLine should fix this.

imuxin commented 4 years ago

It works! Thanks!