Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim autocmd on change line?

Tags:

vim

I'm trying to run a function whenever a line is altered, but there doesn't seem to be a specific autocommand for this. I could run the function on CursorMoved, but it would slow down editing. I could also map the function for all the major editing movements, but it could get very messy as I'm trying to keep each line independent of the others. If there's no solution, I could possibly do a diff every few seconds to see what's changed and run the function on the changed lines, but again it's a messy solution.

Any ideas?

like image 612
kknight Avatar asked Nov 01 '25 17:11

kknight


1 Answers

If you can get Vim 7.4, have a look at the TextChanged (and TextChangedI, for insert mode) events. (Note that this will monitor changes throughout the entire buffer.)

like image 117
Ben Klein Avatar answered Nov 03 '25 23:11

Ben Klein