⚙️ config(nvim): new autocmd to fix telescope issue and binding to change color variant

This commit is contained in:
Sergio Laín 2023-11-30 13:20:49 +01:00
parent 30f53826a5
commit b279eccf16
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
2 changed files with 14 additions and 0 deletions

View file

@ -14,6 +14,15 @@ vim.api.nvim_create_autocmd("BufRead", {
end, end,
}) })
-- Fix telescope entering on insert mode
vim.api.nvim_create_autocmd("WinLeave", {
callback = function()
if vim.bo.ft == "TelescopePrompt" and vim.fn.mode() == "i" then
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "i", false)
end
end,
})
-- start git messages in insert mode -- start git messages in insert mode
vim.api.nvim_create_autocmd("BufRead", { vim.api.nvim_create_autocmd("BufRead", {
pattern = { "gitcommit", "gitrebase" }, pattern = { "gitcommit", "gitrebase" },

View file

@ -2,6 +2,7 @@
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua -- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
-- Add any additional keymaps here -- Add any additional keymaps here
local map = vim.keymap.set local map = vim.keymap.set
local Util = require("lazyvim.util")
-- ╭───────────────────────────────────────────────────────────╮ -- ╭───────────────────────────────────────────────────────────╮
-- │ Credit: June Gunn <Leader>?/! | Google it / Feeling lucky │ -- │ Credit: June Gunn <Leader>?/! | Google it / Feeling lucky │
@ -26,6 +27,10 @@ map("x", "<leader>?", function()
google(vim.fn.getreg("g"), false) google(vim.fn.getreg("g"), false)
end, { desc = "Google" }) end, { desc = "Google" })
map("n", "<leader>uB", function()
Util.toggle("background", false, { "light", "dark" })
end, { desc = "Toggle Background" })
map("n", "<leader>fT", "<Nop>") map("n", "<leader>fT", "<Nop>")
map("n", "<C-d>", "<C-d>zz") map("n", "<C-d>", "<C-d>zz")