home ~ projects ~ socials

Get The Currnet Neovim Cursor Position With Lua

local position = vim.fn.getcurpos()
local line = position[2]
local column = position[3]

print(line)
print(column)
Output:
replace this
-- end of line --

References

Get the position of the cursor in Neovim