Follow cursor activity

I’m trying to find a way i can keep track of where the cursor is.
I wonder if there is a way to save the current position any time the cursor moves either from the user typing or moving it with arrows or mouse.

The cursor position is already saved, you can access the position with getCursor. What is it that you’re trying to achieve exactly?

Im trying to compare the change that was made.
for example if the cursor was at line 0 and chr 1 and user moves the cursor somewhere else, say line 2 chr 3, I want the previous location and the current location to be saved and I want that save to happen on cursor change.

There are a few ways to do that, what are you hoping to do with that information?

Obsidian uses Codemirror under the hood. You can use a Codemirror state field to react to changes in the document and save the cursor changes.

Do you happen to have a link to some documentation that can help me with this?
I’m trying to implement a live translate from English letters to Japanese Kana. I need the location of the cursor on every change so that i can check behind it to see if I can take the letters and translate them.

Sure, here’s something to start with: CodeMirror Reference Manual