vim9script export const lspOptions = { aleSupport: true, ignoreMissingServer: true, } def ServerHas(feature: string): bool return lsp#buffer#CurbufGetServer(feature) != {} enddef export def SetBufferOptions(): void if ServerHas('documentFormatting') setlocal formatexpr=lsp#lsp#FormatExpr() endif if ServerHas('hover') setlocal keywordprg=:LspHover endif if ServerHas('declaration') nnoremap gD LspGotoDeclaration endif if ServerHas('definition') nnoremap gd LspGotoDefinition endif if ServerHas('implementation') nnoremap gi LspGotoImpl endif if ServerHas('references') nnoremap gr LspShowReferences endif if ServerHas('selectionRange') xnoremap e LspSelectionExpand xnoremap s LspSelectionShrink endif enddef