A Swindon man has been sentenced to jail after pulling out a knife and attempting to stab his neighbours amid 'delusions'.