diff --git a/config/nvim/lazy-lock.json b/config/nvim/lazy-lock.json index 250f11a..be1702a 100644 --- a/config/nvim/lazy-lock.json +++ b/config/nvim/lazy-lock.json @@ -3,6 +3,8 @@ "alpha-nvim": { "branch": "main", "commit": "234822140b265ec4ba3203e3e0be0e0bb826dff5" }, "bufferline.nvim": { "branch": "main", "commit": "357cc8f8eeb64702e6fcf2995e3b9becee99a5d3" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "8ee981b4a91f536f52add291594e89fb6645e451" }, + "cmp-git": { "branch": "main", "commit": "f900a4cf117300fdc3ba31d26f8b6223ccd9c574" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, @@ -54,6 +56,9 @@ "treesj": { "branch": "main", "commit": "070e6761d0b11a55446d988a69908f7a0928dbab" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, "ts-node-action": { "branch": "master", "commit": "f266409809555d7604b1ba894ffad8958670d04f" }, + "vim-dadbod": { "branch": "master", "commit": "fecf5a3ecfb1869f34252c7c27351de99f01ab0e" }, + "vim-dadbod-completion": { "branch": "master", "commit": "bcdf3ff768cc7e544a0f78b0383d8719c2116569" }, + "vim-dadbod-ui": { "branch": "master", "commit": "95fd22469507e86b78aa55d868c14108adee2881" }, "vim-fugitive": { "branch": "master", "commit": "cbe9dfa162c178946afa689dd3f42d4ea8bf89c1" }, "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" }, "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" } diff --git a/config/nvim/lua/aleidk/keymaps.lua b/config/nvim/lua/aleidk/keymaps.lua index 688e2f2..b9fa2b1 100644 --- a/config/nvim/lua/aleidk/keymaps.lua +++ b/config/nvim/lua/aleidk/keymaps.lua @@ -24,6 +24,8 @@ end -- See `:help vim.keymap.set()` vim.keymap.set({ "n", "v" }, "", "", { silent = true }) +vim.keymap.set("n", "", "w", default("Keep cursor centered while junping")) + -- Remap for dealing with word wrap vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) diff --git a/config/nvim/lua/aleidk/plugins/colorscheme.lua b/config/nvim/lua/aleidk/plugins/colorscheme.lua index 1543804..1209bc6 100644 --- a/config/nvim/lua/aleidk/plugins/colorscheme.lua +++ b/config/nvim/lua/aleidk/plugins/colorscheme.lua @@ -7,6 +7,12 @@ return { -- Change colors.none if not using a transparent background transparent_background = false, integrations = { cmp = true, + notify = true, + harpoon = true, + mason = true, + neogit = true, + noice = true, + lsp_trouble = true, indent_blankline = { enabled = true, }, @@ -17,6 +23,10 @@ return { -- Change colors.none if not using a transparent background Pmenu = { bg = colors.none, blend = 0 }, FloatBorder = { bg = colors.none }, CmpItemMenu = { fg = colors.text, bg = colors.none }, + -- dadbod-ui + NotificationInfo = { bg = colors.none, fg = colors.text }, + NotificationWarning = { bg = colors.none, fg = colors.yellow }, + NotificationError = { bg = colors.none, fg = colors.red }, } end, }, diff --git a/config/nvim/lua/aleidk/plugins/completion.lua b/config/nvim/lua/aleidk/plugins/completion.lua index 658294f..6505c1d 100644 --- a/config/nvim/lua/aleidk/plugins/completion.lua +++ b/config/nvim/lua/aleidk/plugins/completion.lua @@ -1,3 +1,4 @@ +---@diagnostic disable: missing-fields return { "hrsh7th/nvim-cmp", version = false, -- last release is way too old @@ -6,9 +7,11 @@ return { "hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-buffer", "hrsh7th/cmp-path", + "petertriho/cmp-git", + "hrsh7th/cmp-cmdline", "saadparwaiz1/cmp_luasnip", }, - opts = function() + config = function() vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true }) local cmp = require("cmp") local defaults = require("cmp.config.default")() @@ -18,7 +21,7 @@ return { -- fix colors for catppuccin colorscheme winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None", } - return { + local opts = { completion = { completeopt = "menu,menuone,noinsert", }, @@ -37,11 +40,12 @@ return { [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), ["
"] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - [""] = cmp.mapping.confirm({ + [""] = cmp.mapping.confirm({ select = false }), -- Confirm only if selected an item + [""] = cmp.mapping.confirm({ + -- Auto confirms first item behavior = cmp.ConfirmBehavior.Replace, select = true, - }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), }), sources = cmp.config.sources({ { name = "nvim_lsp" }, @@ -70,5 +74,25 @@ return { }, sorting = defaults.sorting, } + + cmp.setup(opts) + + -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). + cmp.setup.cmdline({ "/", "?" }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = "buffer" }, + }, + }) + + -- 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 = "cmdline" }, + }), + }) end, } diff --git a/config/nvim/lua/aleidk/plugins/database.lua b/config/nvim/lua/aleidk/plugins/database.lua new file mode 100644 index 0000000..a644434 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/database.lua @@ -0,0 +1,44 @@ +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", + }, + keys = { + { "ud", "DBUIToggle", desc = "Toggle DB UI" }, + }, + init = function() + -- Your DBUI configuration + vim.g.db_ui_use_nerd_fonts = 1 + vim.g.db_ui_force_echo_notifications = 1 + + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + command = [[setlocal omnifunc=vim_dadbod_completion#omni]], + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = { + "sql", + "mysql", + "plsql", + }, + callback = function() + ---@diagnostic disable-next-line: missing-fields + require("cmp").setup.buffer({ + sources = { { name = "vim-dadbod-completion" } }, + }) + end, + }) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/treesitter.lua b/config/nvim/lua/aleidk/plugins/treesitter.lua index 47f6163..055a9d7 100644 --- a/config/nvim/lua/aleidk/plugins/treesitter.lua +++ b/config/nvim/lua/aleidk/plugins/treesitter.lua @@ -22,6 +22,7 @@ return { "python", "regex", "rust", + "sql", "tsx", "typescript", "vim",