diff --git a/lua/barink/init.lua b/lua/barink/init.lua index ef37f23..e1f601f 100644 --- a/lua/barink/init.lua +++ b/lua/barink/init.lua @@ -13,12 +13,10 @@ end vim.opt.rtp:prepend(lazypath) require("barink.keys") require("lazy").setup("barink.plugins" , { - root = vim.fn.stdpath("data") .. "/lazy", -- directory where plugins will be installed - -- leave nil when passing the spec as the first argument to setup() + root = vim.fn.stdpath("data") .. "/lazy", change_detection = { - -- automatically check for config file changes and reload the ui enabled = false, - notify = true, -- get a notification when changes are found + notify = true, }, }) diff --git a/lua/barink/plugins/AI.lua b/lua/barink/plugins/AI.lua new file mode 100644 index 0000000..72f647d --- /dev/null +++ b/lua/barink/plugins/AI.lua @@ -0,0 +1,8 @@ +return { + "nomnivore/ollama.nvim", + dependencies = { + "nvim-lua/plenary.nvim" + }, + cmd = { "Ollama", "OllamaServe", "OllamaModel", "OllamaServeStop" }, + opts = {} +} diff --git a/lua/barink/plugins/Oil.lua b/lua/barink/plugins/Oil.lua index c878914..692db51 100644 --- a/lua/barink/plugins/Oil.lua +++ b/lua/barink/plugins/Oil.lua @@ -8,6 +8,7 @@ return { 'nvim-tree/nvim-web-devicons' }, config = function() + require("oil").setup() vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) end } 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/flash.lua b/lua/barink/plugins/flash.lua new file mode 100644 index 0000000..a60e892 --- /dev/null +++ b/lua/barink/plugins/flash.lua @@ -0,0 +1,12 @@ +return { + "folke/flash.nvim", + event = "VeryLazy", + opts = {}, + keys = { + { "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + { "r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" }, + { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, + { "", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, + }, +} diff --git a/lua/barink/plugins/harpoon.lua b/lua/barink/plugins/harpoon.lua index 5a4c561..1ec0a6b 100644 --- a/lua/barink/plugins/harpoon.lua +++ b/lua/barink/plugins/harpoon.lua @@ -1,16 +1,14 @@ return { "ThePrimeagen/harpoon", - branch= "harpoon2", + branch = "harpoon2", dependencies = { - {"nvim-lua/plenary.nvim"}, - {"nvim-telescope/telescope.nvim"} + { "nvim-lua/plenary.nvim" }, + { "nvim-telescope/telescope.nvim" } }, config = function() local harpoon = require("harpoon") harpoon.setup() - vim.keymap.set("n", "ha", function() harpoon:list():add() end) - vim.keymap.set("n", "hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) local conf = require("telescope.config").values local function toggle_telescope(harpoon_files) local file_paths = {} @@ -27,15 +25,14 @@ return { vim.keymap.set("n", "ha", function() harpoon:list():add() end) vim.keymap.set("n", "hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end) - vim.keymap.set("n", "fe", function () toggle_telescope(harpoon:list()) end, { desc = "Open harpoon window"} ) + vim.keymap.set("n", "fe", function() toggle_telescope(harpoon:list()) end, + { desc = "Open harpoon window" }) vim.keymap.set("n", "C-1", function() harpoon:list():select(1) end) vim.keymap.set("n", "C-2", function() harpoon:list():select(2) end) vim.keymap.set("n", "C-3", function() harpoon:list():select(3) end) vim.keymap.set("n", "C-4", function() harpoon:list():select(4) end) - - vim.keymap.set("n", "", function() harpoon:list():prev() end) - vim.keymap.set("n", "", function() harpoon:list():next() end) - + vim.keymap.set("n", "", function() harpoon:list():prev() end) + vim.keymap.set("n", "", function() harpoon:list():next() end) end } diff --git a/lua/barink/plugins/lsp.lua b/lua/barink/plugins/lsp.lua index 865baed..4d41f5a 100644 --- a/lua/barink/plugins/lsp.lua +++ b/lua/barink/plugins/lsp.lua @@ -1,120 +1,23 @@ 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 = require("lspconfig") + + for _, data in ipairs(capabilities) do + print(data) + end + local language_server = { asm_lsp = true, @@ -132,8 +35,7 @@ return } }, clangd = { - capabilities = capabilities, - root_dir = 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 = { @@ -146,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' } } } } + }, } @@ -172,7 +69,8 @@ return config = {} end config = vim.tbl_deep_extend("force", {}, { capabilities = capabilities }, config) - lsp[name].setup({}) + vim.lsp.config(name, config) + vim.lsp.enable(name) end vim.api.nvim_create_autocmd("LspAttach", { callback = function(args) diff --git a/lua/barink/plugins/neovim-context.lua b/lua/barink/plugins/neovim-context.lua new file mode 100644 index 0000000..5e54e07 --- /dev/null +++ b/lua/barink/plugins/neovim-context.lua @@ -0,0 +1,16 @@ +return { + { + "nvim-treesitter/nvim-treesitter-context", + dependencies = { + }, + config = function() + require('treesitter-context').setup({ + enable = true, + max_lines = 4, + min_window_height = 0, + line_numbers = true, + mode = 'cursor', + }) + end + } +} diff --git a/lua/barink/plugins/oil.lua b/lua/barink/plugins/oil.lua index c878914..692db51 100644 --- a/lua/barink/plugins/oil.lua +++ b/lua/barink/plugins/oil.lua @@ -8,6 +8,7 @@ return { 'nvim-tree/nvim-web-devicons' }, config = function() + require("oil").setup() vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) end } diff --git a/lua/barink/plugins/roslynLsp.lua b/lua/barink/plugins/roslynLsp.lua new file mode 100644 index 0000000..d347c02 --- /dev/null +++ b/lua/barink/plugins/roslynLsp.lua @@ -0,0 +1,6 @@ +return { + "seblyng/roslyn.nvim", + config = function() + require("roslyn").setup() + end, +} 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 +} diff --git a/lua/barink/plugins/typescriptTools.lua b/lua/barink/plugins/typescriptTools.lua new file mode 100644 index 0000000..33e4c68 --- /dev/null +++ b/lua/barink/plugins/typescriptTools.lua @@ -0,0 +1,8 @@ +return { + "pmizio/typescript-tools.nvim", + dependencies = { + "nvim-lua/plenary.nvim", + "neovim/nvim-lspconfig", + }, + opts = {} +} diff --git a/lua/barink/plugins/wezterm.lua b/lua/barink/plugins/wezterm.lua new file mode 100644 index 0000000..090e3e2 --- /dev/null +++ b/lua/barink/plugins/wezterm.lua @@ -0,0 +1,13 @@ +return { + 'craigmac/nvim-navigator', + config = function() + require('Navigator').setup() + + vim.keymap.set({ 'n', 't' }, '', 'NavigatorLeft') + vim.keymap.set({ 'n', 't' }, '', 'NavigatorRight') + vim.keymap.set({ 'n', 't' }, '', 'NavigatorUp') + vim.keymap.set({ 'n', 't' }, '', 'NavigatorDown') + vim.keymap.set({ 'n', 't' }, '', 'NavigatorPrevious') + end + +} diff --git a/lua/barink/vim.lua b/lua/barink/vim.lua index 7d263c1..8fca0e5 100644 --- a/lua/barink/vim.lua +++ b/lua/barink/vim.lua @@ -35,13 +35,3 @@ vim.api.nvim_create_autocmd('LspAttach', { vim.g.netrw_browse_split = 0 vim.g.netrw_winsize = 25 - ---[[ --- Run zig test on save --- TODO: fix vim.cmd call --- TODO: only do this when a zig test file is open -vim.api.nvim_create_autocmd('BufWritePost' , { - callback = function () - vim.cmd{cmd = '!zig' , args= {'test', vim.fn.expand('%')} } - end -})]] --