Skip to content

Conversation

@jclsn
Copy link

@jclsn jclsn commented Dec 10, 2025

Adds more vim9 lsp highlights. I chose a different color for structs/classes than primitive types and changed the StorageClass to SpaceduckPink (was still unused), so it is not he same color as the classes. Looks very nice imo

image

@jclsn jclsn changed the base branch from main to dev December 10, 2025 22:31
@jclsn
Copy link
Author

jclsn commented Dec 13, 2025

@jinh0 @pineapplegiant Hi, can you merge this one? Would also be nice to update main at some point

@pineapplegiant
Copy link
Owner

I'll test and merge tomorrow

@jclsn
Copy link
Author

jclsn commented Dec 13, 2025

Here is an example config for the vim9 lsp using vim-plug

set encoding=utf-8
set nocompatible
colorscheme spaceduck

call plug#begin('$MYVIMDIR/plugged')
     Plug 'yegappan/lsp'
     Plug 'pineapplegiant/spaceduck'
call plug#end()

let lspOpts = #{
        \   aleSupport: v:false,
        \   autoComplete: v:true,
        \   autoHighlight: v:false,
        \   autoHighlightDiags: v:true,
        \   autoPopulateDiags: v:false,
        \   completionMatcher: 'case',
        \   completionMatcherValue: 1,
        \   diagSignErrorText: '',
        \   diagSignHintText: '💡',
        \   diagSignInfoText: '💡',
        \   diagSignWarningText: '💡',
        \   diagSignPriority: {
        \       'Error': 100,
        \       'Warning': 99,
        \       'Information': 98,
        \       'Hint': 97
        \   },
        \   echoSignature: v:false,
        \   hideDisabledCodeActions: v:false,
        \   highlightDiagInline: v:true,
        \   hoverInPreview: v:false,
        \   ignoreMissingServer: v:false,
        \   keepFocusInDiags: v:true,
        \   keepFocusInReferences: v:true,
        \   completionTextEdit: v:true,
        \   diagVirtualTextAlign: 'above',
        \   diagVirtualTextWrap: 'default',
        \   noNewlineInCompletion: v:false,
        \   omniComplete: v:null,
        \   omniCompleteAllowBare: v:false,
        \   outlineOnRight: v:false,
        \   outlineWinSize: 20,
        \   popupBorder: v:true,
        \   popupBorderHighlight: 'Title',
        \   popupBorderHighlightPeek: 'Special',
        \   popupBorderSignatureHelp: v:false,
        \   popupHighlightSignatureHelp: 'Pmenu',
        \   popupHighlight: 'Normal',
        \   semanticHighlight: v:true,
        \   showDiagInBalloon: v:true,
        \   showDiagInPopup: v:true,
        \   showDiagOnStatusLine: v:false,
        \   showDiagWithSign: v:true,
        \   showDiagWithVirtualText: v:false,
        \   showInlayHints: v:false,
        \   showSignature: v:true,
        \   snippetSupport: v:false,
        \   ultisnipsSupport: v:false,
        \   useBufferCompletion: v:false,
        \   usePopupInCodeAction: v:false,
        \   useQuickfixForLocations: v:false,
        \   vsnipSupport: v:false,
        \   bufferCompletionTimeout: 100,
        \   customCompletionKinds: v:false,
        \   completionKinds: {},
        \   filterCompletionDuplicates: v:false,
        \   condensedCompletionMenu: v:false,
	\ }
autocmd User LspSetup call LspOptionsSet(lspOpts)

let lspServers = [#{name: 'clangd',
			\  filetype: ['c', 'cpp'],
			\  path: 'clangd',
			\  args: [
			\		'--background-index',
			\		'--clang-tidy',
			\		'--completion-style=detailed'
			\  ]
			\ }]

autocmd User LspSetup call LspAddServer(lspServers)

nnoremap <leader>ac :LspCodeAction<CR>
nnoremap <silent> <leader>pe :LspDiagPrev<CR>
nnoremap <silent> <leader>ne :LspDiagNext<CR>
nnoremap <silent> <leader>pd :LspPeekDefinition<CR>
nnoremap <silent> <leader>pdc :LspPeekDeclaration<CR>
nnoremap <silent> <leader>pr :LspPeekReferences<CR>
nnoremap <silent> <leader>ol :LspOutline<CR>
nnoremap <silent> <leader>rn :LspRename<CR>
nnoremap <leader>cl :LspCodeLens<CR>

function! s:SmartHover() abort
	let result = execute('LspHover')
	if result =~ 'Error'
		call feedkeys('K', 'n')
	endif
endfunction

nnoremap <silent> K :call <SID>SmartHover()<CR>

nnoremap <silent> gd :LspGotoDefinition<CR>
nnoremap <silent> gy :LspGotoTypeDef<CR>
nnoremap <silent> gi :LspGotoImpl<CR>
nnoremap <silent> gdc :LspGotoDeclaration<CR>

command! -nargs=0 -bar -range=% Format <line1>,<line2>LspFormat
set formatexpr=lsp#lsp#FormatExpr() " Map LspFormat to the gq command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants