diff --git a/autoload/SpaceVim/api/vim/signatures.vim b/autoload/SpaceVim/api/vim/signatures.vim index 473fdc29b..e0a77a5e9 100644 --- a/autoload/SpaceVim/api/vim/signatures.vim +++ b/autoload/SpaceVim/api/vim/signatures.vim @@ -13,18 +13,23 @@ let s:self._cmp = SpaceVim#api#import('vim#compatible') let s:self.hi_info_group = 'Comment' let s:self.hi_warn_group = 'WarningMsg' let s:self.hi_error_group = 'ErrorMsg' +if exists('*nvim_create_namespace') + let s:self._hi_namespace = nvim_create_namespace('spacevim-signatures') +endif -if exists('*nvim_buf_set_virtual_text') +if exists('*nvim_create_namespace') + " @vimlint(EVL103, 1, a:col) function! s:self.info(line, col, message) abort - call nvim_buf_set_virtual_text(0, bufnr('%'), a:line, [[a:message, self.hi_info_group],], {}) + call nvim_buf_set_virtual_text(0, self._hi_namespace, a:line - 2, [[a:message, self.hi_info_group],], {}) endfunction function! s:self.warn(line, col, message) abort - call nvim_buf_set_virtual_text(0, bufnr('%'), a:line, [[a:message, self.hi_warn_group],], {}) + call nvim_buf_set_virtual_text(0, self._hi_namespace, a:line - 2, [[a:message, self.hi_warn_group],], {}) endfunction function! s:self.error(line, col, message) abort - call nvim_buf_set_virtual_text(0, bufnr('%'), a:line, [[a:message, self.hi_error_group],], {}) + call nvim_buf_set_virtual_text(0, self._hi_namespace, a:line - 2, [[a:message, self.hi_error_group],], {}) endfunction + " @vimlint(EVL103, 0, a:col) else function! s:self.info(line, col, message) abort @@ -44,12 +49,18 @@ endfunction call s:self.set_group('SpaceVim_signatures') -function! s:self.clear() abort - for id in self.id - call matchdelete(id) - endfor - let self.id = [] -endfunction +if exists('*nvim_create_namespace') + function! s:self.clear() abort + call nvim_buf_clear_namespace(0, self._hi_namespace, 0, -1) + endfunction +else + function! s:self.clear() abort + for id in self.id + call matchdelete(id) + endfor + let self.id = [] + endfunction +endif function! SpaceVim#api#vim#signatures#get() abort diff --git a/autoload/SpaceVim/layers/core/statusline.vim b/autoload/SpaceVim/layers/core/statusline.vim index 8964fa84f..48caa737f 100644 --- a/autoload/SpaceVim/layers/core/statusline.vim +++ b/autoload/SpaceVim/layers/core/statusline.vim @@ -539,11 +539,7 @@ function! SpaceVim#layers#core#statusline#def_colors() abort exe 'hi! SpaceVim_statusline_ia gui=bold cterm=bold ctermbg=' . t[0][2] . ' ctermfg=' . t[0][3] . ' guibg=' . t[0][1] . ' guifg=' . t[0][0] exe 'hi! SpaceVim_statusline_b ctermbg=' . t[1][2] . ' ctermfg=' . t[1][3] . ' guibg=' . t[1][1] . ' guifg=' . t[1][0] exe 'hi! SpaceVim_statusline_c ctermbg=' . t[2][2] . ' ctermfg=' . t[2][3] . ' guibg=' . t[2][1] . ' guifg=' . t[2][0] - if name ==# 'palenight' && t[9] ==# 'bright' - exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[2][2] . ' guibg=' . t[3][0] . ' guifg=' . t[2][0] - else - exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[4][3] . ' guibg=' . t[3][0] . ' guifg=' . t[4][0] - endif + exe 'hi! SpaceVim_statusline_z ctermbg=' . t[3][1] . ' ctermfg=' . t[2][2] . ' guibg=' . t[3][0] . ' guifg=' . t[2][0] hi! SpaceVim_statusline_error ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fb4934 gui=bold hi! SpaceVim_statusline_warn ctermbg=003 ctermfg=Black guibg=#504945 guifg=#fabd2f gui=bold call s:HI.hi_separator('SpaceVim_statusline_a', 'SpaceVim_statusline_b') diff --git a/autoload/SpaceVim/mapping/guide/theme/palenight.vim b/autoload/SpaceVim/mapping/guide/theme/palenight.vim index b8e486982..54148eedd 100644 --- a/autoload/SpaceVim/mapping/guide/theme/palenight.vim +++ b/autoload/SpaceVim/mapping/guide/theme/palenight.vim @@ -60,7 +60,6 @@ function! SpaceVim#mapping#guide#theme#palenight#palette() abort \ [ s:guiBlack , s:gui05 , s:ctermWhite , s:cterm05 ], \ ['#282828', '#689d6a', 235, 72], \ ['#282828', '#8f3f71', 235, 132], - \ 'bright' \ ] else return [ @@ -73,7 +72,6 @@ function! SpaceVim#mapping#guide#theme#palenight#palette() abort \ [ s:guiBlack , s:gui05 , s:ctermWhite , s:cterm05 ], \ ['#282828', '#689d6a', 235, 72], \ ['#282828', '#8f3f71', 235, 132], - \ 'dark', \ ] endif endfunction diff --git a/docs/api/vim/signatures.md b/docs/api/vim/signatures.md index bbf34f015..9025549bf 100644 --- a/docs/api/vim/signatures.md +++ b/docs/api/vim/signatures.md @@ -18,13 +18,12 @@ vim#signatures API provides some basic functions for showing signatures info. ## Functions ane varilues -| function name | description | -| ------------------------- | ---------------------------------------- | -| `info(line, col, msg)` | show info signature message on specific line and col | -| `warn(line, col, msg)` | show warn signature message on specific line and col | -| `error(line, col, msg)` | show error signature message on specific line and col | -| `clear()` | clear signatures info | -| `hi_info_group` | info message highlight group name | -| `hi_warn_group` | warn message highlight group name | -| `hi_error_group` | error message highlight group name | - +| function name | description | +| ----------------------- | ----------------------------------------------------- | +| `info(line, col, msg)` | show info signature message on specific line and col | +| `warn(line, col, msg)` | show warn signature message on specific line and col | +| `error(line, col, msg)` | show error signature message on specific line and col | +| `clear()` | clear signatures info | +| `hi_info_group` | info message highlight group name | +| `hi_warn_group` | warn message highlight group name | +| `hi_error_group` | error message highlight group name | diff --git a/docs/cn/api/vim/signatures.md b/docs/cn/api/vim/signatures.md new file mode 100644 index 000000000..97b6edb9a --- /dev/null +++ b/docs/cn/api/vim/signatures.md @@ -0,0 +1,30 @@ +--- +title: "vim#signatures api" +description: "vim#signatures API 提供一些设置和获取 Vim 提示消息的函数。" +lang: cn +--- + +# [可用 APIs](../../) >> vim#signatures + + + +- [模块简介](#模块简介) +- [函数及变量](#函数及变量) + + + +## 模块简介 + +vim#signatures API 提供一些设置和获取 Vim 提示消息的函数。 + +## 函数及变量 + +| 函数名称 | 功能描述 | +| ----------------------- | ----------------------------------------------------- | +| `info(line, col, msg)` | show info signature message on specific line and col | +| `warn(line, col, msg)` | show warn signature message on specific line and col | +| `error(line, col, msg)` | show error signature message on specific line and col | +| `clear()` | clear signatures info | +| `hi_info_group` | info message highlight group name | +| `hi_warn_group` | warn message highlight group name | +| `hi_error_group` | error message highlight group name | diff --git a/test/color/theme.vader b/test/color/theme.vader index 16adeac46..14158b94e 100644 --- a/test/color/theme.vader +++ b/test/color/theme.vader @@ -2,6 +2,6 @@ Execute ( SpaceVim statusline theme ): let g:_spacevim_built_in_themes = map(split(globpath('.', 'autoload/SpaceVim/mapping/guide/theme/*.vim'), "\n"), 'fnamemodify(v:val, ":t:r")') for theme in g:_spacevim_built_in_themes Log 'testing theme: ' . theme - AssertEqual len(call('SpaceVim#mapping#guide#theme#' . theme . '#palette', [])), 10 + AssertEqual len(call('SpaceVim#mapping#guide#theme#' . theme . '#palette', [])), 9 endfor