fix(wiki): build wiki picker list from config so it works before opening a file
The picker fetched the wiki list via workspace/executeCommand, but the LSP only starts once a vimwiki buffer exists — so a wiki could not be selected until one was already open (chicken-and-egg). Read the list straight from config instead (g:nuwiki_wikis / scalar fallback, the same source as open_wiki_path) and open the chosen index directly; that auto-starts the server via the FileType autocmd. - Vim: new public nuwiki#commands#wiki_list(); wiki_ui_select() uses it + inputlist() + :edit. Global :VimwikiUISelect / :NuwikiUISelect commands. - Neovim: config.wiki_cfg(n) + config.wiki_list() (init.lua delegates); commands.wiki_ui_select() uses them + vim.ui.select + :edit; global VimwikiUISelect / NuwikiUISelect user commands registered in setup(). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -39,6 +39,14 @@ augroup nuwiki_vim_lsp_start
|
||||
autocmd FileType vimwiki call nuwiki#lsp#start()
|
||||
augroup END
|
||||
|
||||
" Global wiki-picker commands — available from any buffer so a wiki can be
|
||||
" chosen before a .wiki file exists. The picker reads its list from config
|
||||
" (no LSP); opening the chosen index then auto-starts the server. The
|
||||
" buffer-local :VimwikiUISelect in ftplugin/vimwiki.vim shadows these inside
|
||||
" wiki buffers but dispatches to the same function.
|
||||
command! -nargs=0 VimwikiUISelect call nuwiki#commands#wiki_ui_select()
|
||||
command! -nargs=0 NuwikiUISelect call nuwiki#commands#wiki_ui_select()
|
||||
|
||||
" Global entry-point mappings — work from any buffer, not just .wiki files.
|
||||
" Files are opened directly from config (no LSP required); the server
|
||||
" auto-starts via the FileType autocmd once the vimwiki buffer loads.
|
||||
|
||||
Reference in New Issue
Block a user