diff options
| author | fschildt <florian.schildt@protonmail.com> | 2025-11-27 19:23:31 +0100 |
|---|---|---|
| committer | fschildt <florian.schildt@protonmail.com> | 2025-11-27 19:23:31 +0100 |
| commit | ef4ed6733ad7a33166cf9a32b08fb2359bb2e4f4 (patch) | |
| tree | 74996d829d9eeb40ea1268cb8d6148105a61191c /.config/nvim/init.lua | |
| parent | 8c2778636e3025548185fba3e8d1d7ddd497b752 (diff) | |
nvim: add html-lsp and fix snippets
Diffstat (limited to '.config/nvim/init.lua')
| -rw-r--r-- | .config/nvim/init.lua | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9f3718d..6d171d5 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -38,7 +38,7 @@ vim.pack.add({ { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, { src = 'https://github.com/nvim-lualine/lualine.nvim' }, - -- enhance language server capabilities (i guess) + -- treesitter { src = 'https://github.com/nvim-treesitter/nvim-treesitter', version = 'main' }, -- autoconfigure language servers @@ -56,6 +56,7 @@ vim.pack.add({ { src = 'https://github.com/hrsh7th/nvim-cmp' }, { src = 'https://github.com/hrsh7th/cmp-vsnip' }, { src = 'https://github.com/hrsh7th/vim-vsnip' }, + { src = 'https://github.com/rafamadriz/friendly-snippets' }, -- telescope { src = 'https://github.com/nvim-lua/plenary.nvim' }, @@ -134,7 +135,12 @@ require('lualine').setup({ -- treesitter -require'nvim-treesitter'.install { 'cpp' } +require('nvim-treesitter').setup { + config = { + ensure_installed = { 'cpp', 'html', 'htmldjango' }, + automatic_installation = true, + } +} -- cmp @@ -156,10 +162,12 @@ cmp.setup({ ['<C-e>'] = cmp.mapping.abort(), ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), - sources = cmp.config.sources({ + sources = cmp.config.sources( + { { name = 'nvim_lsp' }, { name = 'vsnip' }, - }, { + }, + { { name = 'buffer' }, }) }) @@ -187,38 +195,32 @@ cmp.setup.cmdline(':', { }) --- language server installation (via mason) local capabilities = require('cmp_nvim_lsp').default_capabilities() -require("mason").setup() -require("mason-lspconfig").setup({ - ensure_installed = { "lua_ls", "clangd", "pyright", "djlsp" }, - automatic_installation = true, - handlers = { - function(server_name) - require("lspconfig")[server_name].setup({ - capabilities = capabilities, - -- on_attach = your_on_attach, -- if you have one - -- settings = {...}, -- per-server overrides go here if needed - }) - end, +require('mason').setup() +require('mason-lspconfig').setup({ + ensure_installed = { + 'lua_ls', + 'clangd', + 'pyright', + 'html', -- official vscode html server }, - -- Optional: override specific servers if you really need something special - -- ["rust_analyzer"] = function() - -- require("rust-tools").setup({}) - -- end, }) +vim.lsp.config('*', { + capabilities = capabilities, +}) --- language server enabling -vim.lsp.enable({ - 'lua_ls', - 'clangd', - 'pyright', - 'djlsp' +vim.lsp.config('html', { + filetypes = { "html", "htmldjango" }, + init_options = { + provideFormatter = true, + embeddedLanguages = { css = true, javascript = true }, + }, }) +-- telescope local builtin = require('telescope.builtin') vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' }) vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' }) @@ -229,10 +231,10 @@ vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = 'Telescope help ta -- vimtex (latex support) require('lualine').setup({ - ft = { "tex", "bib" }, - dependencies = { "nvim-treesitter/nvim-treesitter" }, + ft = { 'tex', 'bib' }, + dependencies = { 'nvim-treesitter/nvim-treesitter' }, config = function() - vim.g.vimtex_view_method = "mupdf" + vim.g.vimtex_view_method = 'mupdf' end }) |
