return { -- -- Ollama Workflows -- { 'nomnivore/ollama.nvim', dependencies = { 'nvim-lua/plenary.nvim', 'stevearc/dressing.nvim', }, -- All the user commands added by the plugin cmd = { "Ollama", "OllamaModel", "OllamaServe", "OllamaServeStop" }, keys = { -- Sample keybind for prompt menu. Note that the is important for selections to work properly. { "oo", ":lua require('ollama').prompt()", desc = "ollama prompt", mode = { "n", "v" }, }, -- Sample keybind for direct prompting. Note that the is important for selections to work properly. { "oG", ":lua require('ollama').prompt('Generate_Code')", desc = "ollama Generate Code", mode = { "n", "v" }, }, }, ---@type Ollama.Config opts = { model = "llama3:8b", } }, -- -- LSP Configuration -- { 'neovim/nvim-lspconfig', event = { 'BufReadPost', 'BufNewFile' }, dependencies = { 'hrsh7th/nvim-cmp', -- Autocompletion plugin 'hrsh7th/cmp-nvim-lsp', -- LSP source for nvim-cmp 'saadparwaiz1/cmp_luasnip', -- Snippets source for nvim-cmp 'L3MON4D3/LuaSnip', -- Snippets plugin }, config = function () -- -- Setup language servers. -- local lspconfig = require('lspconfig') -- Lua lspconfig.lua_ls.setup { on_init = function(client) local path = client.workspace_folders[1].name if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then client.config.settings = vim.tbl_deep_extend('force', client.config.settings, { Lua = { runtime = { -- Tell the language server which version of Lua you're using -- (most likely LuaJIT in the case of Neovim) version = 'LuaJIT' }, -- Make the server aware of Neovim runtime files workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME -- "${3rd}/luv/library" -- "${3rd}/busted/library", } -- or pull in all of 'runtimepath'. NOTE: this is a lot slower -- library = vim.api.nvim_get_runtime_file("", true) } } }) client.notify("workspace/didChangeConfiguration", { settings = client.config.settings }) end return true end } -- Haskell lspconfig.hls.setup{ filetypes = { 'haskell', 'lhaskell', 'cabal' }, } -- Nix lspconfig.nil_ls.setup{} -- C lspconfig.clangd.setup{} -- YAML lspconfig.yamlls.setup{} -- -- Global mappings -- -- See `:help vim.diagnostic.*` for documentation on any of the below functions vim.keymap.set('n', 'e', vim.diagnostic.open_float) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', ']d', vim.diagnostic.goto_next) vim.keymap.set('n', 'q', vim.diagnostic.setloclist) -- Use LspAttach autocommand to only map the following keys -- after the language server attaches to the current buffer vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('UserLspConfig', {}), callback = function(ev) -- Buffer local mappings. -- See `:help vim.lsp.*` for documentation on any of the below functions local opts = { buffer = ev.buf } 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', '', vim.lsp.buf.signature_help, opts) vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, opts) vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, opts) vim.keymap.set('n', 'wl', function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, opts) vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, opts) vim.keymap.set('n', 'rn', vim.lsp.buf.rename, opts) vim.keymap.set({ 'n', 'v' }, 'ca', vim.lsp.buf.code_action, opts) vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts) vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, opts) end, }) -- -- Autocompletion -- -- Add additional capabilities supported by nvim-cmp local capabilities = require("cmp_nvim_lsp").default_capabilities() -- Enable some language servers with the additional completion capabilities offered by nvim-cmp local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver' } for _, lsp in ipairs(servers) do lspconfig[lsp].setup { -- on_attach = my_custom_on_attach, capabilities = capabilities, } end -- luasnip setup local luasnip = require 'luasnip' -- nvim-cmp setup local cmp = require 'cmp' cmp.setup { snippet = { expand = function(args) luasnip.lsp_expand(args.body) end, }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), -- Up [''] = cmp.mapping.scroll_docs(4), -- Down -- C-b (back) C-f (forward) for snippet placeholder navigation. [''] = cmp.mapping.complete(), [''] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() else fallback() end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif luasnip.jumpable(-1) then luasnip.jump(-1) else fallback() end end, { 'i', 's' }), }), sources = { { name = 'nvim_lsp' }, { name = 'luasnip' }, }, } end }, }