Files
nuwiki/plugin/nuwiki.vim
T

30 lines
1.0 KiB
VimL
Raw Normal View History

" plugin/nuwiki.vim — universal Vim/Neovim entry point.
"
" Neovim 0.11+ users are expected to call `require('nuwiki').setup({})` from
" their config (lazy.nvim does this automatically through `opts`). On Vim
" we start the LSP client when a vimwiki buffer is loaded.
"
" Per SPEC §6.2 / §6.3 this file contains wiring only — all logic lives in
" the Rust language server.
if exists('g:loaded_nuwiki')
finish
endif
let g:loaded_nuwiki = 1
if has('nvim')
" Neovim path is initialised by `require('nuwiki').setup()`. Nothing else
" to do at vimscript boot — wait until the user runs setup.
finish
endif
" Vim path: start the LSP client the first time a vimwiki buffer is opened.
augroup nuwiki_vim_lsp_start
autocmd!
autocmd FileType vimwiki call nuwiki#lsp#start()
augroup END
" :NuwikiInstall — convenience wrapper around scripts/download_bin.vim, so
" users don't have to invoke a plugin-manager build hook by hand.
command! -nargs=0 NuwikiInstall execute 'source' fnamemodify(resolve(expand('<sfile>:p')), ':h:h') . '/scripts/download_bin.vim'