update lsp and color

This commit is contained in:
Markus Dieckmann 2023-04-20 17:13:36 +02:00
parent 2845e0c638
commit bff6f8ae18
5 changed files with 43 additions and 33 deletions

View File

@ -6,11 +6,11 @@ local has_words_before = function()
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end end
cmp.setup({ cmp.setup({
snippet = { -- snippet = {
expand = function(args) -- expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users. -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end, -- end,
}, -- },
mapping = { mapping = {
['<C-k>'] = cmp.mapping.select_prev_item(), ['<C-k>'] = cmp.mapping.select_prev_item(),
['<C-p>'] = cmp.mapping.select_prev_item(), ['<C-p>'] = cmp.mapping.select_prev_item(),
@ -47,12 +47,10 @@ cmp.setup({
end, { "i", "s" }) end, { "i", "s" })
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = 'path' }, { name = 'buffer' },
{ name = 'nvim_lsp' }, { name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' }, { name = 'nvim_lsp_signature_help' },
--{ name = 'nvim_lua' }, -- { name = 'path' },
{ name = 'buffer' },
--{ name = 'luasnip' }, -- For luasnip users.
}), }),
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),

View File

@ -71,12 +71,15 @@ require("dapui").setup()
M.setup() M.setup()
dap.listeners.after.event_initialized["dapui_config"] = function() dap.listeners.after.event_initialized["dapui_config"] = function()
print('dap event init')
dapui.open() dapui.open()
end end
dap.listeners.before.event_terminated["dapui_config"] = function() dap.listeners.before.event_terminated["dapui_config"] = function()
print('dap event terminate')
dapui.close() dapui.close()
end end
dap.listeners.before.event_exited["dapui_config"] = function() dap.listeners.before.event_exited["dapui_config"] = function()
print('dap event exit')
dapui.close() dapui.close()
end end
return M return M

View File

@ -7,15 +7,14 @@ require('mason').setup({
} }
} }
}) })
require('mason-lspconfig').setup({ require('mason-lspconfig').setup({})
ensure_installed = {"tsserver"}
})
require'mason-tool-installer'.setup { require 'mason-tool-installer'.setup {
ensure_installed = { ensure_installed = {
{ 'bash-language-server', auto_update = true }, { 'bash-language-server', auto_update = true },
'lua-language-server', 'lua-language-server',
'vim-language-server', 'vim-language-server',
'typescript-language-server',
'stylua', 'stylua',
}, },
auto_update = false, auto_update = false,

View File

@ -1,6 +1,5 @@
vim.cmd('hi CursorLine term=bold cterm=bold ctermbg=darkgrey') vim.cmd('hi CursorLine term=bold cterm=bold ctermbg=darkgrey')
vim.cmd.colorscheme "gruvbox" vim.cmd.colorscheme "catppuccin"
vim.o.background="light" vim.o.background = "light"
vim.o.termguicolors=true vim.o.termguicolors = true

View File

@ -11,7 +11,7 @@ vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
-- after the language server attaches to the current buffer -- after the language server attaches to the current buffer
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') --vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
-- Mappings. -- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
@ -105,6 +105,17 @@ require('mason-lspconfig').setup_handlers {
settings = {} settings = {}
} }
end, end,
['tsserver'] = function()
require('lspconfig')['tsserver'].setup {
on_attach = on_attach,
flags = lsp_flags,
settings = {
init_options = {
host_info = 'neovim'
}
}
}
end,
['yamlls'] = function() ['yamlls'] = function()
require('lspconfig')["yamlls"].setup { require('lspconfig')["yamlls"].setup {
on_attach = on_attach, on_attach = on_attach,