diff --git a/.config/nvim/lua/plugins/blink.lua b/.config/nvim/lua/plugins/blink.lua index 8acc002..9b823fe 100644 --- a/.config/nvim/lua/plugins/blink.lua +++ b/.config/nvim/lua/plugins/blink.lua @@ -1,6 +1,6 @@ return { 'saghen/blink.cmp', - lazy = false, + event = { "InsertEnter", "CmdlineEnter" }, dependencies = { { 'rafamadriz/friendly-snippets' }, { 'kristijanhusak/vim-dadbod-completion', ft = { 'sql', 'mysql', 'plsql' }, lazy = true }, @@ -10,11 +10,17 @@ return { version = '1.*', opts = { completion = { + accept = { + auto_brackets = { + enabled = true, + }, + }, menu = { auto_show = true, winblend = vim.o.pumblend, scrollbar = true, border = 'single', + max_items = 200, draw = { columns = { { "label", "label_description", gap = 1 }, @@ -30,13 +36,15 @@ return { return 'BlinkCmpKind' .. ctx.kind end, } - } + }, + treesitter = { "lsp" } } }, documentation = { auto_show = true, - auto_show_delay_ms = 200, -- Faster doc display + auto_show_delay_ms = 200, + update_delay_ms = 50, window = { border = 'single', winblend = vim.o.pumblend, @@ -45,7 +53,9 @@ return { } }, - ghost_text = { enabled = false }, + ghost_text = { + enabled = vim.g.ai_cmp or false, + }, }, appearance = { @@ -64,14 +74,72 @@ return { }, providers = { - dadbod = { name = "Dadbod", module = "vim_dadbod_completion.blink" }, + dadbod = { + name = "Dadbod", + module = "vim_dadbod_completion.blink", + score_offset = 85, + }, laravel = { name = "laravel", module = "blink.compat.source", + score_offset = 80, + }, + lsp = { + name = "LSP", + module = "blink.cmp.sources.lsp", + score_offset = 90, + }, + path = { + name = "Path", + module = "blink.cmp.sources.path", + score_offset = 3, + opts = { + trailing_slash = false, + label_trailing_slash = true, + get_cwd = function(context) return vim.fn.getcwd() end, + show_hidden_files_by_default = true, + } + }, + snippets = { + name = "Snippets", + module = "blink.cmp.sources.snippets", + score_offset = 85, + opts = { + friendly_snippets = true, + search_paths = { vim.fn.stdpath("config") .. "/snippets" }, + global_snippets = { "all" }, + extended_filetypes = {}, + ignored_filetypes = {}, + } + }, + buffer = { + name = "Buffer", + module = "blink.cmp.sources.buffer", + opts = { + max_items = 5, + keyword_length = 2, + } + }, + cmdline = { + name = "Cmdline", + module = "blink.cmp.sources.cmdline", }, }, }, + cmdline = { + sources = function() + local type = vim.fn.getcmdtype() + if type == "/" or type == "?" then + return { 'buffer' } + end + if type == ":" then + return { 'cmdline' } + end + return {} + end, + }, + signature = { enabled = true, window = { diff --git a/.config/nvim/lua/plugins/colorscheme.lua b/.config/nvim/lua/plugins/colorscheme.lua index 6d40c7d..7a1c6cc 100644 --- a/.config/nvim/lua/plugins/colorscheme.lua +++ b/.config/nvim/lua/plugins/colorscheme.lua @@ -84,7 +84,44 @@ return { "EdenEast/nightfox.nvim", lazy = false, priority = 1000, - config = function() + opts = { + options = { + compile_path = vim.fn.stdpath("cache") .. "/nightfox", + compile_file_suffix = "_compiled", + transparent = false, + terminal_colors = true, + dim_inactive = false, + module_default = true, + colorblind = { + enable = false, + simulate_only = false, + severity = { + protan = 0, + deutan = 0, + tritan = 0, + }, + }, + styles = { + comments = "italic", + conditionals = "NONE", + constants = "NONE", + functions = "NONE", + keywords = "NONE", + numbers = "NONE", + operators = "NONE", + strings = "NONE", + types = "NONE", + variables = "NONE", + }, + inverse = { + match_paren = false, + visual = false, + search = false, + }, + } + }, + config = function(_, opts) + require("nightfox").setup(opts) vim.cmd("colorscheme carbonfox") end } diff --git a/.config/nvim/lua/plugins/dadbod.lua b/.config/nvim/lua/plugins/dadbod.lua index 9fa90df..72d6e39 100644 --- a/.config/nvim/lua/plugins/dadbod.lua +++ b/.config/nvim/lua/plugins/dadbod.lua @@ -16,7 +16,7 @@ return { vim.g.db_ui_auto_execute_table_helpers = 1 vim.g.dbs = { - dev = 'mariadb://jack:secret@localhost:33061/jack?ssl=false', + dev = 'mysql://jack:secret@localhost:33061/jack?protocol=tcp', } vim.api.nvim_create_user_command('DBUITab', function() diff --git a/.config/nvim/lua/plugins/lualine.lua b/.config/nvim/lua/plugins/lualine.lua index 1ee6237..86f5909 100644 --- a/.config/nvim/lua/plugins/lualine.lua +++ b/.config/nvim/lua/plugins/lualine.lua @@ -1,5 +1,6 @@ return { "nvim-lualine/lualine.nvim", + event = "VeryLazy", dependencies = { "nvim-tree/nvim-web-devicons", "letieu/harpoon-lualine", diff --git a/.config/nvim/lua/plugins/notify.lua b/.config/nvim/lua/plugins/notify.lua index 2d31561..39658ce 100644 --- a/.config/nvim/lua/plugins/notify.lua +++ b/.config/nvim/lua/plugins/notify.lua @@ -1,7 +1,26 @@ return { "rcarriga/nvim-notify", - lazy = false, - config = function () - vim.notify = require("notify") - end + event = "VeryLazy", + opts = { + background_colour = "#000000", + fps = 30, + icons = { + DEBUG = "", + ERROR = "", + INFO = "", + TRACE = "✎", + WARN = "" + }, + level = 2, + minimum_width = 50, + render = "default", + stages = "fade_in_slide_out", + timeout = 5000, + top_down = true + }, + config = function(_, opts) + local notify = require("notify") + notify.setup(opts) + vim.notify = notify + end, } diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 93326ad..7b16206 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -1,11 +1,13 @@ return { "nvim-telescope/telescope.nvim", + cmd = "Telescope", dependencies = { "nvim-lua/plenary.nvim", "nvim-tree/nvim-web-devicons", "debugloop/telescope-undo.nvim", "nvim-telescope/telescope-ui-select.nvim", { "nvim-telescope/telescope-fzf-native.nvim", build = "make" }, + "nvim-telescope/telescope-live-grep-args.nvim", }, config = function() local telescope = require("telescope") @@ -64,6 +66,20 @@ return { picker(opts) end + -- Visual selection live grep + local function grep_string_visual() + vim.cmd('noau normal! "vy"') + local text = vim.fn.getreg('v') + vim.fn.setreg('v', {}) + + text = string.gsub(text, "\n", "") + if #text > 0 then + builtin.live_grep({ default_text = text }) + else + builtin.live_grep() + end + end + -- Telescope setup telescope.setup({ defaults = { @@ -159,6 +175,18 @@ return { override_file_sorter = true, case_mode = "smart_case", }, + live_grep_args = { + auto_quoting = true, + mappings = { + i = { + [""] = require("telescope-live-grep-args.actions").quote_prompt(), + [""] = require("telescope-live-grep-args.actions").quote_prompt({ postfix = " --iglob " }), + }, + }, + }, + ["ui-select"] = { + require("telescope.themes").get_dropdown(), + }, }, }) @@ -166,6 +194,7 @@ return { telescope.load_extension("fzf") telescope.load_extension("undo") telescope.load_extension("ui-select") + telescope.load_extension("live_grep_args") -- Keymaps local function map(mode, lhs, rhs, desc) @@ -174,6 +203,10 @@ return { -- File navigation map("n", "ff", function() + require("telescope").extensions.live_grep_args.live_grep_args() + end, "Live grep with args") + + map("n", "fg", function() require("plugins.telescope.multigrep").live_multgrep() end, "Live multigrep") @@ -181,17 +214,20 @@ return { map("n", "fr", builtin.resume, "Resume last telescope") map("n", "fb", builtin.buffers, "Find buffers") map("n", "fo", builtin.oldfiles, "Find recent files") + map("n", "fc", builtin.commands, "Find commands") -- Search - map("n", "gf", function() + map("n", "fw", function() builtin.grep_string({ search = vim.fn.expand("") }) end, "Grep word under cursor") - map("n", "gF", function() + map("n", "fW", function() builtin.grep_string({ search = vim.fn.expand("") }) end, "Grep WORD under cursor") - map("n", "gD", function() + map("v", "fw", grep_string_visual, "Grep selection") + + map("n", "fF", function() builtin.find_files({ search_file = vim.fn.expand("") }) end, "Find file with name under cursor") @@ -214,15 +250,14 @@ return { map("n", "dws", builtin.lsp_dynamic_workspace_symbols, "Dynamic workspace symbols") -- Utilities - map("n", "u", "Telescope undo", "Undo history") - map("n", "ss", builtin.spell_suggest, "Spell suggestions") - map("n", "m", builtin.marks, "Marks") - map("n", "cc", builtin.commands, "Commands") - map("n", "ch", builtin.command_history, "Command history") - map("n", "vh", builtin.help_tags, "Help tags") + map("n", "fu", "Telescope undo", "Undo history") + map("n", "fs", builtin.spell_suggest, "Spell suggestions") + map("n", "fm", builtin.marks, "Marks") + map("n", "fh", builtin.command_history, "Command history") + map("n", "fH", builtin.help_tags, "Help tags") -- Quickfix - map("n", "ql", builtin.quickfix, "Quickfix list") - map("n", "qhl", builtin.quickfixhistory, "Quickfix history") + map("n", "fq", builtin.quickfix, "Quickfix list") + map("n", "fQ", builtin.quickfixhistory, "Quickfix history") end, }