Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,2 +1,24 @@
-- Disable Kitty keyboard protocol to avoid double Enter/Tab/Backspace on
-- Kitty and Alacritty (common on WSL GUI terminals with Neovim 0.11+).
local function kitty_protocol_terminal()
local term = vim.env.TERM or ""
if term:match("kitty") or term:match("alacritty") then
return true
end
return vim.env.KITTY_WINDOW_ID ~= nil or vim.env.ALACRITTY_WINDOW_ID ~= nil
end

if kitty_protocol_terminal() then
vim.api.nvim_create_autocmd({ "VimEnter", "VimLeavePre" }, {
callback = function(ev)
if ev.event == "VimEnter" then
io.stdout:write("\027[>1u")
else
io.stdout:write("\027[<1u")
end
end,
})
end

-- bootstrap lazy.nvim, LazyVim and your plugins
require("config.lazy")
32 changes: 29 additions & 3 deletions lua/config/autocmds.lua
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,38 @@ vim.api.nvim_create_user_command(
{ desc = "show hi name" }
)

local function open_colorscheme_picker()
-- Defer past cmdline teardown; keymaps don't need this, :commands do.
vim.schedule(function()
require("snacks").picker.colorschemes({ auto_close = false })
end)
end

vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
-- Cmdline/wildmenu: avoid diagnostic float stealing focus (WSL tab completion jump).
local mode = vim.api.nvim_get_mode().mode
if mode:find("^c") or vim.fn.getcmdwintype() ~= "" then
return
end

-- Skip floats (picker, diagnostics) so WSL/GUI terminals don't fight for focus.
if vim.api.nvim_win_get_config(0).relative ~= "" then
return
end

local ok, picker = pcall(require, "snacks.picker")
if ok and #picker.get() > 0 then
return
end

vim.diagnostic.open_float(nil, { focus = false })
end,
})

vim.api.nvim_create_user_command("ColorScheme", function()
require("snacks").picker.colorschemes()
end, { desc = "Pick colorscheme (Snacks picker with preview)" })
vim.api.nvim_create_user_command("PickColorscheme", open_colorscheme_picker, {
desc = "Pick colorscheme (Snacks picker with preview)",
})
vim.api.nvim_create_user_command("ColorScheme", open_colorscheme_picker, {
desc = "Alias for PickColorscheme",
})
8 changes: 8 additions & 0 deletions lua/plugins/snaks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ return {
explorer = {
enabled = false,
},
picker = {
sources = {
colorschemes = {
-- WSL + Kitty/Alacritty can fire spurious WinEnter events; keep picker open.
auto_close = false,
},
},
},
},
keys = {
{
Expand Down
Loading