statusbar and lsp

This commit is contained in:
2025-12-19 13:14:54 +08:00
parent 8cf62da159
commit b928bcc39b
5 changed files with 54 additions and 5 deletions

View File

@ -2,10 +2,13 @@ vim9script
TuiLayer plug.colorscheme
TuiLayer plug.whichkey
TuiLayer plug.nerdtree
TuiLayer plug.poplar
TuiLayer plug.whichkey
TuiLayer plug.qline
TuiLayer plug.lsp
TuiLayer plug.coc

34
layers/plug/lsp.vim Normal file
View File

@ -0,0 +1,34 @@
vim9script
# lsp servers
g:lsp_servers = []
## clangd
const clangd_path = has('win32') || has('win64') ? expand('$SCOOP/apps/clangd/current/bin/clangd.exe') : '/usr/bin/clangd'
if filereadable(clangd_path)
add(g:lsp_servers, { name: 'clangd', filetype: ['c', 'cpp', 'h'], path: clangd_path, args: ['--background-index'] })
endif
## vimlsp
const vimlsp_path = expand("$HOME/.vmr/versions/node_versions/node/bin/vim-language-server")
if filereadable(vimlsp_path)
add(g:lsp_servers, { name: 'vimlsp', filetype: ['vim', 'vimrc'], path: vimlsp_path, args: ['--stdio'] })
endif
# lsp options
g:lsp_options = {
autoHighligntDiags: v:true
}
tui#core#plug#Regist('yegappan/lsp', {
config: () => {
autocmd User LspSetup call LspOptionsSet(g:lsp_options)
autocmd User LspSetup call LspAddServer(g:lsp_servers)
# keymaps
nnoremap <silent> K :LspHover<CR>
if exists('g:which_key_map')
g:which_key_map['v']['o'] = ['LspOutline', 'outline']
else
nnoremap <silent> <Leader>vo :LspOutline<CR>
endif
}
})

View File

@ -7,7 +7,12 @@ tui#core#plug#Regist('preservim/nerdtree', {
],
config: () => {
final g:NERDTreeFileLines = 1
nnoremap <SPACE>vf :NERDTreeToggle<CR>
if exists('g:which_key_map')
g:which_key_map['v']['f'] = ['NERDTreeToggle', 'nerdtree']
else
nnoremap <SPACE>vf :NERDTreeToggle<CR>
endif
}
})

8
layers/plug/qline.vim Normal file
View File

@ -0,0 +1,8 @@
vim9script
g:qline_config = {
separator: { left: "\ue0b0", right: "\ue0b2", margin: ' ' },
subseparator: { left: "\ue0b1", right: "\ue0b3", margin: ' ' },
}
tui#core#plug#Regist('Bakudankun/qline.vim')

View File

@ -1,6 +1,6 @@
vim9script
const g:which_key_map = {
g:which_key_map = {
f: {
name: 'File',
o: ['Poplar', 'open'],
@ -8,7 +8,6 @@ const g:which_key_map = {
},
v: {
name: 'View',
f: ["NERDTreeToggle", "nerdtree"]
}
}