update configs
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
"fidget.nvim": { "branch": "main", "commit": "82404b196e73a00b1727a91903beef5ddc319d22" },
|
||||
"flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||
"herdr-splits.nvim": { "branch": "main", "commit": "107273e004e4f7ef07f13c83164d2cb2c51df65d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lazydev.nvim": { "branch": "main", "commit": "ff2cbcba459b637ec3fd165a2be59b7bbaeedf0d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "221ce6b2d999187044529f49da6554a92f740a96" },
|
||||
@@ -23,9 +24,9 @@
|
||||
"nvim-lint": { "branch": "master", "commit": "d48f3a76189d03b2239f6df1b2f7e3fa8353743b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "229b79051b380377664edc4cbd534930154921a1" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" },
|
||||
"octo.nvim": { "branch": "master", "commit": "d05b852ad7eba6e34ffe38ee2db430f0fd6f6225" },
|
||||
"oil.nvim": { "branch": "master", "commit": "b73018b75affd13fa38e2fc94ef753b465f770d7" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||
"ripgrep": { "branch": "master", "commit": "82313cf95849bfe425109ad9506a52154879b1b1" },
|
||||
|
||||
@@ -2,55 +2,124 @@ local direction_map = {
|
||||
left = "h",
|
||||
right = "l",
|
||||
up = "k",
|
||||
down = "j"
|
||||
down = "j",
|
||||
}
|
||||
|
||||
local runtime_dir = os.getenv("XDG_RUNTIME_DIR") or "/tmp"
|
||||
local function get_stable_id()
|
||||
|
||||
local function sanitize(value)
|
||||
return value:gsub("[^%w_.-]", "_")
|
||||
end
|
||||
|
||||
local function get_hyprland_stable_id()
|
||||
local handle = io.popen("hyprctl activewindow -j 2>/dev/null")
|
||||
|
||||
if not handle then
|
||||
return "unknown"
|
||||
end
|
||||
|
||||
local data = handle:read("*a")
|
||||
handle:close()
|
||||
|
||||
local ok, json = pcall(vim.json.decode, data)
|
||||
|
||||
if ok and json and json.stableId then
|
||||
return tostring(json.stableId)
|
||||
end
|
||||
|
||||
return "unknown"
|
||||
end
|
||||
|
||||
local stable_id = get_stable_id()
|
||||
local function get_socket_path()
|
||||
local pane_id = vim.env.HERDR_PANE_ID
|
||||
|
||||
local socket_path = string.format("%s/nvim-hypr-nav-%s.sock", runtime_dir, stable_id)
|
||||
if pane_id and pane_id ~= "" then
|
||||
return string.format(
|
||||
"%s/nvim-hypr-nav-pane-%s.sock",
|
||||
runtime_dir,
|
||||
sanitize(pane_id)
|
||||
)
|
||||
end
|
||||
|
||||
return string.format(
|
||||
"%s/nvim-hypr-nav-%s.sock",
|
||||
runtime_dir,
|
||||
get_hyprland_stable_id()
|
||||
)
|
||||
end
|
||||
|
||||
local socket_path = get_socket_path()
|
||||
local server = vim.uv.new_pipe(false)
|
||||
|
||||
local function reply(connection, response)
|
||||
local ok = pcall(function()
|
||||
connection:write(response, function()
|
||||
pcall(function()
|
||||
connection:close()
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
if not ok then
|
||||
pcall(function()
|
||||
connection:close()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
-- Normally unnecessary because Herdr sockets contain the process ID, but it
|
||||
-- also cleans up an ungracefully terminated direct-Neovim instance if the PID
|
||||
-- happened to be reused.
|
||||
vim.uv.fs_unlink(socket_path)
|
||||
|
||||
server:bind(socket_path)
|
||||
|
||||
server:listen(128, function(err)
|
||||
if err then vim.notify("hypr-nav: " .. err, vim.log.levels.ERROR) end
|
||||
if err then
|
||||
vim.schedule(function()
|
||||
vim.notify("hypr-nav: " .. err, vim.log.levels.ERROR)
|
||||
end)
|
||||
return
|
||||
end
|
||||
|
||||
local conn = vim.uv.new_pipe(false)
|
||||
server:accept(conn)
|
||||
local connection = vim.uv.new_pipe(false)
|
||||
server:accept(connection)
|
||||
|
||||
conn:read_start(function(err, data)
|
||||
if not data then
|
||||
pcall(function() conn:close() end)
|
||||
connection:read_start(function(read_err, data)
|
||||
if read_err or not data then
|
||||
pcall(function()
|
||||
connection:close()
|
||||
end)
|
||||
return
|
||||
end
|
||||
local direction = data:match("nav:(%a+)")
|
||||
if not direction then
|
||||
pcall(function() conn:write("invalid\n") end)
|
||||
|
||||
pcall(function() conn:close() end)
|
||||
local direction = data:match("nav:(%a+)")
|
||||
|
||||
if not direction or not direction_map[direction] then
|
||||
reply(connection, "invalid\n")
|
||||
return
|
||||
end
|
||||
|
||||
vim.schedule(function()
|
||||
local before = vim.api.nvim_get_current_win()
|
||||
local wincmd_dir = direction_map[direction] or direction:sub(1, 1)
|
||||
vim.cmd("wincmd " .. wincmd_dir)
|
||||
local after = vim.api.nvim_get_current_win()
|
||||
local response = (before == after) and "failed\n" or "success\n"
|
||||
|
||||
pcall(function() conn:write(response) end)
|
||||
pcall(function() conn:close() end)
|
||||
vim.cmd("wincmd " .. direction_map[direction])
|
||||
|
||||
local after = vim.api.nvim_get_current_win()
|
||||
local response = before == after and "failed\n" or "success\n"
|
||||
|
||||
reply(connection, response)
|
||||
end)
|
||||
end)
|
||||
end)
|
||||
|
||||
vim.api.nvim_create_autocmd("VimLeavePre", {
|
||||
once = true,
|
||||
callback = function()
|
||||
pcall(function()
|
||||
server:close()
|
||||
end)
|
||||
|
||||
vim.uv.fs_unlink(socket_path)
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -6,17 +6,14 @@ return
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("catppuccin").setup({
|
||||
transparent_background = false,
|
||||
transparent_background = true,
|
||||
|
||||
custom_highlights = function(colors)
|
||||
return {
|
||||
Normal = { bg = colors.base },
|
||||
NormalNC = { bg = colors.mantle },
|
||||
|
||||
WinSeparator = { fg = colors.surface1, bg = colors.mantle },
|
||||
WinSeparator = { fg = colors.surface1 },
|
||||
|
||||
StatusLine = { fg = colors.text, bg = colors.surface0 },
|
||||
StatusLineNC = { fg = colors.overlay0, bg = colors.mantle },
|
||||
StatusLineNC = { fg = colors.overlay0 },
|
||||
|
||||
CursorLine = { bg = colors.surface0 },
|
||||
}
|
||||
|
||||
@@ -17,7 +17,8 @@ return {
|
||||
"templ",
|
||||
"nil_ls",
|
||||
"gleam",
|
||||
"ty"
|
||||
"ty",
|
||||
"buf_ls"
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user