1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-29 10:50:06 +08:00
SpaceVim/lua/spacevim/api/vim/window.lua

41 lines
865 B
Lua
Raw Normal View History

2019-10-08 22:24:03 +08:00
local window = {}
function window.get_cursor(window_id)
local winindex = vim.eval("win_id2win(" .. window_id .. ")")
local w = vim.window(winindex)
if w == nil then
vim.command("return [" .. table.concat({0, 0}, ", ") .. "]")
else
vim.command("return [" .. table.concat({w.line, w.col}, ", ") .. "]")
end
end
function window.set_cursor(window_id, pos)
local winindex = vim.eval("win_id2win(" .. window_id .. ")")
local w = vim.window(winindex)
2019-10-12 00:10:29 +08:00
w.line = pos[0]
w.col = pos[1]
2019-10-08 22:24:03 +08:00
end
function window.close(window_id)
end
2022-10-10 13:58:09 +08:00
function window.is_float(winid)
if winid > 0 then
local ok, c = pcall(vim.api.nvim_win_get_config, winid)
if ok and c.col ~= nil then
return true
else
return false
end
else
return false
end
end
2019-10-08 22:24:03 +08:00
return window