diff --git a/.gitignore b/.gitignore index d2d2f093fed979ef121af6980fa6a3ac03c33150..040f24805419fd2fb35437efa64751750c68b2ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ usage_data.json lazy-lock.json +.luarc.json usage-tracker.nvim/ diff --git a/lua/plugins/linting-config.lua b/lua/plugins/linting-config.lua new file mode 100644 index 0000000000000000000000000000000000000000..ee59a3847b18054f26540931ca4d46d57e93d78f --- /dev/null +++ b/lua/plugins/linting-config.lua @@ -0,0 +1,16 @@ +return { + { + "nvimtools/none-ls.nvim", + config = function() + local null_ls = require("null-ls") + local options = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier, + null_ls.builtins.diagnostics.eslint, + } + null_ls.setup(options) + + vim.keymap.set('n', '<leader>gf', vim.lsp.buf.format, {}) + end, + } +} diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua new file mode 100644 index 0000000000000000000000000000000000000000..231fe21ac32cb0076e605a25c6ea51613de45ab2 --- /dev/null +++ b/lua/plugins/lsp-config.lua @@ -0,0 +1,46 @@ +return { + { + "williamboman/mason.nvim", + config = function() + local options = { + PATH = "prepend", + } + require("mason").setup( options ) + end, + }, { + "williamboman/mason-lspconfig.nvim", + config = function() + local options = { + -- See below for full list + -- https://github.com/williamboman/mason-lspconfig.nvim?tab=readme-ov-file#setup + ensure_installed = { + "lua_ls", -- Lua + "clangd", -- C / C++ + "texlab", -- LaTeX + "autotools_ls", -- Make / Automake / Autoconf + "tsserver", -- Typescript / Javascript + }, + automatic_installation = true + } + require( "mason-lspconfig" ).setup( options ) + end, + }, + { + "neovim/nvim-lspconfig", + config = function() + local lspconfig = require("lspconfig") + lspconfig.lua_ls.setup( {} ) + lspconfig.clangd.setup( {} ) + lspconfig.texlab.setup( {} ) + lspconfig.tsserver.setup( {} ) + + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts) + vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts) + vim.keymap.set({ 'n', 'v' }, '<leader>ca', vim.lsp.buf.code_action, opts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) + end, + } +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index c952e6920fbcf58f15d0925055715546fdda3162..c77784b60e8d70b127f304b9e4f0a71f913762fd 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -1,32 +1,33 @@ return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function () - local config = require("nvim-treesitter.configs") - config.setup({ - ensure_installed = { - "lua", - "javascript", - "c", - "cpp", - "dockerfile", - "gitignore", - "go", - "json", - "latex", - "markdown", - "make", - "proto", - "python", - "rust", - "scss", - "sql", - "typescript", - "yaml" - }, - sync_install = false, - highlight = { enabble = true }, - indent = { enabble = true }, - }) - end, + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ + auto_install = true, + ensure_installed = { + "lua", + "javascript", + "c", + "cpp", + "dockerfile", + "gitignore", + "go", + "json", + "latex", + "markdown", + "make", + "proto", + "python", + "rust", + "scss", + "sql", + "typescript", + "yaml" + }, + sync_install = false, + highlight = { enabble = true }, + indent = { enabble = true }, + }) + end, }