diff --git a/lua/settings/init.lua b/lua/settings/init.lua index 7d7be49..e480c11 100644 --- a/lua/settings/init.lua +++ b/lua/settings/init.lua @@ -42,6 +42,7 @@ function settings.init() require('settings.lsp').init() require('settings.completion') require('settings.tree') + require('settings.luasnip') end return settings diff --git a/lua/settings/lsp.lua b/lua/settings/lsp.lua index a180610..25152e5 100644 --- a/lua/settings/lsp.lua +++ b/lua/settings/lsp.lua @@ -23,7 +23,7 @@ function lsp.init() require('mason').setup() require('mason-lspconfig').setup() - local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) + local capabilities = require('cmp_nvim_lsp').default_capabilities() local lspconfig = require('lspconfig') lspconfig.sumneko_lua.setup { @@ -60,6 +60,18 @@ function lsp.init() capabilities = capabilities, on_attach = lsp_attach } + lspconfig.sqlls.setup({ + capabilities = capabilities, + on_attach = lsp_attach + }) + lspconfig.html.setup({ + capabilities = capabilities, + on_attach = lsp_attach + }) + lspconfig.cssls.setup({ + capabilities = capabilities, + on_attach = lsp_attach + }) end return lsp diff --git a/lua/settings/luasnip.lua b/lua/settings/luasnip.lua new file mode 100644 index 0000000..6f5c7ba --- /dev/null +++ b/lua/settings/luasnip.lua @@ -0,0 +1,3 @@ +local ls = require("luasnip") + +require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets/" }) diff --git a/lua/settings/theme.lua b/lua/settings/theme.lua index 714147e..b0438fa 100644 --- a/lua/settings/theme.lua +++ b/lua/settings/theme.lua @@ -28,6 +28,12 @@ function theme.initColorscheme() vim.cmd 'colorscheme darcula-solid' vim.cmd 'set termguicolors' vim.opt.syntax = 'on' + require('nvim-treesitter.configs').setup { + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + } + } end function theme.init() diff --git a/snippets/go.lua b/snippets/go.lua new file mode 100644 index 0000000..e736795 --- /dev/null +++ b/snippets/go.lua @@ -0,0 +1,25 @@ +local ls = require("luasnip") +local s = ls.s +local i = ls.i +local t = ls.t + +local d = ls.dynamic_node +local c = ls.choice_node +local f = ls.function_node +local sn = ls.snippet_node + +local fmt = require("luasnip.extras.fmt").fmt +local rep = require("luasnip.extras").rep + +local snippets, autosnippets = {}, {} + +local errorSnippet = s("error", fmt([[ +if err != nil {{ + {} +}} +]], { + i(1, "return nil, err") +})) +table.insert(snippets, errorSnippet) + +return snippets, autosnippets