✨ feat(nvim): new custom autocommands, keymaps and lazy all plugins
This commit is contained in:
parent
a0f144ae20
commit
dc95858318
3 changed files with 43 additions and 1 deletions
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -15,6 +15,26 @@ local function map(mode, lhs, rhs, opts)
|
|||
end
|
||||
end
|
||||
|
||||
-- ╭───────────────────────────────────────────────────────────╮
|
||||
-- │ Credit: June Gunn <Leader>?/! | 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", "<leader>?", function()
|
||||
google(vim.fn.expand("<cWORD>"), false)
|
||||
end, { desc = "Google" })
|
||||
|
||||
vim.keymap.set("x", "<leader>?", function()
|
||||
google(vim.fn.getreg("g"), false)
|
||||
end, { desc = "Google" })
|
||||
-- map(
|
||||
-- "n",
|
||||
-- "<leader>xs",
|
||||
|
@ -76,6 +96,8 @@ map("n", "<leader>si", ":Telescope import<CR>", { desc = "Imports" })
|
|||
|
||||
map("n", "<leader>cC", ":ConformInfo<CR>", { desc = "Conform Info" })
|
||||
|
||||
map("n", "<leader>cM", ":CmpStatus<CR>", { desc = "Cmp Status" })
|
||||
|
||||
-- map(
|
||||
-- "n",
|
||||
-- "<leader>ft",
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue