Get The Currnet Neovim Cursor Position With Lua

October 2023
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