Skip to content

Commit

Permalink
refactor: use vim.fn.winnr instead of wincmd
Browse files Browse the repository at this point in the history
  • Loading branch information
willothy authored and cryptomilk committed Jul 15, 2023
1 parent da79772 commit 7967bc3
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lua/focus/modules/split.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,9 @@ function M.split_cycle(reverse, bufnew)
end

function M.split_exists_direction(winnr, direction)
cmd('wincmd ' .. direction)
if winnr == vim.api.nvim_get_current_win() then
return false
else
-- we want to stay in the current split we were in
cmd('wincmd ' .. move_back(direction))
return true
end
return vim.api.nvim_win_call(winnr, function()
return vim.fn.winnr() ~= vim.fn.winnr(direction)
end)
end

return M

0 comments on commit 7967bc3

Please sign in to comment.