Hello fellow Vim users.
I am trying to execute a command when I write a buffer with :w
.
But the command should only be executed if I changed the content of the buffer.
I thought somthing like this maybe:
autocmd BufWritePost * if modified | echo 'execute command' | endif
How to I do that?
Edit:
I found the solution
autocmd BufWritePre * if &modified | echo 'execute command' | endif
Apperently I can not write modified without '&' in front it.