简体   繁体   English

为Neovim添加可选功能

[英]Add Optional Feature to Neovim

I am trying to get hlsearch to work with Neovim. 我试图让hlsearch与Neovim合作。 Per the documentation, 根据文档,

'hlsearch' 'hls' 'nohlsearch' 'nohls' 'hlsearch' 'hls'        boolean (default on)
                    global
                    {not available when compiled without the
                    +extra_search feature}

hlsearch is only available when compiled with +extra_search . hlsearch仅在使用+extra_search编译时+extra_search

 $ vim --version                                                                                                                                                                                                                                                     [11:56:16]
NVIM v0.2.0
Build type: Release
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/build/config -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/build/src/nvim/auto -I/tmp/neovim-20170707-80027-1bg0wcx/neovim-0.2.0/build/include
Compiled by brew@Sierra-2.local

Optional features included (+) or not (-): +acl   +iconv    +jemalloc +tui
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/0.2.0_1/share/nvim"

My version of neovim doesn't seem to be compiled with extra_search . 我的neovim版本似乎未使用extra_search进行编译。 Is that indeed the issue, and if so how can I fix it? 那确实是问题所在,如果是的话,我该如何解决?


Edit 编辑

To test highlight-ing, this is the output of :hi 要测试突出显示,这是:hi的输出

SpecialKey     xxx ctermfg=4 guifg=Blue
EndOfBuffer    xxx links to NonText
TermCursor     xxx cterm=reverse gui=reverse
TermCursorNC   xxx cleared
NonText        xxx ctermfg=12 gui=bold guifg=Blue
Directory      xxx ctermfg=4 guifg=Blue
ErrorMsg       xxx ctermfg=15 ctermbg=1 guifg=White guibg=Red
IncSearch      xxx cterm=reverse gui=reverse
Search         xxx ctermbg=11 guibg=Yellow
MoreMsg        xxx ctermfg=2 gui=bold guifg=SeaGreen
ModeMsg        xxx cterm=bold gui=bold
LineNr         xxx ctermfg=130 guifg=Brown
CursorLineNr   xxx ctermfg=130 gui=bold guifg=Brown
Question       xxx ctermfg=2 gui=bold guifg=SeaGreen
StatusLine     xxx cterm=bold,reverse gui=bold,reverse
StatusLineNC   xxx cterm=reverse gui=reverse
VertSplit      xxx cterm=reverse gui=reverse
Title          xxx ctermfg=5 gui=bold guifg=Magenta
Visual         xxx ctermbg=7 guibg=LightGrey
WarningMsg     xxx ctermfg=1 guifg=Red
WildMenu       xxx ctermfg=0 ctermbg=11 guifg=Black guibg=Yellow
Folded         xxx ctermfg=4 ctermbg=248 guifg=DarkBlue guibg=LightGrey
FoldColumn     xxx ctermfg=4 ctermbg=248 guifg=DarkBlue guibg=Grey
DiffAdd        xxx ctermbg=81 guibg=LightBlue
DiffChange     xxx ctermbg=225 guibg=LightMagenta
DiffDelete     xxx ctermfg=12 ctermbg=159 gui=bold guifg=Blue guibg=LightCyan
DiffText       xxx cterm=bold ctermbg=9 gui=bold guibg=Red
SignColumn     xxx links to LineNr
Conceal        xxx ctermfg=7 ctermbg=242 guifg=LightGrey guibg=DarkGrey
SpellBad       xxx ctermbg=224 gui=undercurl guisp=Red
SpellCap       xxx ctermbg=81 gui=undercurl guisp=Blue
SpellRare      xxx ctermbg=225 gui=undercurl guisp=Magenta
SpellLocal     xxx ctermbg=14 gui=undercurl guisp=DarkCyan
Pmenu          xxx ctermfg=0 ctermbg=225 guibg=LightMagenta
PmenuSel       xxx ctermfg=0 ctermbg=7 guibg=Grey
PmenuSbar      xxx ctermbg=248 guibg=Grey
PmenuThumb     xxx ctermbg=0 guibg=Black
TabLine        xxx cterm=underline ctermfg=0 ctermbg=7 gui=underline guibg=LightGrey
TabLineSel     xxx cterm=bold gui=bold
TabLineFill    xxx cterm=reverse gui=reverse
CursorColumn   xxx ctermbg=7 guibg=Grey90
CursorLine     xxx cterm=underline guibg=Grey90
ColorColumn    xxx ctermbg=4 guibg=LightRed
QuickFixLine   xxx links to Search
Whitespace     xxx links to NonText
Cursor         xxx guifg=bg guibg=fg
lCursor        xxx guifg=bg guibg=fg
Substitute     xxx links to Search
MatchParen     xxx ctermbg=14 guibg=Cyan
Error          xxx ctermfg=15 ctermbg=9 guifg=White guibg=Red
Comment        xxx ctermfg=4 guifg=Blue
Constant       xxx ctermfg=1 guifg=Magenta
Special        xxx ctermfg=5 guifg=SlateBlue
Identifier     xxx ctermfg=6 guifg=DarkCyan
Statement      xxx ctermfg=130 gui=bold guifg=Brown
PreProc        xxx ctermfg=5 guifg=Purple
Type           xxx ctermfg=2 gui=bold guifg=SeaGreen
Underlined     xxx cterm=underline ctermfg=5 gui=underline guifg=SlateBlue
Ignore         xxx ctermfg=15 guifg=bg
Todo           xxx ctermfg=0 ctermbg=11 guifg=Blue guibg=Yellow
String         xxx links to Constant
Character      xxx links to Constant
Number         xxx links to Constant
Boolean        xxx links to Constant
Float          xxx links to Number
Function       xxx links to Identifier
Conditional    xxx links to Statement
Repeat         xxx links to Statement
Label          xxx links to Statement
Operator       xxx links to Statement
Keyword        xxx links to Statement
Exception      xxx links to Statement
links to PreProc

It looks like NeoVim has far less compilation options, so hlsearch should be enabled in all builds. 看来NeoVim的编译选项要少得多,因此应在所有版本中都启用hlsearch。 That documentation hint about extra_search presumably comes from the original Vim help, and doesn't apply to NeoVim. 关于extra_search文档提示大概来自原始的Vim帮助,不适用于NeoVim。

So, if you see that :hi Search in its intended yellow, it should work, at least after :set hlsearch 因此,如果您看到:hi Search以预期的黄色进行:hi Search ,则至少在:set hlsearch之后,它应该可以工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM