diff --git a/lua/barink/plugins/AI.lua b/lua/barink/plugins/AI.lua index 97aeadd..72f647d 100644 --- a/lua/barink/plugins/AI.lua +++ b/lua/barink/plugins/AI.lua @@ -1,2 +1,8 @@ return { + "nomnivore/ollama.nvim", + dependencies = { + "nvim-lua/plenary.nvim" + }, + cmd = { "Ollama", "OllamaServe", "OllamaModel", "OllamaServeStop" }, + opts = {} } diff --git a/lua/barink/plugins/completions.lua b/lua/barink/plugins/completions.lua new file mode 100644 index 0000000..5afc144 --- /dev/null +++ b/lua/barink/plugins/completions.lua @@ -0,0 +1,76 @@ +return { + "hrsh7th/nvim-cmp", + dependencies = { + "hrsh7th/cmp-nvim-lsp", + "hrsh7th/cmp-buffer", + "hrsh7th/cmp-path", + "hrsh7th/cmp-cmdline", + "onsails/lspkind.nvim", + }, + config = function() + require("lspkind").init({}) + vim.opt.completeopt = { "menu", "menuone", "noselect", "preview" } + local cmp = require('cmp') + local lspkind = require("lspkind") + cmp.setup({ + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol', + maxwidth = 60, + ellipsis_char = '...', + show_labelDetails = true, + }), + }, + snippet = { + expand = function(args) + require('luasnip').lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp', keyword_length = 1 }, + { name = 'luasnip' }, + { name = 'path' }, + { name = 'buffer', keyword_length = 2 }, + }), + window = { + documentation = cmp.config.window.bordered() + }, + + }) + + -- Set configuration for specific filetype. + cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). + }, { + { name = 'buffer' }, + }) + }) + + cmp.setup.filetype({ "sql" }, { + sources = { + { name = "vim-dadbod-completion" }, + { name = "buffer" }, + } + }) + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' }, + { name = 'buffer' } + }, { + { name = 'cmdline' } + }), + matching = { disallow_symbol_nonprefix_matching = false } + }) + end +} diff --git a/lua/barink/plugins/dadbod-ui.lua b/lua/barink/plugins/dadbod-ui.lua deleted file mode 100644 index e3565ef..0000000 --- a/lua/barink/plugins/dadbod-ui.lua +++ /dev/null @@ -1,16 +0,0 @@ -return { - "kristijanhusak/vim-dadbod-ui", - dependencies = { - {'tpope/vim-dadbod', lazy = true }, - { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql'}, lazy = true }, - }, - cmd = { - 'DBUI', - 'DBUIToggle', - 'DBUIAddConnection', - 'DBUIFindBuffer', - }, - init = function () - vim.g.db_ui_use_nerd_fonts = 1 - end -} diff --git a/lua/barink/plugins/lsp.lua b/lua/barink/plugins/lsp.lua index 32b37c5..34c9427 100644 --- a/lua/barink/plugins/lsp.lua +++ b/lua/barink/plugins/lsp.lua @@ -1,120 +1,24 @@ return { - 'neovim/nvim-lspconfig', + "williamboman/mason.nvim", dependencies = { - { - "folke/neoconf.nvim", - opts = {} - }, "williamboman/mason-lspconfig", - "williamboman/mason.nvim", - "hrsh7th/cmp-nvim-lsp", - "hrsh7th/cmp-buffer", - "hrsh7th/cmp-path", - "hrsh7th/cmp-cmdline", - "hrsh7th/nvim-cmp", - { - 'L3MON4D3/LuaSnip', - dependencies = { - 'hrsh7th/nvim-cmp', - 'rafamadriz/friendly-snippets', - }, - version = "v2.*", - }, { 'mfussenegger/nvim-jdtls', dependencies = { 'nvim-dap' } }, - "onsails/lspkind.nvim", }, config = function() - vim.opt.completeopt = { "menu", "menuone", "noselect", "preview" } - require("lspkind").init({}) require("mason").setup() require("mason-lspconfig").setup({ ensure_installed = { "lua_ls", "bashls", "rust_analyzer" } }) - local ls = require("luasnip") - ls.config.set_config({ - history = true, - updateevents = "TextChanged, TextChangedI", - enable_autosnippets = true, - }) - local cmp = require('cmp') - local lspkind = require("lspkind") - cmp.setup({ - formatting = { - format = lspkind.cmp_format({ - mode = 'symbol', - maxwidth = 60, - ellipsis_char = '...', - show_labelDetails = true, - }), - }, - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - mapping = cmp.mapping.preset.insert({ - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp', keyword_length = 1 }, - { name = 'luasnip' }, - { name = 'path' }, - { name = 'buffer', keyword_length = 2 }, - }), - window = { - documentation = cmp.config.window.bordered() - }, - }) - - -- Set configuration for specific filetype. - cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). - }, { - { name = 'buffer' }, - }) - }) - - cmp.setup.filetype({ "sql" }, { - sources = { - { name = "vim-dadbod-completion" }, - { name = "buffer" }, - } - }) - -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). - -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). - cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' }, - { name = 'buffer' } - }, { - { name = 'cmdline' } - }), - matching = { disallow_symbol_nonprefix_matching = false } - }) - - - vim.keymap.set({ "i", "s" }, "", function() ls.expand() end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() ls.jump(1) end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() ls.jump(-1) end, { silent = true }) - vim.keymap.set({ "i", "s" }, "", function() - if ls.choice_active() then - ls.change_choice(1) - end - end, { silent = true }) - - require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/barink/snippets" }) - require("luasnip.loaders.from_vscode").lazy_load() -- Set up lspconfig. local capabilities = require("cmp_nvim_lsp").default_capabilities() - local lsp = vim.lsp.config + + for _, data in ipairs(capabilities) do + print(data) + end + + local language_server = { asm_lsp = true, mojo = true, @@ -131,8 +35,7 @@ return } }, clangd = { - capabilities = capabilities, - root_dir = vim.fs.root(0, { 'compile_commands.json', 'compile_flags.txt', '.git' }), -- require("lspconfig").util.root_pattern("compile_commands.json", "compile_flags.txt", ".git"), + root_dir = vim.fs.root(0, { 'compile_commands.json', 'compile_flags.txt', '.git' }), cmd = { "clangd" }, filetypes = { "c", "cpp", "objc", "objcpp" }, settings = { @@ -145,24 +48,19 @@ return gopls = true, intelephense = true, lua_ls = { - config = { - settings = { - Lua = { - runtime = { - version = 'LuaJIT', - }, - workspace = { - checkThirdParty = false, - library = { - vim.env.VIMRUNTIME - } - }, - diagnostics = { - globals = { 'vim' } - } + cmd = { "lua-language-server" }, + filetypes = { 'lua' }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = { 'vim' } } } } + }, } diff --git a/lua/barink/plugins/snippets.lua b/lua/barink/plugins/snippets.lua new file mode 100644 index 0000000..8878b9f --- /dev/null +++ b/lua/barink/plugins/snippets.lua @@ -0,0 +1,26 @@ +return { + 'L3MON4D3/LuaSnip', + dependencies = { + 'hrsh7th/nvim-cmp', + 'rafamadriz/friendly-snippets', + }, + version = "v2.*", + config = function() + local ls = require("luasnip") + ls.config.set_config({ + history = true, + updateevents = "TextChanged, TextChangedI", + enable_autosnippets = true, + }) + vim.keymap.set({ "i", "s" }, "", function() ls.expand() end, { silent = true }) + vim.keymap.set({ "i", "s" }, "", function() ls.jump(1) end, { silent = true }) + vim.keymap.set({ "i", "s" }, "", function() ls.jump(-1) end, { silent = true }) + vim.keymap.set({ "i", "s" }, "", function() + if ls.choice_active() then + ls.change_choice(1) + end + end, { silent = true }) + require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/lua/barink/snippets" }) + require("luasnip.loaders.from_vscode").lazy_load() + end +}