Is thinking of giving tzadaka considered a neder or a machsovah is nothing because you can’t control it. Hello,
The halacha that a person who has a thought to give money to tzedakah, that it is binding and that he has to give it, does not apply to all thoughts. It only applies when the person made a solid commitment to give the money, and not just with a fleeting thought. Therefore, if a person’s OCD is giving him such thoughts, of giving tzedakah, which are not coming from his will to give.
Is the halacha the same when someone is thinking of fasting but he can’t control it.
Fasting is even better than this, because, it isn’t binding unless it is spoken out. Nlike tzedaka which can occasionally apply even when thinking.