diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 27e9e064..cbb52806 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -1,3 +1,19 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here + +-- Disable diagnostics in a .env file +vim.api.nvim_create_autocmd("BufRead", { + pattern = ".env", + callback = function() + vim.diagnostic.disable(0) + end, +}) + +-- start git messages in insert mode +vim.api.nvim_create_autocmd("BufRead", { + pattern = { "gitcommit", "gitrebase" }, + callback = function() + vim.cmd("startinsert") + end, +}) diff --git a/.config/nvim/lua/config/keymaps.lua b/.config/nvim/lua/config/keymaps.lua index 6615cc59..b3aa881f 100644 --- a/.config/nvim/lua/config/keymaps.lua +++ b/.config/nvim/lua/config/keymaps.lua @@ -15,6 +15,26 @@ local function map(mode, lhs, rhs, opts) end end +-- ╭───────────────────────────────────────────────────────────╮ +-- │ Credit: June Gunn ?/! | Google it / Feeling lucky │ +-- ╰───────────────────────────────────────────────────────────╯ +---@param pat string +---@param lucky boolean +local function google(pat, lucky) + local query = '"' .. vim.fn.substitute(pat, '["\n]', " ", "g") .. '"' + query = vim.fn.substitute(query, "[[:punct:] ]", [[\=printf("%%%02X", char2nr(submatch(0)))]], "g") + vim.fn.system( + vim.fn.printf(vim.g.open_command .. ' "https://www.google.com/search?%sq=%s"', lucky and "btnI&" or "", query) + ) +end + +vim.keymap.set("n", "?", function() + google(vim.fn.expand(""), false) +end, { desc = "Google" }) + +vim.keymap.set("x", "?", function() + google(vim.fn.getreg("g"), false) +end, { desc = "Google" }) -- map( -- "n", -- "xs", @@ -76,6 +96,8 @@ map("n", "si", ":Telescope import", { desc = "Imports" }) map("n", "cC", ":ConformInfo", { desc = "Conform Info" }) +map("n", "cM", ":CmpStatus", { desc = "Cmp Status" }) + -- map( -- "n", -- "ft", diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index 4b70a2fd..8d3c8930 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -16,7 +16,7 @@ require("lazy").setup({ defaults = { -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. - lazy = false, + lazy = true, -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, -- have outdated releases, which may break your Neovim install. version = false, -- always use the latest git commit @@ -24,6 +24,10 @@ require("lazy").setup({ }, checker = { enabled = true }, -- automatically check for plugin updates performance = { + cache = { + enabled = true, + -- disable_events = {}, + }, rtp = { -- disable some rtp plugins disabled_plugins = {