I'm trying to use the TextChanged autocmd to send edits to a daemon as I edit a buffer. Whenever I add text to the buffer I want my plugin to tell the daemon the text that was added and the position (in bytes) that it was added at. This is turning out to be non-trivial.My first attempt was to use the '[ and '] marks and get their positions with getpos/line/col, then use that to get the range of text I want. A problem with this is that if paste a new line with p, the '[ mark will end up on the first column of the new line rather than on the preceding newline character. Similarly with P and '].So, is there a way around these problems? Or is there a more direct way of doing this?
Get exact text of last edit
autocmd;mark