fix(vim): gate Neovim TS-style highlight groups + correct bin path lookup
Plain Vim spat a wall of `W18: Invalid character in group name` on
every buffer load because `syntax/vimwiki.vim` declared the
LSP-token highlight defaults with Tree-sitter-style names
(`@vimwikiHeading.level1`, `@vimwikiBold`, …). Those work on Neovim
but Vim rejects `@` and `.` in group names.
- `syntax/vimwiki.vim` now guards the `@vimwiki*` block with
`has('nvim')`. The static regex fallback below it (which uses
Vim-compatible `nuwiki*` group names) keeps highlighting working
on plain Vim.
While reproducing, also noticed `autoload/nuwiki/lsp.vim`'s
`s:bin_path` reported the binary at `/home/gfranco/bin/nuwiki-ls`
(only two dirs under `$HOME`) instead of
`/home/gfranco/git-repositories/nuwiki/bin/nuwiki-ls`. Cause:
`expand('<sfile>:p')` inside a function resolves to the *calling*
script at invocation time, not this autoload file. Captured the
plugin root via `<sfile>` at script-load time into a new
`s:plugin_root` and used it in `bin_path()`.
Verified with `vim -u .vimrc index.wiki`:
- `:messages` is empty of W18 warnings.
- The "binary not found" path (when no built binary exists) now
prints the correct repo-relative path.
Total 377 Rust tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
" 2. coc.nvim
|
||||
" 3. Print an error if neither is available.
|
||||
|
||||
" Resolve the plugin root at script-load time. `<sfile>` inside a
|
||||
" function later returns the *calling* script's path, not this file's
|
||||
" — capturing it here is the reliable way.
|
||||
let s:plugin_root = fnamemodify(resolve(expand('<sfile>:p')), ':h:h:h')
|
||||
|
||||
let s:started = 0
|
||||
|
||||
function! nuwiki#lsp#start() abort
|
||||
@@ -60,9 +65,8 @@ function! s:bin_path() abort
|
||||
if exists('g:nuwiki_binary_path') && filereadable(g:nuwiki_binary_path)
|
||||
return g:nuwiki_binary_path
|
||||
endif
|
||||
let l:plugin_dir = fnamemodify(resolve(expand('<sfile>:p')), ':h:h:h')
|
||||
let l:suffix = has('win32') ? '.exe' : ''
|
||||
return l:plugin_dir . '/bin/nuwiki-ls' . l:suffix
|
||||
return s:plugin_root . '/bin/nuwiki-ls' . l:suffix
|
||||
endfunction
|
||||
|
||||
function! s:settings() abort
|
||||
|
||||
Reference in New Issue
Block a user