languages.lua (1587B)
1 return { 2 { 3 "https://gn.googlesource.com/gn", 4 opts = {}, 5 config = function(plugin) 6 vim.opt.rtp:append(plugin.dir .. "/misc/vim") 7 end 8 }, 9 { "nathangrigg/vim-beancount" }, 10 { 11 "neovim/nvim-lspconfig", 12 opts = {}, 13 event = { "BufReadPre", "BufNewFile" }, 14 config = function() 15 local lspconfig = require('lspconfig') 16 if vim.fn.executable('clangd') == 1 then 17 lspconfig.clangd.setup({}) 18 end 19 if vim.fn.executable('dart') == 1 then 20 lspconfig.dartls.setup({}) 21 end 22 if vim.fn.executable('lua-language-server') == 1 then 23 lspconfig.lua_ls.setup({}) 24 end 25 if vim.fn.executable('rust-analyzer') == 1 then 26 lspconfig.rust_analyzer.setup({}) 27 end 28 if vim.fn.executable('sourcekit-lsp') == 1 then 29 lspconfig.sourcekit.setup({ 30 capabilities = { 31 workspace = { 32 didChangeWatchedFiles = { 33 dynamicRegistration = true, 34 }, 35 }, 36 }, 37 }) 38 end 39 40 vim.api.nvim_create_autocmd("LspAttach", { 41 group = vim.api.nvim_create_augroup("UserLspConfig", {}), 42 callback = function(ev) 43 local opts = { buffer = ev.buf, silent = true } 44 opts.desc = "See available code actions" 45 vim.keymap.set({"n", "v"}, "<leader>ca", vim.lsp.buf.code_action, opts) 46 opts.desc = "Smart rename" 47 vim.keymap.set("n", "<leader>cr", vim.lsp.buf.rename, opts) 48 end, 49 }) 50 end, 51 }, 52 { "rhysd/vim-clang-format" }, 53 { "rust-lang/rust.vim" }, 54 }