Skip to content

Commit

Permalink
bugfix for nvim0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jayli committed Dec 17, 2023
1 parent 86f9e3f commit 0abed63
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 45 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ Global configurations
| `g:easycomplete_diagnostics_enable` | 1 | Enable diagnostics |
| `g:easycomplete_signature_enable` | 1 | Enable signature |
| `g:easycomplete_diagnostics_hover` | 1 | Gives a diagnostic prompt when the cursor holds |
| `g:easycomplete_scheme` | `""` | Popup menu colorscheme |

Typing `:h easycomplete` for help.

Expand Down Expand Up @@ -264,8 +263,6 @@ Disable TabNine inline suggestion: `let g:easycomplete_tabnine_suggestion = 0`.

## Beautify the vim completion menu

There are four build-in popup menu themes in cterm: `blue`,`light`,`rider` and `sharp`(for iterm). (`let g:easycomplete_scheme="sharp"`).

If you just want to use default nerdfonts configuration, you can simplily config `g:easycomplete_nerd_font = 1`

If you want to customize the kind icon, you can modify the configuration with <https://nerdfonts.com> installed. [Examples](beautify-menu-items.md).
Expand Down
1 change: 0 additions & 1 deletion autoload/easycomplete.vim
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ function! easycomplete#_enable()
call s:ConstructorCalling()
doautocmd <nomodeline> User easycomplete_after_constructor
call s:SetupCompleteCache()
call easycomplete#ui#SetScheme()
" lsp 服务初始化必须要放在按键绑定之后
if !easycomplete#sources#deno#IsTSOrJSFiletype() || easycomplete#sources#deno#IsDenoProject()
call easycomplete#lsp#enable()
Expand Down
1 change: 1 addition & 0 deletions autoload/easycomplete/popup.vim
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ function! s:NVimShow(opt, windowtype, float_type)
if a:windowtype == "float" && a:float_type == "signature"
if has("nvim-0.9.0")
call setbufvar(winbufnr(winid), '&filetype', 'markdown')
call setbufvar(winbufnr(winid), '&conceallevel', 3)
endif
call easycomplete#ui#ApplyMarkdownSyntax(winid)
endif
Expand Down
43 changes: 2 additions & 41 deletions autoload/easycomplete/ui.vim
Original file line number Diff line number Diff line change
@@ -1,43 +1,3 @@
" Cterm 下默认四种菜单样式
" 支持四种 dark, light, rider, sharp
" Set Scheme {{{
function! easycomplete#ui#SetScheme()
if !exists("g:easycomplete_scheme")
return
endif
" hi Pmenu ctermfg=111 ctermbg=235
" hi PmenuSel ctermfg=255 ctermbg=238
" hi PmenuSbar ctermbg=235
" hi PmenuThumb ctermbg=234
let l:scheme_config = {
\ 'light': [[234, 251], [255, 26], [-1, 251], [-1, 247]],
\ 'rider': [[251, 237], [231, 25], [-1, 237], [-1, 239]],
\ 'sharp': [[255, 237], [235, 255], [-1, 245], [-1, 255]],
\ 'blue': [['White', 'DarkBlue'], ['Red', 'White'], [-1, 245],[-1, 255]],
\ }
if has_key(l:scheme_config, g:easycomplete_scheme) && g:env_is_iterm == v:false
let sch = l:scheme_config[g:easycomplete_scheme]
let hiPmenu = ['hi','Pmenu', 'ctermfg='.sch[0][0], 'ctermbg='.sch[0][1]]
let hiPmenuSel = ['hi','PmenuSel', 'ctermfg='.sch[1][0], 'ctermbg='.sch[1][1]]
let hiPmenuSbar = ['hi','PmenuSbar', '', 'ctermbg='.sch[2][1]]
let hiPmenuThumb = ['hi','PmenuThumb', '', 'ctermbg='.sch[3][1]]
execute join(hiPmenu, ' ')
execute join(hiPmenuSel, ' ')
execute join(hiPmenuSbar, ' ')
execute join(hiPmenuThumb, ' ')
endif

if g:env_is_iterm == v:true
if g:easycomplete_scheme == 'sharp'
hi! PMenu guifg=#d4d4d4 guibg=#252526 gui=NONE
hi! PmenuSel guifg=#ffffff guibg=#04395e gui=NONE
hi! PmenuSbar guibg=#252526
hi! PmenuThumb guibg=#474747
endif

endif
endfunction " }}}

" markdown syntax {{{
function! easycomplete#ui#ApplyMarkdownSyntax(winid)
" 默认 Popup 的 Markdown 文档都基于 help syntax
Expand All @@ -47,7 +7,8 @@ function! easycomplete#ui#ApplyMarkdownSyntax(winid)
if has("nvim")
if has("nvim-0.9.0")
let exec_cmd = [
\ "hi markdownCode cterm=underline gui=underline",
\ 'syntax region markdownRule matchgroup=Conceal start=/\%(``\)\@!`/ matchgroup=Conceal end=/\%(``\)\@!`/ concealends',
\ "hi markdownRule cterm=underline gui=underline",
\ ]
else
let exec_cmd = [
Expand Down

0 comments on commit 0abed63

Please sign in to comment.